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 57 matching lines...) Loading... |
68 p.setColor(0x00AA6633 | alpha << 24); | 68 p.setColor(0x00AA6633 | alpha << 24); |
69 r.set(ww/3, hh/3, ww*19/20, hh*19/20); | 69 r.set(ww/3, hh/3, ww*19/20, hh*19/20); |
70 r.offset(x, y); | 70 r.offset(x, y); |
71 canvas->drawRect(r, p); | 71 canvas->drawRect(r, p); |
72 } | 72 } |
73 | 73 |
74 public: | 74 public: |
75 const static int W = 64; | 75 const static int W = 64; |
76 const static int H = 64; | 76 const static int H = 64; |
77 XfermodesBlurView() { | 77 XfermodesBlurView() { |
78 fBG.installPixels(SkImageInfo::Make(2, 2, kARGB_4444_SkColorType, | 78 fBG.installPixels(SkImageInfo::Make(2, 2, kARGB_4444_SkColorType, kPremu
l_SkAlphaType), |
79 kPremul_SkAlphaType), | 79 gBG, 4); |
80 gBG, 4, NULL, NULL); | |
81 } | 80 } |
82 | 81 |
83 protected: | 82 protected: |
84 // overrides from SkEventSink | 83 // overrides from SkEventSink |
85 virtual bool onQuery(SkEvent* evt) { | 84 virtual bool onQuery(SkEvent* evt) { |
86 if (SampleCode::TitleQ(*evt)) { | 85 if (SampleCode::TitleQ(*evt)) { |
87 SampleCode::TitleR(evt, "XfermodesBlur"); | 86 SampleCode::TitleR(evt, "XfermodesBlur"); |
88 return true; | 87 return true; |
89 } | 88 } |
90 return this->INHERITED::onQuery(evt); | 89 return this->INHERITED::onQuery(evt); |
(...skipping 111 matching lines...) Loading... |
202 } | 201 } |
203 | 202 |
204 private: | 203 private: |
205 typedef SampleView INHERITED; | 204 typedef SampleView INHERITED; |
206 }; | 205 }; |
207 | 206 |
208 ////////////////////////////////////////////////////////////////////////////// | 207 ////////////////////////////////////////////////////////////////////////////// |
209 | 208 |
210 static SkView* MyFactory() { return new XfermodesBlurView; } | 209 static SkView* MyFactory() { return new XfermodesBlurView; } |
211 static SkViewRegister reg(MyFactory); | 210 static SkViewRegister reg(MyFactory); |
OLD | NEW |