OLD | NEW |
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 p.setColor(0x00AA6633 | alpha << 24); | 69 p.setColor(0x00AA6633 | alpha << 24); |
70 r.set(ww/3, hh/3, ww*19/20, hh*19/20); | 70 r.set(ww/3, hh/3, ww*19/20, hh*19/20); |
71 r.offset(x, y); | 71 r.offset(x, y); |
72 canvas->drawRect(r, p); | 72 canvas->drawRect(r, p); |
73 } | 73 } |
74 | 74 |
75 public: | 75 public: |
76 const static int W = 64; | 76 const static int W = 64; |
77 const static int H = 64; | 77 const static int H = 64; |
78 XfermodesBlurView() { | 78 XfermodesBlurView() { |
79 fBG.setConfig(SkBitmap::kARGB_4444_Config, 2, 2, 4, kOpaque_SkAlphaType)
; | 79 fBG.installPixels(SkImageInfo::Make(2, 2, kARGB_4444_SkColorType, |
80 fBG.setPixels(gBG); | 80 kPremul_SkAlphaType), |
| 81 gBG, 4, NULL, NULL); |
81 } | 82 } |
82 | 83 |
83 protected: | 84 protected: |
84 // overrides from SkEventSink | 85 // overrides from SkEventSink |
85 virtual bool onQuery(SkEvent* evt) { | 86 virtual bool onQuery(SkEvent* evt) { |
86 if (SampleCode::TitleQ(*evt)) { | 87 if (SampleCode::TitleQ(*evt)) { |
87 SampleCode::TitleR(evt, "XfermodesBlur"); | 88 SampleCode::TitleR(evt, "XfermodesBlur"); |
88 return true; | 89 return true; |
89 } | 90 } |
90 return this->INHERITED::onQuery(evt); | 91 return this->INHERITED::onQuery(evt); |
(...skipping 111 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 |