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 "gm.h" | 8 #include "gm.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkShader.h" | 10 #include "SkShader.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 protected: | 38 protected: |
39 SkString onShortName() { | 39 SkString onShortName() { |
40 return SkString("tinybitmap"); | 40 return SkString("tinybitmap"); |
41 } | 41 } |
42 | 42 |
43 virtual SkISize onISize() { return SkISize::Make(100, 100); } | 43 virtual SkISize onISize() { return SkISize::Make(100, 100); } |
44 | 44 |
45 virtual void onDraw(SkCanvas* canvas) { | 45 virtual void onDraw(SkCanvas* canvas) { |
46 SkBitmap bm = make_bitmap(); | 46 SkBitmap bm = make_bitmap(); |
| 47 SkShader* s = |
| 48 SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, |
| 49 SkShader::kMirror_TileMode); |
47 SkPaint paint; | 50 SkPaint paint; |
48 paint.setAlpha(0x80); | 51 paint.setAlpha(0x80); |
49 paint.setShader(SkShader::MakeBitmapShader(bm, SkShader::kRepeat_TileMod
e, | 52 paint.setShader(s)->unref(); |
50 SkShader::kMirror_TileMode)); | |
51 canvas->drawPaint(paint); | 53 canvas->drawPaint(paint); |
52 } | 54 } |
53 | 55 |
54 private: | 56 private: |
55 typedef GM INHERITED; | 57 typedef GM INHERITED; |
56 }; | 58 }; |
57 | 59 |
58 ////////////////////////////////////////////////////////////////////////////// | 60 ////////////////////////////////////////////////////////////////////////////// |
59 | 61 |
60 static GM* MyFactory(void*) { return new TinyBitmapGM; } | 62 static GM* MyFactory(void*) { return new TinyBitmapGM; } |
61 static GMRegistry reg(MyFactory); | 63 static GMRegistry reg(MyFactory); |
62 | 64 |
63 } | 65 } |
OLD | NEW |