| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
| 10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY))->unref
(); | 34 paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY))->unref
(); |
| 35 const SkScalar tile_size = SkIntToScalar(128); | 35 const SkScalar tile_size = SkIntToScalar(128); |
| 36 SkRect bounds; | 36 SkRect bounds; |
| 37 if (!canvas->getClipBounds(&bounds)) { | 37 if (!canvas->getClipBounds(&bounds)) { |
| 38 bounds.setEmpty(); | 38 bounds.setEmpty(); |
| 39 } | 39 } |
| 40 for (SkScalar y = bounds.top(); y < bounds.bottom(); y += tile_size) { | 40 for (SkScalar y = bounds.top(); y < bounds.bottom(); y += tile_size) { |
| 41 for (SkScalar x = bounds.left(); x < bounds.right(); x += tile_size)
{ | 41 for (SkScalar x = bounds.left(); x < bounds.right(); x += tile_size)
{ |
| 42 canvas->save(); | 42 canvas->save(); |
| 43 canvas->clipRect(SkRect::MakeXYWH(x, y, tile_size, tile_size)); | 43 canvas->clipRect(SkRect::MakeXYWH(x, y, tile_size, tile_size)); |
| 44 canvas->saveLayer(NULL, &paint); | 44 canvas->saveLayer(nullptr, &paint); |
| 45 const char* str[] = { | 45 const char* str[] = { |
| 46 "The quick", | 46 "The quick", |
| 47 "brown fox", | 47 "brown fox", |
| 48 "jumped over", | 48 "jumped over", |
| 49 "the lazy dog.", | 49 "the lazy dog.", |
| 50 }; | 50 }; |
| 51 SkPaint textPaint; | 51 SkPaint textPaint; |
| 52 textPaint.setAntiAlias(true); | 52 textPaint.setAntiAlias(true); |
| 53 sk_tool_utils::set_portable_typeface(&textPaint); | 53 sk_tool_utils::set_portable_typeface(&textPaint); |
| 54 textPaint.setTextSize(SkIntToScalar(100)); | 54 textPaint.setTextSize(SkIntToScalar(100)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 70 | 70 |
| 71 typedef GM INHERITED; | 71 typedef GM INHERITED; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 ////////////////////////////////////////////////////////////////////////////// | 74 ////////////////////////////////////////////////////////////////////////////// |
| 75 | 75 |
| 76 static GM* MyFactory1(void*) { return new ImageBlurTiledGM(3.0f, 3.0f); } | 76 static GM* MyFactory1(void*) { return new ImageBlurTiledGM(3.0f, 3.0f); } |
| 77 static GMRegistry reg1(MyFactory1); | 77 static GMRegistry reg1(MyFactory1); |
| 78 | 78 |
| 79 } | 79 } |
| OLD | NEW |