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 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 static SkScalar draw_bm(SkCanvas* canvas, const SkBitmap& bm, | 42 static SkScalar draw_bm(SkCanvas* canvas, const SkBitmap& bm, |
43 SkScalar x, SkScalar y, SkPaint* paint) { | 43 SkScalar x, SkScalar y, SkPaint* paint) { |
44 canvas->drawBitmap(bm, x, y, paint); | 44 canvas->drawBitmap(bm, x, y, paint); |
45 return SkIntToScalar(bm.width()) * 5/4; | 45 return SkIntToScalar(bm.width()) * 5/4; |
46 } | 46 } |
47 | 47 |
48 static SkScalar draw_set(SkCanvas* c, const SkBitmap& bm, SkScalar x, SkPaint* p
) { | 48 static SkScalar draw_set(SkCanvas* c, const SkBitmap& bm, SkScalar x, SkPaint* p
) { |
49 x += draw_bm(c, bm, x, 0, p); | 49 x += draw_bm(c, bm, x, 0, p); |
50 p->setFilterLevel(SkPaint::kLow_FilterLevel); | 50 p->setFilterQuality(kLow_SkFilterQuality); |
51 x += draw_bm(c, bm, x, 0, p); | 51 x += draw_bm(c, bm, x, 0, p); |
52 p->setDither(true); | 52 p->setDither(true); |
53 return x + draw_bm(c, bm, x, 0, p); | 53 return x + draw_bm(c, bm, x, 0, p); |
54 } | 54 } |
55 | 55 |
56 static SkScalar draw_row(SkCanvas* canvas, const SkBitmap& bm) { | 56 static SkScalar draw_row(SkCanvas* canvas, const SkBitmap& bm) { |
57 SkAutoCanvasRestore acr(canvas, true); | 57 SkAutoCanvasRestore acr(canvas, true); |
58 | 58 |
59 SkPaint paint; | 59 SkPaint paint; |
60 SkScalar x = 0; | 60 SkScalar x = 0; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 113 } |
114 | 114 |
115 private: | 115 private: |
116 typedef SampleView INHERITED; | 116 typedef SampleView INHERITED; |
117 }; | 117 }; |
118 | 118 |
119 ////////////////////////////////////////////////////////////////////////////// | 119 ////////////////////////////////////////////////////////////////////////////// |
120 | 120 |
121 static SkView* MyFactory() { return new FilterView; } | 121 static SkView* MyFactory() { return new FilterView; } |
122 static SkViewRegister reg(MyFactory); | 122 static SkViewRegister reg(MyFactory); |
OLD | NEW |