Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(582)

Side by Side Diff: samplecode/SampleUnpremul.cpp

Issue 21835004: Blur refactoring (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: hide constant Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "SkBlurDrawLooper.h" 9 #include "SkBlurDrawLooper.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 SkAutoTUnref<SkShader> shader(createChecker()); 78 SkAutoTUnref<SkShader> shader(createChecker());
79 paint.setShader(shader.get()); 79 paint.setShader(shader.get());
80 canvas->drawPaint(paint); 80 canvas->drawPaint(paint);
81 } 81 }
82 82
83 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 83 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE {
84 SkPaint paint; 84 SkPaint paint;
85 paint.setAntiAlias(true); 85 paint.setAntiAlias(true);
86 paint.setTextSize(SkIntToScalar(24)); 86 paint.setTextSize(SkIntToScalar(24));
87 SkAutoTUnref<SkBlurDrawLooper> looper(SkNEW_ARGS(SkBlurDrawLooper, 87 SkAutoTUnref<SkBlurDrawLooper> looper(SkNEW_ARGS(SkBlurDrawLooper,
88 (SkIntToScalar(2), 0, 0, SK_ColorB LUE))); 88 (SkIntToScalar(2), 0, 0, SK_ColorB LUE,
89 SkBlurDrawLooper::kNone_BlurFlag)) );
89 paint.setLooper(looper); 90 paint.setLooper(looper);
90 SkScalar height = paint.getFontMetrics(NULL); 91 SkScalar height = paint.getFontMetrics(NULL);
91 if (!fDecodeSucceeded) { 92 if (!fDecodeSucceeded) {
92 SkString failure; 93 SkString failure;
93 if (fResPath.size() == 0) { 94 if (fResPath.size() == 0) {
94 failure.printf("resource path is required!"); 95 failure.printf("resource path is required!");
95 } else { 96 } else {
96 failure.printf("Failed to decode %s", fCurrFile.c_str()); 97 failure.printf("Failed to decode %s", fCurrFile.c_str());
97 } 98 }
98 canvas->drawText(failure.c_str(), failure.size(), 0, height, paint); 99 canvas->drawText(failure.c_str(), failure.size(), 0, height, paint);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 196
196 typedef SampleView INHERITED; 197 typedef SampleView INHERITED;
197 }; 198 };
198 199
199 ////////////////////////////////////////////////////////////////////////////// 200 //////////////////////////////////////////////////////////////////////////////
200 201
201 static SkView* MyFactory() { 202 static SkView* MyFactory() {
202 return new UnpremulView(skiagm::GM::GetResourcePath()); 203 return new UnpremulView(skiagm::GM::GetResourcePath());
203 } 204 }
204 static SkViewRegister reg(MyFactory); 205 static SkViewRegister reg(MyFactory);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698