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 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
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, 49 SkMaskFilter* mf = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_Bl urStyle,
50 SkFloatToScalar(3.38675f),
50 SkBlurMaskFilter::kNone_Blur Flag); 51 SkBlurMaskFilter::kNone_Blur Flag);
51 p.setMaskFilter(mf)->unref(); 52 p.setMaskFilter(mf)->unref();
52 53
53 SkScalar ww = SkIntToScalar(W); 54 SkScalar ww = SkIntToScalar(W);
54 SkScalar hh = SkIntToScalar(H); 55 SkScalar hh = SkIntToScalar(H);
55 56
56 // draw a circle covering the upper 57 // draw a circle covering the upper
57 // left three quarters of the canvas 58 // left three quarters of the canvas
58 p.setColor(0xFFCC44FF); 59 p.setColor(0xFFCC44FF);
59 SkRect r; 60 SkRect r;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 203 }
203 204
204 private: 205 private:
205 typedef SampleView INHERITED; 206 typedef SampleView INHERITED;
206 }; 207 };
207 208
208 ////////////////////////////////////////////////////////////////////////////// 209 //////////////////////////////////////////////////////////////////////////////
209 210
210 static SkView* MyFactory() { return new XfermodesBlurView; } 211 static SkView* MyFactory() { return new XfermodesBlurView; }
211 static SkViewRegister reg(MyFactory); 212 static SkViewRegister reg(MyFactory);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698