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

Side by Side Diff: samplecode/SampleXfermodesBlur.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/SampleUnpremul.cpp ('k') | src/animator/SkDrawBlur.h » ('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 "SkView.h" 9 #include "SkView.h"
10 #include "SkBlurMask.h"
10 #include "SkCanvas.h" 11 #include "SkCanvas.h"
11 #include "Sk64.h" 12 #include "Sk64.h"
12 #include "SkCornerPathEffect.h" 13 #include "SkCornerPathEffect.h"
13 #include "SkGradientShader.h" 14 #include "SkGradientShader.h"
14 #include "SkGraphics.h" 15 #include "SkGraphics.h"
15 #include "SkImageDecoder.h" 16 #include "SkImageDecoder.h"
16 #include "SkKernel33MaskFilter.h" 17 #include "SkKernel33MaskFilter.h"
17 #include "SkPath.h" 18 #include "SkPath.h"
18 #include "SkRandom.h" 19 #include "SkRandom.h"
19 #include "SkRegion.h" 20 #include "SkRegion.h"
(...skipping 19 matching lines...) Expand all
39 40
40 static uint16_t gBG[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF }; 41 static uint16_t gBG[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF };
41 42
42 class XfermodesBlurView : public SampleView { 43 class XfermodesBlurView : public SampleView {
43 SkBitmap fBG; 44 SkBitmap fBG;
44 SkBitmap fSrcB, fDstB; 45 SkBitmap fSrcB, fDstB;
45 46
46 void draw_mode(SkCanvas* canvas, SkXfermode* mode, int alpha, 47 void draw_mode(SkCanvas* canvas, SkXfermode* mode, int alpha,
47 SkScalar x, SkScalar y) { 48 SkScalar x, SkScalar y) {
48 SkPaint p; 49 SkPaint p;
49 SkMaskFilter* mf = SkBlurMaskFilter::Create(5, SkBlurMaskFilter::kNormal _BlurStyle, 50 SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_Bl urStyle,
50 SkBlurMaskFilter::kNone_Blur Flag); 51 SkBlurMask::ConvertRadiusToSigma(SkIntToS calar(5)),
52 SkBlurMaskFilter::kNone_BlurFlag);
51 p.setMaskFilter(mf)->unref(); 53 p.setMaskFilter(mf)->unref();
52 54
53 SkScalar ww = SkIntToScalar(W); 55 SkScalar ww = SkIntToScalar(W);
54 SkScalar hh = SkIntToScalar(H); 56 SkScalar hh = SkIntToScalar(H);
55 57
56 // draw a circle covering the upper 58 // draw a circle covering the upper
57 // left three quarters of the canvas 59 // left three quarters of the canvas
58 p.setColor(0xFFCC44FF); 60 p.setColor(0xFFCC44FF);
59 SkRect r; 61 SkRect r;
60 r.set(0, 0, ww*3/4, hh*3/4); 62 r.set(0, 0, ww*3/4, hh*3/4);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 204 }
203 205
204 private: 206 private:
205 typedef SampleView INHERITED; 207 typedef SampleView INHERITED;
206 }; 208 };
207 209
208 ////////////////////////////////////////////////////////////////////////////// 210 //////////////////////////////////////////////////////////////////////////////
209 211
210 static SkView* MyFactory() { return new XfermodesBlurView; } 212 static SkView* MyFactory() { return new XfermodesBlurView; }
211 static SkViewRegister reg(MyFactory); 213 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleUnpremul.cpp ('k') | src/animator/SkDrawBlur.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698