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

Side by Side Diff: samplecode/SampleUnpremul.cpp

Issue 23701006: Push sigma-based blur interface into our GMs/benches/tests/samplecode (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Cleaned up Created 7 years, 3 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 (SK_ColorBLUE, SkFloatToScalar(1.6 547f), 0, 0)));
89 paint.setLooper(looper); 89 paint.setLooper(looper);
90 SkScalar height = paint.getFontMetrics(NULL); 90 SkScalar height = paint.getFontMetrics(NULL);
91 if (!fDecodeSucceeded) { 91 if (!fDecodeSucceeded) {
92 SkString failure; 92 SkString failure;
93 if (fResPath.size() == 0) { 93 if (fResPath.size() == 0) {
94 failure.printf("resource path is required!"); 94 failure.printf("resource path is required!");
95 } else { 95 } else {
96 failure.printf("Failed to decode %s", fCurrFile.c_str()); 96 failure.printf("Failed to decode %s", fCurrFile.c_str());
97 } 97 }
98 canvas->drawText(failure.c_str(), failure.size(), 0, height, paint); 98 canvas->drawText(failure.c_str(), failure.size(), 0, height, paint);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698