| 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 13 matching lines...) Expand all Loading... |
| 24 virtual SkString onShortName() { | 24 virtual SkString onShortName() { |
| 25 return SkString("imageblurtiled"); | 25 return SkString("imageblurtiled"); |
| 26 } | 26 } |
| 27 | 27 |
| 28 virtual SkISize onISize() { | 28 virtual SkISize onISize() { |
| 29 return make_isize(WIDTH, HEIGHT); | 29 return make_isize(WIDTH, HEIGHT); |
| 30 } | 30 } |
| 31 | 31 |
| 32 virtual void onDraw(SkCanvas* canvas) { | 32 virtual void onDraw(SkCanvas* canvas) { |
| 33 SkPaint paint; | 33 SkPaint paint; |
| 34 paint.setImageFilter(new SkBlurImageFilter(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 canvas->getClipBounds(&bounds); | 37 canvas->getClipBounds(&bounds); |
| 38 for (SkScalar y = bounds.top(); y < bounds.bottom(); y += tile_size) { | 38 for (SkScalar y = bounds.top(); y < bounds.bottom(); y += tile_size) { |
| 39 for (SkScalar x = bounds.left(); x < bounds.right(); x += tile_size)
{ | 39 for (SkScalar x = bounds.left(); x < bounds.right(); x += tile_size)
{ |
| 40 canvas->save(); | 40 canvas->save(); |
| 41 canvas->clipRect(SkRect::MakeXYWH(x, y, tile_size, tile_size)); | 41 canvas->clipRect(SkRect::MakeXYWH(x, y, tile_size, tile_size)); |
| 42 canvas->saveLayer(NULL, &paint); | 42 canvas->saveLayer(NULL, &paint); |
| 43 const char* str[] = { | 43 const char* str[] = { |
| 44 "The quick", | 44 "The quick", |
| (...skipping 22 matching lines...) Expand all Loading... |
| 67 | 67 |
| 68 typedef GM INHERITED; | 68 typedef GM INHERITED; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 ////////////////////////////////////////////////////////////////////////////// | 71 ////////////////////////////////////////////////////////////////////////////// |
| 72 | 72 |
| 73 static GM* MyFactory1(void*) { return new ImageBlurTiledGM(3.0f, 3.0f); } | 73 static GM* MyFactory1(void*) { return new ImageBlurTiledGM(3.0f, 3.0f); } |
| 74 static GMRegistry reg1(MyFactory1); | 74 static GMRegistry reg1(MyFactory1); |
| 75 | 75 |
| 76 } | 76 } |
| OLD | NEW |