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

Side by Side Diff: samplecode/SampleXfermodesBlur.cpp

Issue 1852113003: switch maskfilters to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « samplecode/SampleTextureDomain.cpp ('k') | src/animator/SkDrawBlur.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 2011 Google Inc. 2 * Copyright 2011 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 7
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkBlurMask.h" 10 #include "SkBlurMask.h"
(...skipping 24 matching lines...) Expand all
35 35
36 static uint16_t gBG[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF }; 36 static uint16_t gBG[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF };
37 37
38 class XfermodesBlurView : public SampleView { 38 class XfermodesBlurView : public SampleView {
39 SkBitmap fBG; 39 SkBitmap fBG;
40 SkBitmap fSrcB, fDstB; 40 SkBitmap fSrcB, fDstB;
41 41
42 void draw_mode(SkCanvas* canvas, sk_sp<SkXfermode> mode, int alpha, 42 void draw_mode(SkCanvas* canvas, sk_sp<SkXfermode> mode, int alpha,
43 SkScalar x, SkScalar y) { 43 SkScalar x, SkScalar y) {
44 SkPaint p; 44 SkPaint p;
45 SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, 45 p.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
46 SkBlurMask::ConvertRadiusToSigma(SkIntToS calar(5)), 46 SkBlurMask::ConvertRadiusToSigma( 5),
47 SkBlurMaskFilter::kNone_BlurFlag); 47 SkBlurMaskFilter::kNone_BlurFlag) );
48 p.setMaskFilter(mf)->unref();
49 48
50 SkScalar ww = SkIntToScalar(W); 49 SkScalar ww = SkIntToScalar(W);
51 SkScalar hh = SkIntToScalar(H); 50 SkScalar hh = SkIntToScalar(H);
52 51
53 // draw a circle covering the upper 52 // draw a circle covering the upper
54 // left three quarters of the canvas 53 // left three quarters of the canvas
55 p.setColor(0xFFCC44FF); 54 p.setColor(0xFFCC44FF);
56 SkRect r; 55 SkRect r;
57 r.set(0, 0, ww*3/4, hh*3/4); 56 r.set(0, 0, ww*3/4, hh*3/4);
58 r.offset(x, y); 57 r.offset(x, y);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 193 }
195 194
196 private: 195 private:
197 typedef SampleView INHERITED; 196 typedef SampleView INHERITED;
198 }; 197 };
199 198
200 ////////////////////////////////////////////////////////////////////////////// 199 //////////////////////////////////////////////////////////////////////////////
201 200
202 static SkView* MyFactory() { return new XfermodesBlurView; } 201 static SkView* MyFactory() { return new XfermodesBlurView; }
203 static SkViewRegister reg(MyFactory); 202 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleTextureDomain.cpp ('k') | src/animator/SkDrawBlur.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698