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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 paint.setDither(true); | 45 paint.setDither(true); |
46 paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos, | 46 paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos, |
47 SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode, um))->unref()
; | 47 SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode, um))->unref()
; |
48 canvas.drawPaint(paint); | 48 canvas.drawPaint(paint); |
49 } | 49 } |
50 | 50 |
51 static void setup(SkPaint* paint, const SkBitmap& bm, bool filter, | 51 static void setup(SkPaint* paint, const SkBitmap& bm, bool filter, |
52 SkShader::TileMode tmx, SkShader::TileMode tmy) { | 52 SkShader::TileMode tmx, SkShader::TileMode tmy) { |
53 SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy); | 53 SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy); |
54 paint->setShader(shader)->unref(); | 54 paint->setShader(shader)->unref(); |
55 paint->setFilterBitmap(filter); | 55 paint->setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone_Fi
lterLevel); |
56 } | 56 } |
57 | 57 |
58 static const SkBitmap::Config gConfigs[] = { | 58 static const SkBitmap::Config gConfigs[] = { |
59 SkBitmap::kARGB_8888_Config, | 59 SkBitmap::kARGB_8888_Config, |
60 SkBitmap::kRGB_565_Config, | 60 SkBitmap::kRGB_565_Config, |
61 }; | 61 }; |
62 static const int gWidth = 32; | 62 static const int gWidth = 32; |
63 static const int gHeight = 32; | 63 static const int gHeight = 32; |
64 | 64 |
65 class TilingView : public SampleView { | 65 class TilingView : public SampleView { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 165 } |
166 | 166 |
167 private: | 167 private: |
168 typedef SampleView INHERITED; | 168 typedef SampleView INHERITED; |
169 }; | 169 }; |
170 | 170 |
171 ////////////////////////////////////////////////////////////////////////////// | 171 ////////////////////////////////////////////////////////////////////////////// |
172 | 172 |
173 static SkView* MyFactory() { return new TilingView; } | 173 static SkView* MyFactory() { return new TilingView; } |
174 static SkViewRegister reg(MyFactory); | 174 static SkViewRegister reg(MyFactory); |
OLD | NEW |