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