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

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
« no previous file with comments | « samplecode/SampleTiling.cpp ('k') | samplecode/SampleXfermodesBlur.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "SkBlurMask.h"
9 #include "SkBlurDrawLooper.h" 10 #include "SkBlurDrawLooper.h"
10 #include "SkCanvas.h" 11 #include "SkCanvas.h"
11 #include "SkColorPriv.h" 12 #include "SkColorPriv.h"
12 #include "SkForceLinking.h" 13 #include "SkForceLinking.h"
13 #include "SkImageDecoder.h" 14 #include "SkImageDecoder.h"
14 #include "SkOSFile.h" 15 #include "SkOSFile.h"
15 #include "SkStream.h" 16 #include "SkStream.h"
16 #include "SkString.h" 17 #include "SkString.h"
17 #include "SkSystemEventTypes.h" 18 #include "SkSystemEventTypes.h"
18 #include "SkTypes.h" 19 #include "SkTypes.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 SkAutoTUnref<SkShader> shader(createChecker()); 79 SkAutoTUnref<SkShader> shader(createChecker());
79 paint.setShader(shader.get()); 80 paint.setShader(shader.get());
80 canvas->drawPaint(paint); 81 canvas->drawPaint(paint);
81 } 82 }
82 83
83 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 84 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE {
84 SkPaint paint; 85 SkPaint paint;
85 paint.setAntiAlias(true); 86 paint.setAntiAlias(true);
86 paint.setTextSize(SkIntToScalar(24)); 87 paint.setTextSize(SkIntToScalar(24));
87 SkAutoTUnref<SkBlurDrawLooper> looper(SkNEW_ARGS(SkBlurDrawLooper, 88 SkAutoTUnref<SkBlurDrawLooper> looper(SkNEW_ARGS(SkBlurDrawLooper,
88 (SkIntToScalar(2), 0, 0, SK_ColorB LUE))); 89 (SK_ColorBLUE,
90 SkBlurMask::ConvertRadiusToSigma( SkIntToScalar(2)),
91 0, 0)));
89 paint.setLooper(looper); 92 paint.setLooper(looper);
90 SkScalar height = paint.getFontMetrics(NULL); 93 SkScalar height = paint.getFontMetrics(NULL);
91 if (!fDecodeSucceeded) { 94 if (!fDecodeSucceeded) {
92 SkString failure; 95 SkString failure;
93 if (fResPath.size() == 0) { 96 if (fResPath.size() == 0) {
94 failure.printf("resource path is required!"); 97 failure.printf("resource path is required!");
95 } else { 98 } else {
96 failure.printf("Failed to decode %s", fCurrFile.c_str()); 99 failure.printf("Failed to decode %s", fCurrFile.c_str());
97 } 100 }
98 canvas->drawText(failure.c_str(), failure.size(), 0, height, paint); 101 canvas->drawText(failure.c_str(), failure.size(), 0, height, paint);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 198
196 typedef SampleView INHERITED; 199 typedef SampleView INHERITED;
197 }; 200 };
198 201
199 ////////////////////////////////////////////////////////////////////////////// 202 //////////////////////////////////////////////////////////////////////////////
200 203
201 static SkView* MyFactory() { 204 static SkView* MyFactory() {
202 return new UnpremulView(skiagm::GM::GetResourcePath()); 205 return new UnpremulView(skiagm::GM::GetResourcePath());
203 } 206 }
204 static SkViewRegister reg(MyFactory); 207 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleTiling.cpp ('k') | samplecode/SampleXfermodesBlur.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698