| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkPath.h" | 9 #include "SkPath.h" |
| 10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 canvas->drawPaint(p); | 25 canvas->drawPaint(p); |
| 26 canvas->restore(); | 26 canvas->restore(); |
| 27 | 27 |
| 28 canvas->concat(zoomOut); | 28 canvas->concat(zoomOut); |
| 29 p.setColor(SK_ColorBLUE); | 29 p.setColor(SK_ColorBLUE); |
| 30 canvas->saveLayer(layerRect, nullptr); | 30 canvas->saveLayer(layerRect, nullptr); |
| 31 canvas->clipRRect(rrect, SkRegion::kIntersect_Op, false); | 31 canvas->clipRRect(rrect, SkRegion::kIntersect_Op, false); |
| 32 canvas->drawPaint(p); | 32 canvas->drawPaint(p); |
| 33 canvas->restore(); | 33 canvas->restore(); |
| 34 | 34 |
| 35 static constexpr SkPoint kPts[] = {{0.f, 0.f}, {256.f, 256.f}}; | 35 constexpr SkPoint kPts[] = {{0.f, 0.f}, {256.f, 256.f}}; |
| 36 static constexpr SkColor kColors1[] = {SK_ColorCYAN, SK_ColorGREEN}; | 36 constexpr SkColor kColors1[] = {SK_ColorCYAN, SK_ColorGREEN}; |
| 37 p.setShader(SkGradientShader::MakeLinear(kPts, kColors1, nullptr, 2, | 37 p.setShader(SkGradientShader::MakeLinear(kPts, kColors1, nullptr, 2, |
| 38 SkShader::kClamp_TileMode)); | 38 SkShader::kClamp_TileMode)); |
| 39 canvas->concat(zoomOut); | 39 canvas->concat(zoomOut); |
| 40 canvas->saveLayer(layerRect, nullptr); | 40 canvas->saveLayer(layerRect, nullptr); |
| 41 canvas->clipRRect(rrect, SkRegion::kIntersect_Op, true); | 41 canvas->clipRRect(rrect, SkRegion::kIntersect_Op, true); |
| 42 canvas->drawPaint(p); | 42 canvas->drawPaint(p); |
| 43 canvas->restore(); | 43 canvas->restore(); |
| 44 | 44 |
| 45 static constexpr SkColor kColors2[] = {SK_ColorMAGENTA, SK_ColorGRAY}; | 45 constexpr SkColor kColors2[] = {SK_ColorMAGENTA, SK_ColorGRAY}; |
| 46 p.setShader(SkGradientShader::MakeRadial({128.f, 128.f}, 128.f, kColors2, nu
llptr, 2, | 46 p.setShader(SkGradientShader::MakeRadial({128.f, 128.f}, 128.f, kColors2, nu
llptr, 2, |
| 47 SkShader::kClamp_TileMode)); | 47 SkShader::kClamp_TileMode)); |
| 48 canvas->concat(zoomOut); | 48 canvas->concat(zoomOut); |
| 49 canvas->saveLayer(layerRect, nullptr); | 49 canvas->saveLayer(layerRect, nullptr); |
| 50 canvas->clipRRect(rrect, SkRegion::kIntersect_Op, false); | 50 canvas->clipRRect(rrect, SkRegion::kIntersect_Op, false); |
| 51 canvas->drawPaint(p); | 51 canvas->drawPaint(p); |
| 52 canvas->restore(); | 52 canvas->restore(); |
| 53 } | 53 } |
| OLD | NEW |