| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" |
| 10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 return SkISize::Make(kWidth, kHeight); | 31 return SkISize::Make(kWidth, kHeight); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void onDraw(SkCanvas* canvas) override { | 34 void onDraw(SkCanvas* canvas) override { |
| 35 SkPaint whitePaint; | 35 SkPaint whitePaint; |
| 36 whitePaint.setColor(SK_ColorWHITE); | 36 whitePaint.setColor(SK_ColorWHITE); |
| 37 whitePaint.setXfermode(SkXfermode::Make(SkXfermode::kSrc_Mode)); | 37 whitePaint.setXfermode(SkXfermode::Make(SkXfermode::kSrc_Mode)); |
| 38 whitePaint.setAntiAlias(true); | 38 whitePaint.setAntiAlias(true); |
| 39 | 39 |
| 40 // This scale exercises precision limits in the circle blur effect (crbu
g.com/560651) | 40 // This scale exercises precision limits in the circle blur effect (crbu
g.com/560651) |
| 41 static const float kScale = 2.0f; | 41 constexpr float kScale = 2.0f; |
| 42 canvas->scale(kScale, kScale); | 42 canvas->scale(kScale, kScale); |
| 43 | 43 |
| 44 canvas->save(); | 44 canvas->save(); |
| 45 SkRect clipRect1 = SkRect::MakeLTRB(0, 0, | 45 SkRect clipRect1 = SkRect::MakeLTRB(0, 0, |
| 46 SkIntToScalar(kWidth), SkIntToSc
alar(kHeight)); | 46 SkIntToScalar(kWidth), SkIntToSc
alar(kHeight)); |
| 47 | 47 |
| 48 canvas->clipRect(clipRect1, SkRegion::kIntersect_Op, false); | 48 canvas->clipRect(clipRect1, SkRegion::kIntersect_Op, false); |
| 49 | 49 |
| 50 canvas->save(); | 50 canvas->save(); |
| 51 | 51 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 73 paint.setAntiAlias(true); | 73 paint.setAntiAlias(true); |
| 74 | 74 |
| 75 canvas->drawRRect(rr, paint); | 75 canvas->drawRRect(rr, paint); |
| 76 | 76 |
| 77 canvas->restore(); | 77 canvas->restore(); |
| 78 canvas->restore(); | 78 canvas->restore(); |
| 79 canvas->restore(); | 79 canvas->restore(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 static const int kWidth = 1164; | 83 static constexpr int kWidth = 1164; |
| 84 static const int kHeight = 802; | 84 static constexpr int kHeight = 802; |
| 85 | 85 |
| 86 typedef GM INHERITED; | 86 typedef GM INHERITED; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 ////////////////////////////////////////////////////////////////////////////// | 89 ////////////////////////////////////////////////////////////////////////////// |
| 90 | 90 |
| 91 DEF_GM(return new BlurredClippedCircleGM;) | 91 DEF_GM(return new BlurredClippedCircleGM;) |
| 92 } | 92 } |
| OLD | NEW |