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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // Draw the center of the small bitmap with a mask filter | 139 // Draw the center of the small bitmap with a mask filter |
140 void drawCase4(SkCanvas* canvas, int transX, int transY, | 140 void drawCase4(SkCanvas* canvas, int transX, int transY, |
141 SkCanvas::DrawBitmapRectFlags flags, bool filter) { | 141 SkCanvas::DrawBitmapRectFlags flags, bool filter) { |
142 SkRect src = SkRect::MakeXYWH(1, 1, | 142 SkRect src = SkRect::MakeXYWH(1, 1, |
143 kSmallTextureSize-2, | 143 kSmallTextureSize-2, |
144 kSmallTextureSize-2); | 144 kSmallTextureSize-2); |
145 SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToSc
alar(kBlockSize)); | 145 SkRect dst = SkRect::MakeXYWH(0, 0, SkIntToScalar(kBlockSize), SkIntToSc
alar(kBlockSize)); |
146 | 146 |
147 SkPaint paint; | 147 SkPaint paint; |
148 paint.setFilterBitmap(filter); | 148 paint.setFilterBitmap(filter); |
149 SkMaskFilter* mf = SkBlurMaskFilter::Create(SkIntToScalar(3), | 149 SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_Bl
urStyle, |
150 SkBlurMaskFilter::kNormal_Bl
urStyle); | 150 SkFloatToScalar(2.23205f)); |
151 paint.setMaskFilter(mf)->unref(); | 151 paint.setMaskFilter(mf)->unref(); |
152 | 152 |
153 canvas->save(); | 153 canvas->save(); |
154 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); | 154 canvas->translate(SkIntToScalar(transX), SkIntToScalar(transY)); |
155 canvas->drawBitmapRectToRect(fBitmapSmall, &src, dst, &paint, flags); | 155 canvas->drawBitmapRectToRect(fBitmapSmall, &src, dst, &paint, flags); |
156 canvas->restore(); | 156 canvas->restore(); |
157 } | 157 } |
158 | 158 |
159 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 159 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
160 | 160 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 static const int kSmallTextureSize = 4; | 221 static const int kSmallTextureSize = 4; |
222 static const int kMaxTextureSize = 32; | 222 static const int kMaxTextureSize = 32; |
223 | 223 |
224 SkBitmap fBitmapSmall; | 224 SkBitmap fBitmapSmall; |
225 SkBitmap fBitmapBig; | 225 SkBitmap fBitmapBig; |
226 | 226 |
227 typedef GM INHERITED; | 227 typedef GM INHERITED; |
228 }; | 228 }; |
229 | 229 |
230 DEF_GM( return new BleedGM(); ) | 230 DEF_GM( return new BleedGM(); ) |
OLD | NEW |