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 26 matching lines...) Expand all Loading... |
37 paint.setDither(true); | 37 paint.setDither(true); |
38 paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos, | 38 paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos, |
39 SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode))->unref(); | 39 SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode))->unref(); |
40 canvas.drawPaint(paint); | 40 canvas.drawPaint(paint); |
41 } | 41 } |
42 | 42 |
43 static void setup(SkPaint* paint, const SkBitmap& bm, bool filter, | 43 static void setup(SkPaint* paint, const SkBitmap& bm, bool filter, |
44 SkShader::TileMode tmx, SkShader::TileMode tmy) { | 44 SkShader::TileMode tmx, SkShader::TileMode tmy) { |
45 SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy); | 45 SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy); |
46 paint->setShader(shader)->unref(); | 46 paint->setShader(shader)->unref(); |
47 paint->setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone_Fi
lterLevel); | 47 paint->setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQualit
y); |
48 } | 48 } |
49 | 49 |
50 static const SkColorType gColorTypes[] = { | 50 static const SkColorType gColorTypes[] = { |
51 kN32_SkColorType, | 51 kN32_SkColorType, |
52 kRGB_565_SkColorType, | 52 kRGB_565_SkColorType, |
53 }; | 53 }; |
54 static const int gWidth = 32; | 54 static const int gWidth = 32; |
55 static const int gHeight = 32; | 55 static const int gHeight = 32; |
56 | 56 |
57 class TilingView : public SampleView { | 57 class TilingView : public SampleView { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 private: | 164 private: |
165 typedef SampleView INHERITED; | 165 typedef SampleView INHERITED; |
166 }; | 166 }; |
167 | 167 |
168 ////////////////////////////////////////////////////////////////////////////// | 168 ////////////////////////////////////////////////////////////////////////////// |
169 | 169 |
170 static SkView* MyFactory() { return new TilingView; } | 170 static SkView* MyFactory() { return new TilingView; } |
171 static SkViewRegister reg(MyFactory); | 171 static SkViewRegister reg(MyFactory); |
OLD | NEW |