radial_gradient_precision.cpp 995 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright 2017 Google Inc.
  3. *
  4. * Use of this source code is governed by a BSD-style license that can be
  5. * found in the LICENSE file.
  6. */
  7. #include "gm/gm.h"
  8. #include "include/core/SkCanvas.h"
  9. #include "include/core/SkColor.h"
  10. #include "include/core/SkPaint.h"
  11. #include "include/core/SkPoint.h"
  12. #include "include/core/SkScalar.h"
  13. #include "include/core/SkShader.h"
  14. #include "include/core/SkTileMode.h"
  15. #include "include/core/SkTypes.h"
  16. #include "include/effects/SkGradientShader.h"
  17. // All we're looking for here is that we see a smooth gradient.
  18. DEF_SIMPLE_GM(radial_gradient_precision, canvas, 200, 200) {
  19. SkPoint center = {1000, 1000};
  20. SkScalar radius = 40;
  21. SkColor colors[] = {SK_ColorBLACK, SK_ColorGREEN};
  22. SkPaint p;
  23. p.setShader(SkGradientShader::MakeRadial(center, radius,
  24. colors, nullptr, SK_ARRAY_COUNT(colors),
  25. SkTileMode::kRepeat));
  26. canvas->drawPaint(p);
  27. }