| 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" |
| 10 #include "SkBlurMaskFilter.h" |
| 9 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 10 #include "SkBlurMaskFilter.h" | |
| 11 | 12 |
| 12 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
| 13 #include "GrContext.h" | 14 #include "GrContext.h" |
| 14 | 15 |
| 15 namespace skiagm { | 16 namespace skiagm { |
| 16 extern GrContext* GetGr(); | 17 extern GrContext* GetGr(); |
| 17 }; | 18 }; |
| 18 #endif | 19 #endif |
| 19 | 20 |
| 20 // Create a black&white checked texture with a 1-pixel red ring | 21 // Create a black&white checked texture with a 1-pixel red ring |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // Draw the center of the small bitmap with a mask filter | 140 // Draw the center of the small bitmap with a mask filter |
| 140 void drawCase4(SkCanvas* canvas, int transX, int transY, | 141 void drawCase4(SkCanvas* canvas, int transX, int transY, |
| 141 SkCanvas::DrawBitmapRectFlags flags, bool filter) { | 142 SkCanvas::DrawBitmapRectFlags flags, bool filter) { |
| 142 SkRect src = SkRect::MakeXYWH(1, 1, | 143 SkRect src = SkRect::MakeXYWH(1, 1, |
| 143 kSmallTextureSize-2, | 144 kSmallTextureSize-2, |
| 144 kSmallTextureSize-2); | 145 kSmallTextureSize-2); |
| 145 SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToSc
alar(kBlockSize)); | 146 SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToSc
alar(kBlockSize)); |
| 146 | 147 |
| 147 SkPaint paint; | 148 SkPaint paint; |
| 148 paint.setFilterBitmap(filter); | 149 paint.setFilterBitmap(filter); |
| 149 SkMaskFilter* mf = SkBlurMaskFilter::Create(SkIntToScalar(3), | 150 SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_Bl
urStyle, |
| 150 SkBlurMaskFilter::kNormal_Bl
urStyle); | 151 SkBlurMask::ConvertRadiusToSigma(SkIntT
oScalar(3))); |
| 151 paint.setMaskFilter(mf)->unref(); | 152 paint.setMaskFilter(mf)->unref(); |
| 152 | 153 |
| 153 canvas->save(); | 154 canvas->save(); |
| 154 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); | 155 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); |
| 155 canvas->drawBitmapRectToRect(fBitmapSmall, &src, dst, &paint, flags); | 156 canvas->drawBitmapRectToRect(fBitmapSmall, &src, dst, &paint, flags); |
| 156 canvas->restore(); | 157 canvas->restore(); |
| 157 } | 158 } |
| 158 | 159 |
| 159 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 160 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 160 | 161 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 static const int kSmallTextureSize = 4; | 222 static const int kSmallTextureSize = 4; |
| 222 static const int kMaxTextureSize = 32; | 223 static const int kMaxTextureSize = 32; |
| 223 | 224 |
| 224 SkBitmap fBitmapSmall; | 225 SkBitmap fBitmapSmall; |
| 225 SkBitmap fBitmapBig; | 226 SkBitmap fBitmapBig; |
| 226 | 227 |
| 227 typedef GM INHERITED; | 228 typedef GM INHERITED; |
| 228 }; | 229 }; |
| 229 | 230 |
| 230 DEF_GM( return new BleedGM(); ) | 231 DEF_GM( return new BleedGM(); ) |
| OLD | NEW |