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

Side by Side Diff: samplecode/SampleXfermodesBlur.cpp

Issue 21835004: Blur refactoring (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Removed unneeded #includes 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/SampleAll.cpp ('k') | src/animator/SkDrawEmboss.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 "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 28 matching lines...) Expand all
39 39
40 static uint16_t gBG[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF }; 40 static uint16_t gBG[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF };
41 41
42 class XfermodesBlurView : public SampleView { 42 class XfermodesBlurView : public SampleView {
43 SkBitmap fBG; 43 SkBitmap fBG;
44 SkBitmap fSrcB, fDstB; 44 SkBitmap fSrcB, fDstB;
45 45
46 void draw_mode(SkCanvas* canvas, SkXfermode* mode, int alpha, 46 void draw_mode(SkCanvas* canvas, SkXfermode* mode, int alpha,
47 SkScalar x, SkScalar y) { 47 SkScalar x, SkScalar y) {
48 SkPaint p; 48 SkPaint p;
49 SkMaskFilter* mf = SkBlurMaskFilter::Create(5, SkBlurMaskFilter::kNormal _BlurStyle, 0); 49 SkMaskFilter* mf = SkBlurMaskFilter::Create(5, SkBlurMaskFilter::kNormal _BlurStyle,
50 SkBlurMaskFilter::kNone_Blur Flag);
50 p.setMaskFilter(mf)->unref(); 51 p.setMaskFilter(mf)->unref();
51 52
52 SkScalar ww = SkIntToScalar(W); 53 SkScalar ww = SkIntToScalar(W);
53 SkScalar hh = SkIntToScalar(H); 54 SkScalar hh = SkIntToScalar(H);
54 55
55 // draw a circle covering the upper 56 // draw a circle covering the upper
56 // left three quarters of the canvas 57 // left three quarters of the canvas
57 p.setColor(0xFFCC44FF); 58 p.setColor(0xFFCC44FF);
58 SkRect r; 59 SkRect r;
59 r.set(0, 0, ww*3/4, hh*3/4); 60 r.set(0, 0, ww*3/4, hh*3/4);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 202 }
202 203
203 private: 204 private:
204 typedef SampleView INHERITED; 205 typedef SampleView INHERITED;
205 }; 206 };
206 207
207 ////////////////////////////////////////////////////////////////////////////// 208 //////////////////////////////////////////////////////////////////////////////
208 209
209 static SkView* MyFactory() { return new XfermodesBlurView; } 210 static SkView* MyFactory() { return new XfermodesBlurView; }
210 static SkViewRegister reg(MyFactory); 211 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleAll.cpp ('k') | src/animator/SkDrawEmboss.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698