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

Side by Side Diff: samplecode/SampleEffects.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/SampleBlur.cpp ('k') | samplecode/SampleEmboss.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h"
9 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkColorMatrixFilter.h"
13 #include "SkDiscretePathEffect.h"
14 #include "SkGradientShader.h"
10 #include "SkPaint.h" 15 #include "SkPaint.h"
11 #include "SkView.h" 16 #include "SkView.h"
12 17
13 #include "SkBlurMaskFilter.h"
14 #include "SkColorMatrixFilter.h"
15 #include "SkDiscretePathEffect.h"
16 #include "SkGradientShader.h"
17 18
18 //#define COLOR 0xFFFF8844 19 //#define COLOR 0xFFFF8844
19 #define COLOR 0xFF888888 20 #define COLOR 0xFF888888
20 21
21 static void paint_proc0(SkPaint*) { 22 static void paint_proc0(SkPaint*) {
22 } 23 }
23 24
24 static void paint_proc1(SkPaint* paint) { 25 static void paint_proc1(SkPaint* paint) {
25 paint->setMaskFilter(SkBlurMaskFilter::Create(2, 26 paint->setMaskFilter(SkBlurMaskFilter::Create(
26 SkBlurMaskFilter::kNormal_BlurStyle))->unref(); 27 SkBlurMaskFilter::kNormal_BlurStyle,
28 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(2 ))))->unref();
27 } 29 }
28 30
29 static void paint_proc2(SkPaint* paint) { 31 static void paint_proc2(SkPaint* paint) {
30 SkScalar dir[3] = { 1, 1, 1}; 32 SkScalar dir[3] = { 1, 1, 1};
31 paint->setMaskFilter( 33 paint->setMaskFilter(
32 SkBlurMaskFilter::CreateEmboss(dir, 0.1f, 0.05f, 1))->unref (); 34 SkBlurMaskFilter::CreateEmboss(SkBlurMask::ConvertRadiusToSigma(SkIn tToScalar(1)),
35 dir,
36 SkFloatToScalar(0.1f),
37 SkFloatToScalar(0.05f)))->unref();
33 } 38 }
34 39
35 static void paint_proc3(SkPaint* paint) { 40 static void paint_proc3(SkPaint* paint) {
36 SkColor colors[] = { SK_ColorRED, COLOR, SK_ColorBLUE }; 41 SkColor colors[] = { SK_ColorRED, COLOR, SK_ColorBLUE };
37 SkPoint pts[] = { { 3, 0 }, { 7, 5 } }; 42 SkPoint pts[] = { { 3, 0 }, { 7, 5 } };
38 paint->setShader(SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_ COUNT(colors), 43 paint->setShader(SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_ COUNT(colors),
39 SkShader::kMirror_TileMode))->unref(); 44 SkShader::kMirror_TileMode))->unref();
40 } 45 }
41 46
42 static void paint_proc5(SkPaint* paint) { 47 static void paint_proc5(SkPaint* paint) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 114 }
110 115
111 private: 116 private:
112 typedef SampleView INHERITED; 117 typedef SampleView INHERITED;
113 }; 118 };
114 119
115 /////////////////////////////////////////////////////////////////////////////// 120 ///////////////////////////////////////////////////////////////////////////////
116 121
117 static SkView* MyFactory() { return new EffectsView; } 122 static SkView* MyFactory() { return new EffectsView; }
118 static SkViewRegister reg(MyFactory); 123 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleBlur.cpp ('k') | samplecode/SampleEmboss.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698