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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 SkBitmap bitmap; | 127 SkBitmap bitmap; |
128 make_bitmap(&bitmap); | 128 make_bitmap(&bitmap); |
129 | 129 |
130 canvas->translate(20, 20); | 130 canvas->translate(20, 20); |
131 | 131 |
132 canvas->drawBitmap(bitmap, 0, 0, &paint); | 132 canvas->drawBitmap(bitmap, 0, 0, &paint); |
133 canvas->drawRect(srcR, paint); | 133 canvas->drawRect(srcR, paint); |
134 | 134 |
135 for (int i = 0; i < 2; ++i) { | 135 for (int i = 0; i < 2; ++i) { |
136 paint.setFilterBitmap(1 == i); | 136 paint.setFilterLevel(1 == i ? SkPaint::kLow_FilterLevel : SkPaint::k
None_FilterLevel); |
137 canvas->drawBitmapRectToRect(bitmap, &srcR, fDstR[i], &paint); | 137 canvas->drawBitmapRectToRect(bitmap, &srcR, fDstR[i], &paint); |
138 canvas->drawRect(fDstR[i], paint); | 138 canvas->drawRect(fDstR[i], paint); |
139 } | 139 } |
140 | 140 |
141 this->bounce(); | 141 this->bounce(); |
142 this->inval(NULL); | 142 this->inval(NULL); |
143 } | 143 } |
144 | 144 |
145 private: | 145 private: |
146 typedef SkView INHERITED; | 146 typedef SkView INHERITED; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 219 } |
220 return this->INHERITED::onQuery(evt); | 220 return this->INHERITED::onQuery(evt); |
221 } | 221 } |
222 | 222 |
223 virtual void onDrawContent(SkCanvas* canvas) { | 223 virtual void onDrawContent(SkCanvas* canvas) { |
224 SkPaint paint; | 224 SkPaint paint; |
225 paint.setStyle(SkPaint::kStroke_Style); | 225 paint.setStyle(SkPaint::kStroke_Style); |
226 paint.setColor(SK_ColorYELLOW); | 226 paint.setColor(SK_ColorYELLOW); |
227 | 227 |
228 for (int i = 0; i < 2; ++i) { | 228 for (int i = 0; i < 2; ++i) { |
229 paint.setFilterBitmap(1 == i); | 229 paint.setFilterLevel(1 == i ? SkPaint::kLow_FilterLevel : SkPaint::k
None_FilterLevel); |
230 canvas->drawBitmapRectToRect(fBitmap, &fSrcR, fDstR[i], &paint); | 230 canvas->drawBitmapRectToRect(fBitmap, &fSrcR, fDstR[i], &paint); |
231 canvas->drawRect(fDstR[i], paint); | 231 canvas->drawRect(fDstR[i], paint); |
232 } | 232 } |
233 | 233 |
234 this->bounceMe(); | 234 this->bounceMe(); |
235 this->inval(NULL); | 235 this->inval(NULL); |
236 } | 236 } |
237 | 237 |
238 private: | 238 private: |
239 typedef SkView INHERITED; | 239 typedef SkView INHERITED; |
240 }; | 240 }; |
241 | 241 |
242 ////////////////////////////////////////////////////////////////////////////// | 242 ////////////////////////////////////////////////////////////////////////////// |
243 | 243 |
244 static SkView* F0() { return new BitmapRectView; } | 244 static SkView* F0() { return new BitmapRectView; } |
245 static SkView* F1() { return new BitmapRectView2; } | 245 static SkView* F1() { return new BitmapRectView2; } |
246 static SkViewRegister gR0(F0); | 246 static SkViewRegister gR0(F0); |
247 static SkViewRegister gR1(F1); | 247 static SkViewRegister gR1(F1); |
OLD | NEW |