OLD | NEW |
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 Loading... |
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 Loading... |
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); |
OLD | NEW |