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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 const SkScalar scale = 0.897917f; | 75 const SkScalar scale = 0.897917f; |
76 canvas->scale(SK_Scalar1, scale); | 76 canvas->scale(SK_Scalar1, scale); |
77 | 77 |
78 for (int k = 0; k < 2; k++) { | 78 for (int k = 0; k < 2; k++) { |
79 paint.setFilterLevel(k == 1 ? SkPaint::kLow_FilterLevel : SkPaint::k
None_FilterLevel); | 79 paint.setFilterLevel(k == 1 ? SkPaint::kLow_FilterLevel : SkPaint::k
None_FilterLevel); |
80 for (int j = 0; j < 2; j++) { | 80 for (int j = 0; j < 2; j++) { |
81 paint.setDither(j == 1); | 81 paint.setDither(j == 1); |
82 for (int i = 0; i < fBitmapCount; i++) { | 82 for (int i = 0; i < fBitmapCount; i++) { |
83 SkScalar x = (k * fBitmapCount + j) * W; | 83 SkScalar x = (k * fBitmapCount + j) * W; |
84 SkScalar y = i * H; | 84 SkScalar y = i * H; |
85 x = SkIntToScalar(SkScalarRound(x)); | 85 x = SkScalarRoundToScalar(x); |
86 y = SkIntToScalar(SkScalarRound(y)); | 86 y = SkScalarRoundToScalar(y); |
87 canvas->drawBitmap(fBitmaps[i], x, y, &paint); | 87 canvas->drawBitmap(fBitmaps[i], x, y, &paint); |
88 if (i == 0) { | 88 if (i == 0) { |
89 SkPaint p; | 89 SkPaint p; |
90 p.setAntiAlias(true); | 90 p.setAntiAlias(true); |
91 p.setTextAlign(SkPaint::kCenter_Align); | 91 p.setTextAlign(SkPaint::kCenter_Align); |
92 p.setTextSize(SkIntToScalar(18)); | 92 p.setTextSize(SkIntToScalar(18)); |
93 SkString s("dither="); | 93 SkString s("dither="); |
94 s.appendS32(paint.isDither()); | 94 s.appendS32(paint.isDither()); |
95 s.append(" filter="); | 95 s.append(" filter="); |
96 s.appendS32(paint.getFilterLevel() != SkPaint::kNone_Fil
terLevel); | 96 s.appendS32(paint.getFilterLevel() != SkPaint::kNone_Fil
terLevel); |
(...skipping 16 matching lines...) Expand all 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 Filter2View; } | 121 static SkView* MyFactory() { return new Filter2View; } |
122 static SkViewRegister reg(MyFactory); | 122 static SkViewRegister reg(MyFactory); |
OLD | NEW |