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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 // Then draw a column with no bleeding or tiling but with high filte
ring | 206 // Then draw a column with no bleeding or tiling but with high filte
ring |
207 this->drawCase1(canvas, kCol2X, kRow0Y, SkCanvas::kNone_DrawBitmapRe
ctFlag, SkPaint::kHigh_FilterLevel); | 207 this->drawCase1(canvas, kCol2X, kRow0Y, SkCanvas::kNone_DrawBitmapRe
ctFlag, SkPaint::kHigh_FilterLevel); |
208 this->drawCase2(canvas, kCol2X, kRow1Y, SkCanvas::kNone_DrawBitmapRe
ctFlag, SkPaint::kHigh_FilterLevel); | 208 this->drawCase2(canvas, kCol2X, kRow1Y, SkCanvas::kNone_DrawBitmapRe
ctFlag, SkPaint::kHigh_FilterLevel); |
209 this->drawCase3(canvas, kCol2X, kRow2Y, SkCanvas::kNone_DrawBitmapRe
ctFlag, SkPaint::kHigh_FilterLevel); | 209 this->drawCase3(canvas, kCol2X, kRow2Y, SkCanvas::kNone_DrawBitmapRe
ctFlag, SkPaint::kHigh_FilterLevel); |
210 this->drawCase4(canvas, kCol2X, kRow3Y, SkCanvas::kNone_DrawBitmapRe
ctFlag, SkPaint::kHigh_FilterLevel); | 210 this->drawCase4(canvas, kCol2X, kRow3Y, SkCanvas::kNone_DrawBitmapRe
ctFlag, SkPaint::kHigh_FilterLevel); |
211 | 211 |
212 #if SK_SUPPORT_GPU | 212 #if SK_SUPPORT_GPU |
213 GrContext* ctx = canvas->getGrContext(); | 213 GrContext* ctx = canvas->getGrContext(); |
214 int oldMaxTextureSize = 0; | 214 int oldMaxTextureSize = 0; |
215 if (NULL != ctx) { | 215 if (ctx) { |
216 // shrink the max texture size so all our textures can be reason
ably sized | 216 // shrink the max texture size so all our textures can be reason
ably sized |
217 oldMaxTextureSize = ctx->getMaxTextureSize(); | 217 oldMaxTextureSize = ctx->getMaxTextureSize(); |
218 ctx->setMaxTextureSizeOverride(kMaxTextureSize); | 218 ctx->setMaxTextureSizeOverride(kMaxTextureSize); |
219 } | 219 } |
220 #endif | 220 #endif |
221 | 221 |
222 // Then draw a column with no bleeding but with tiling and low filte
ring | 222 // Then draw a column with no bleeding but with tiling and low filte
ring |
223 this->drawCase1(canvas, kCol3X, kRow0Y, SkCanvas::kNone_DrawBitmapRe
ctFlag, SkPaint::kLow_FilterLevel); | 223 this->drawCase1(canvas, kCol3X, kRow0Y, SkCanvas::kNone_DrawBitmapRe
ctFlag, SkPaint::kLow_FilterLevel); |
224 this->drawCase2(canvas, kCol3X, kRow1Y, SkCanvas::kNone_DrawBitmapRe
ctFlag, SkPaint::kLow_FilterLevel); | 224 this->drawCase2(canvas, kCol3X, kRow1Y, SkCanvas::kNone_DrawBitmapRe
ctFlag, SkPaint::kLow_FilterLevel); |
225 this->drawCase3(canvas, kCol3X, kRow2Y, SkCanvas::kNone_DrawBitmapRe
ctFlag, SkPaint::kLow_FilterLevel); | 225 this->drawCase3(canvas, kCol3X, kRow2Y, SkCanvas::kNone_DrawBitmapRe
ctFlag, SkPaint::kLow_FilterLevel); |
(...skipping 11 matching lines...) Expand all Loading... |
237 this->drawCase3(canvas, kCol5X, kRow2Y, SkCanvas::kBleed_DrawBitmapR
ectFlag, SkPaint::kLow_FilterLevel); | 237 this->drawCase3(canvas, kCol5X, kRow2Y, SkCanvas::kBleed_DrawBitmapR
ectFlag, SkPaint::kLow_FilterLevel); |
238 this->drawCase4(canvas, kCol5X, kRow3Y, SkCanvas::kBleed_DrawBitmapR
ectFlag, SkPaint::kLow_FilterLevel); | 238 this->drawCase4(canvas, kCol5X, kRow3Y, SkCanvas::kBleed_DrawBitmapR
ectFlag, SkPaint::kLow_FilterLevel); |
239 | 239 |
240 // Finally draw a column with bleeding, tiling, and high filtering | 240 // Finally draw a column with bleeding, tiling, and high filtering |
241 this->drawCase1(canvas, kCol6X, kRow0Y, SkCanvas::kBleed_DrawBitmapR
ectFlag, SkPaint::kHigh_FilterLevel); | 241 this->drawCase1(canvas, kCol6X, kRow0Y, SkCanvas::kBleed_DrawBitmapR
ectFlag, SkPaint::kHigh_FilterLevel); |
242 this->drawCase2(canvas, kCol6X, kRow1Y, SkCanvas::kBleed_DrawBitmapR
ectFlag, SkPaint::kHigh_FilterLevel); | 242 this->drawCase2(canvas, kCol6X, kRow1Y, SkCanvas::kBleed_DrawBitmapR
ectFlag, SkPaint::kHigh_FilterLevel); |
243 this->drawCase3(canvas, kCol6X, kRow2Y, SkCanvas::kBleed_DrawBitmapR
ectFlag, SkPaint::kHigh_FilterLevel); | 243 this->drawCase3(canvas, kCol6X, kRow2Y, SkCanvas::kBleed_DrawBitmapR
ectFlag, SkPaint::kHigh_FilterLevel); |
244 this->drawCase4(canvas, kCol6X, kRow3Y, SkCanvas::kBleed_DrawBitmapR
ectFlag, SkPaint::kHigh_FilterLevel); | 244 this->drawCase4(canvas, kCol6X, kRow3Y, SkCanvas::kBleed_DrawBitmapR
ectFlag, SkPaint::kHigh_FilterLevel); |
245 | 245 |
246 #if SK_SUPPORT_GPU | 246 #if SK_SUPPORT_GPU |
247 if (NULL != ctx) { | 247 if (ctx) { |
248 ctx->setMaxTextureSizeOverride(oldMaxTextureSize); | 248 ctx->setMaxTextureSizeOverride(oldMaxTextureSize); |
249 } | 249 } |
250 #endif | 250 #endif |
251 canvas->restore(); | 251 canvas->restore(); |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 private: | 255 private: |
256 static const int kBlockSize = 70; | 256 static const int kBlockSize = 70; |
257 static const int kBlockSpacing = 5; | 257 static const int kBlockSpacing = 5; |
(...skipping 15 matching lines...) Expand all Loading... |
273 static const int kSmallTextureSize = 6; | 273 static const int kSmallTextureSize = 6; |
274 static const int kMaxTextureSize = 32; | 274 static const int kMaxTextureSize = 32; |
275 | 275 |
276 SkBitmap fBitmapSmall; | 276 SkBitmap fBitmapSmall; |
277 SkBitmap fBitmapBig; | 277 SkBitmap fBitmapBig; |
278 | 278 |
279 typedef GM INHERITED; | 279 typedef GM INHERITED; |
280 }; | 280 }; |
281 | 281 |
282 DEF_GM( return new BleedGM(); ) | 282 DEF_GM( return new BleedGM(); ) |
OLD | NEW |