| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // Draw the center of the small bitmap with a mask filter | 155 // Draw the center of the small bitmap with a mask filter |
| 156 void drawCase4(SkCanvas* canvas, int transX, int transY, | 156 void drawCase4(SkCanvas* canvas, int transX, int transY, |
| 157 SkCanvas::DrawBitmapRectFlags flags, SkPaint::FilterLevel fil
ter) { | 157 SkCanvas::DrawBitmapRectFlags flags, SkPaint::FilterLevel fil
ter) { |
| 158 SkRect src = SkRect::MakeXYWH(2, 2, | 158 SkRect src = SkRect::MakeXYWH(2, 2, |
| 159 SkIntToScalar(kSmallTextureSize-4), | 159 SkIntToScalar(kSmallTextureSize-4), |
| 160 SkIntToScalar(kSmallTextureSize-4)); | 160 SkIntToScalar(kSmallTextureSize-4)); |
| 161 SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToSc
alar(kBlockSize)); | 161 SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToSc
alar(kBlockSize)); |
| 162 | 162 |
| 163 SkPaint paint; | 163 SkPaint paint; |
| 164 paint.setFilterLevel(filter); | 164 paint.setFilterLevel(filter); |
| 165 SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_Bl
urStyle, | 165 SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, |
| 166 SkBlurMask::ConvertRadiusToSigma(SkIntT
oScalar(3))); | 166 SkBlurMask::ConvertRadiusToSigma(SkIntT
oScalar(3))); |
| 167 paint.setMaskFilter(mf)->unref(); | 167 paint.setMaskFilter(mf)->unref(); |
| 168 | 168 |
| 169 canvas->save(); | 169 canvas->save(); |
| 170 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); | 170 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); |
| 171 canvas->drawBitmapRectToRect(fBitmapSmall, &src, dst, &paint, flags); | 171 canvas->drawBitmapRectToRect(fBitmapSmall, &src, dst, &paint, flags); |
| 172 canvas->restore(); | 172 canvas->restore(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 175 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 static const int kSmallTextureSize = 6; | 269 static const int kSmallTextureSize = 6; |
| 270 static const int kMaxTextureSize = 32; | 270 static const int kMaxTextureSize = 32; |
| 271 | 271 |
| 272 SkBitmap fBitmapSmall; | 272 SkBitmap fBitmapSmall; |
| 273 SkBitmap fBitmapBig; | 273 SkBitmap fBitmapBig; |
| 274 | 274 |
| 275 typedef GM INHERITED; | 275 typedef GM INHERITED; |
| 276 }; | 276 }; |
| 277 | 277 |
| 278 DEF_GM( return new BleedGM(); ) | 278 DEF_GM( return new BleedGM(); ) |
| OLD | NEW |