| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 15 matching lines...) Expand all Loading... |
| 26 virtual SkString onShortName() { | 26 virtual SkString onShortName() { |
| 27 return fName; | 27 return fName; |
| 28 } | 28 } |
| 29 | 29 |
| 30 virtual SkISize onISize() { | 30 virtual SkISize onISize() { |
| 31 return make_isize(WIDTH, HEIGHT); | 31 return make_isize(WIDTH, HEIGHT); |
| 32 } | 32 } |
| 33 | 33 |
| 34 virtual void onDraw(SkCanvas* canvas) { | 34 virtual void onDraw(SkCanvas* canvas) { |
| 35 SkPaint paint; | 35 SkPaint paint; |
| 36 paint.setImageFilter(new SkBlurImageFilter(fSigmaX, fSigmaY))->unref(); | 36 paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY))->unref
(); |
| 37 canvas->saveLayer(NULL, &paint); | 37 canvas->saveLayer(NULL, &paint); |
| 38 const char* str = "The quick brown fox jumped over the lazy dog."; | 38 const char* str = "The quick brown fox jumped over the lazy dog."; |
| 39 | 39 |
| 40 SkRandom rand; | 40 SkRandom rand; |
| 41 SkPaint textPaint; | 41 SkPaint textPaint; |
| 42 textPaint.setAntiAlias(true); | 42 textPaint.setAntiAlias(true); |
| 43 for (int i = 0; i < 25; ++i) { | 43 for (int i = 0; i < 25; ++i) { |
| 44 int x = rand.nextULessThan(WIDTH); | 44 int x = rand.nextULessThan(WIDTH); |
| 45 int y = rand.nextULessThan(HEIGHT); | 45 int y = rand.nextULessThan(HEIGHT); |
| 46 textPaint.setColor(rand.nextBits(24) | 0xFF000000); | 46 textPaint.setColor(rand.nextBits(24) | 0xFF000000); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 61 | 61 |
| 62 ////////////////////////////////////////////////////////////////////////////// | 62 ////////////////////////////////////////////////////////////////////////////// |
| 63 | 63 |
| 64 static GM* MyFactory1(void*) { return new ImageBlurGM(24.0f, 0.0f, ""); } | 64 static GM* MyFactory1(void*) { return new ImageBlurGM(24.0f, 0.0f, ""); } |
| 65 static GMRegistry reg1(MyFactory1); | 65 static GMRegistry reg1(MyFactory1); |
| 66 | 66 |
| 67 static GM* MyFactory2(void*) { return new ImageBlurGM(80.0f, 80.0f, "_large"); } | 67 static GM* MyFactory2(void*) { return new ImageBlurGM(80.0f, 80.0f, "_large"); } |
| 68 static GMRegistry reg2(MyFactory2); | 68 static GMRegistry reg2(MyFactory2); |
| 69 | 69 |
| 70 } | 70 } |
| OLD | NEW |