| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
| 10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 result->setImmutable(); | 79 result->setImmutable(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 // This GM exercises the drawBitmapRectToRect "bleed" flag | 82 // This GM exercises the drawBitmapRectToRect "bleed" flag |
| 83 class BleedGM : public skiagm::GM { | 83 class BleedGM : public skiagm::GM { |
| 84 public: | 84 public: |
| 85 BleedGM() {} | 85 BleedGM() {} |
| 86 | 86 |
| 87 protected: | 87 protected: |
| 88 | 88 |
| 89 SkString onShortName() SK_OVERRIDE { | 89 SkString onShortName() override { |
| 90 return SkString("bleed"); | 90 return SkString("bleed"); |
| 91 } | 91 } |
| 92 | 92 |
| 93 SkISize onISize() SK_OVERRIDE { | 93 SkISize onISize() override { |
| 94 return SkISize::Make(kWidth, 780); | 94 return SkISize::Make(kWidth, 780); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void onOnceBeforeDraw() SK_OVERRIDE { | 97 void onOnceBeforeDraw() override { |
| 98 make_ringed_bitmap(&fBitmapSmall, kSmallTextureSize, kSmallTextureSize); | 98 make_ringed_bitmap(&fBitmapSmall, kSmallTextureSize, kSmallTextureSize); |
| 99 | 99 |
| 100 // To exercise the GPU's tiling path we need a texture | 100 // To exercise the GPU's tiling path we need a texture |
| 101 // too big for the GPU to handle in one go | 101 // too big for the GPU to handle in one go |
| 102 make_ringed_bitmap(&fBitmapBig, 2*kMaxTextureSize, 2*kMaxTextureSize); | 102 make_ringed_bitmap(&fBitmapBig, 2*kMaxTextureSize, 2*kMaxTextureSize); |
| 103 } | 103 } |
| 104 | 104 |
| 105 // Draw only the center of the small bitmap | 105 // Draw only the center of the small bitmap |
| 106 void drawCase1(SkCanvas* canvas, int transX, int transY, | 106 void drawCase1(SkCanvas* canvas, int transX, int transY, |
| 107 SkCanvas::DrawBitmapRectFlags flags, SkFilterQuality filter)
{ | 107 SkCanvas::DrawBitmapRectFlags flags, SkFilterQuality filter)
{ |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, | 166 SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, |
| 167 SkBlurMask::ConvertRadiusToSigma(SkIntT
oScalar(3))); | 167 SkBlurMask::ConvertRadiusToSigma(SkIntT
oScalar(3))); |
| 168 paint.setMaskFilter(mf)->unref(); | 168 paint.setMaskFilter(mf)->unref(); |
| 169 | 169 |
| 170 canvas->save(); | 170 canvas->save(); |
| 171 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); | 171 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); |
| 172 canvas->drawBitmapRectToRect(fBitmapSmall, &src, dst, &paint, flags); | 172 canvas->drawBitmapRectToRect(fBitmapSmall, &src, dst, &paint, flags); |
| 173 canvas->restore(); | 173 canvas->restore(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 176 void onDraw(SkCanvas* canvas) override { |
| 177 | 177 |
| 178 canvas->clear(SK_ColorGRAY); | 178 canvas->clear(SK_ColorGRAY); |
| 179 | 179 |
| 180 for (int m = 0; m < 2; ++m) { | 180 for (int m = 0; m < 2; ++m) { |
| 181 canvas->save(); | 181 canvas->save(); |
| 182 if (m) { | 182 if (m) { |
| 183 static const SkScalar kBottom = SkIntToScalar(kRow3Y + kBlockSiz
e + kBlockSpacing); | 183 static const SkScalar kBottom = SkIntToScalar(kRow3Y + kBlockSiz
e + kBlockSpacing); |
| 184 canvas->translate(0, kBottom); | 184 canvas->translate(0, kBottom); |
| 185 SkMatrix rotate; | 185 SkMatrix rotate; |
| 186 rotate.setRotate(15.f, 0, kBottom + kBlockSpacing); | 186 rotate.setRotate(15.f, 0, kBottom + kBlockSpacing); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 static const int kSmallTextureSize = 6; | 270 static const int kSmallTextureSize = 6; |
| 271 static const int kMaxTextureSize = 32; | 271 static const int kMaxTextureSize = 32; |
| 272 | 272 |
| 273 SkBitmap fBitmapSmall; | 273 SkBitmap fBitmapSmall; |
| 274 SkBitmap fBitmapBig; | 274 SkBitmap fBitmapBig; |
| 275 | 275 |
| 276 typedef GM INHERITED; | 276 typedef GM INHERITED; |
| 277 }; | 277 }; |
| 278 | 278 |
| 279 DEF_GM( return new BleedGM(); ) | 279 DEF_GM( return new BleedGM(); ) |
| OLD | NEW |