| 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 #include "gm.h" | 7 #include "gm.h" |
| 8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
| 10 #include "SkBlurDrawLooper.h" | 10 #include "SkBlurDrawLooper.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 SkPaint paint; | 78 SkPaint paint; |
| 79 SkAutoTUnref<SkShader> shader(createChecker()); | 79 SkAutoTUnref<SkShader> shader(createChecker()); |
| 80 paint.setShader(shader.get()); | 80 paint.setShader(shader.get()); |
| 81 canvas->drawPaint(paint); | 81 canvas->drawPaint(paint); |
| 82 } | 82 } |
| 83 | 83 |
| 84 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { | 84 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { |
| 85 SkPaint paint; | 85 SkPaint paint; |
| 86 paint.setAntiAlias(true); | 86 paint.setAntiAlias(true); |
| 87 paint.setTextSize(SkIntToScalar(24)); | 87 paint.setTextSize(SkIntToScalar(24)); |
| 88 SkAutoTUnref<SkBlurDrawLooper> looper(SkNEW_ARGS(SkBlurDrawLooper, | 88 SkAutoTUnref<SkBlurDrawLooper> looper( |
| 89 (SK_ColorBLUE, | 89 SkBlurDrawLooper::Create(SK_ColorBLUE, |
| 90 SkBlurMask::ConvertRadiusToSigma(
SkIntToScalar(2)), | 90 SkBlurMask::ConvertRadiusToSigma(SkIntToSca
lar(2)), |
| 91 0, 0))); | 91 0, 0)); |
| 92 paint.setLooper(looper); | 92 paint.setLooper(looper); |
| 93 SkScalar height = paint.getFontMetrics(NULL); | 93 SkScalar height = paint.getFontMetrics(NULL); |
| 94 if (!fDecodeSucceeded) { | 94 if (!fDecodeSucceeded) { |
| 95 SkString failure; | 95 SkString failure; |
| 96 if (fResPath.size() == 0) { | 96 if (fResPath.size() == 0) { |
| 97 failure.printf("resource path is required!"); | 97 failure.printf("resource path is required!"); |
| 98 } else { | 98 } else { |
| 99 failure.printf("Failed to decode %s", fCurrFile.c_str()); | 99 failure.printf("Failed to decode %s", fCurrFile.c_str()); |
| 100 } | 100 } |
| 101 canvas->drawText(failure.c_str(), failure.size(), 0, height, paint); | 101 canvas->drawText(failure.c_str(), failure.size(), 0, height, paint); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 195 |
| 196 typedef SampleView INHERITED; | 196 typedef SampleView INHERITED; |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 ////////////////////////////////////////////////////////////////////////////// | 199 ////////////////////////////////////////////////////////////////////////////// |
| 200 | 200 |
| 201 static SkView* MyFactory() { | 201 static SkView* MyFactory() { |
| 202 return new UnpremulView(skiagm::GM::GetResourcePath()); | 202 return new UnpremulView(skiagm::GM::GetResourcePath()); |
| 203 } | 203 } |
| 204 static SkViewRegister reg(MyFactory); | 204 static SkViewRegister reg(MyFactory); |
| OLD | NEW |