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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 canvas->drawRect(r, paint); | 116 canvas->drawRect(r, paint); |
117 | 117 |
118 r.fTop = SkIntToScalar(80); | 118 r.fTop = SkIntToScalar(80); |
119 r.fBottom = SkIntToScalar(100); | 119 r.fBottom = SkIntToScalar(100); |
120 // SkDebugf("--------- draw bot grad\n"); | 120 // SkDebugf("--------- draw bot grad\n"); |
121 canvas->drawRect(r, paint); | 121 canvas->drawRect(r, paint); |
122 } | 122 } |
123 | 123 |
124 class RedFilter : public SkDrawFilter { | 124 class RedFilter : public SkDrawFilter { |
125 public: | 125 public: |
126 virtual bool filter(SkPaint* p, SkDrawFilter::Type) SK_OVERRIDE { | 126 bool filter(SkPaint* p, SkDrawFilter::Type) SK_OVERRIDE { |
127 fColor = p->getColor(); | 127 fColor = p->getColor(); |
128 if (fColor == SK_ColorRED) { | 128 if (fColor == SK_ColorRED) { |
129 p->setColor(SK_ColorGREEN); | 129 p->setColor(SK_ColorGREEN); |
130 } | 130 } |
131 return true; | 131 return true; |
132 } | 132 } |
133 | 133 |
134 private: | 134 private: |
135 SkColor fColor; | 135 SkColor fColor; |
136 }; | 136 }; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 231 } |
232 | 232 |
233 private: | 233 private: |
234 typedef SkView INHERITED; | 234 typedef SkView INHERITED; |
235 }; | 235 }; |
236 | 236 |
237 ////////////////////////////////////////////////////////////////////////////// | 237 ////////////////////////////////////////////////////////////////////////////// |
238 | 238 |
239 static SkView* MyFactory() { return new LayersView; } | 239 static SkView* MyFactory() { return new LayersView; } |
240 static SkViewRegister reg(MyFactory); | 240 static SkViewRegister reg(MyFactory); |
OLD | NEW |