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 "SkBlurMask.h" | 10 #include "SkBlurMask.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 p.setColor(0x00AA6633 | alpha << 24); | 70 p.setColor(0x00AA6633 | alpha << 24); |
71 r.set(ww/3, hh/3, ww*19/20, hh*19/20); | 71 r.set(ww/3, hh/3, ww*19/20, hh*19/20); |
72 r.offset(x, y); | 72 r.offset(x, y); |
73 canvas->drawRect(r, p); | 73 canvas->drawRect(r, p); |
74 } | 74 } |
75 | 75 |
76 public: | 76 public: |
77 const static int W = 64; | 77 const static int W = 64; |
78 const static int H = 64; | 78 const static int H = 64; |
79 XfermodesBlurView() { | 79 XfermodesBlurView() { |
80 fBG.setConfig(SkBitmap::kARGB_4444_Config, 2, 2, 4); | 80 fBG.setConfig(SkBitmap::kARGB_4444_Config, 2, 2, 4, kOpaque_SkAlphaType)
; |
81 fBG.setPixels(gBG); | 81 fBG.setPixels(gBG); |
82 fBG.setIsOpaque(true); | |
83 } | 82 } |
84 | 83 |
85 protected: | 84 protected: |
86 // overrides from SkEventSink | 85 // overrides from SkEventSink |
87 virtual bool onQuery(SkEvent* evt) { | 86 virtual bool onQuery(SkEvent* evt) { |
88 if (SampleCode::TitleQ(*evt)) { | 87 if (SampleCode::TitleQ(*evt)) { |
89 SampleCode::TitleR(evt, "XfermodesBlur"); | 88 SampleCode::TitleR(evt, "XfermodesBlur"); |
90 return true; | 89 return true; |
91 } | 90 } |
92 return this->INHERITED::onQuery(evt); | 91 return this->INHERITED::onQuery(evt); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 203 } |
205 | 204 |
206 private: | 205 private: |
207 typedef SampleView INHERITED; | 206 typedef SampleView INHERITED; |
208 }; | 207 }; |
209 | 208 |
210 ////////////////////////////////////////////////////////////////////////////// | 209 ////////////////////////////////////////////////////////////////////////////// |
211 | 210 |
212 static SkView* MyFactory() { return new XfermodesBlurView; } | 211 static SkView* MyFactory() { return new XfermodesBlurView; } |
213 static SkViewRegister reg(MyFactory); | 212 static SkViewRegister reg(MyFactory); |
OLD | NEW |