OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 | 9 |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 uint32_t* pixels = reinterpret_cast<uint32_t*>(bmp.getPixels()); | 48 uint32_t* pixels = reinterpret_cast<uint32_t*>(bmp.getPixels()); |
49 pixels[0] = SkPackARGB32(0xFF, 0xFF, 0x00, 0x00); | 49 pixels[0] = SkPackARGB32(0xFF, 0xFF, 0x00, 0x00); |
50 pixels[1] = SkPackARGB32(0xFF, 0x00, 0xFF, 0x00); | 50 pixels[1] = SkPackARGB32(0xFF, 0x00, 0xFF, 0x00); |
51 pixels[2] = SkPackARGB32(0x80, 0x00, 0x00, 0x00); | 51 pixels[2] = SkPackARGB32(0x80, 0x00, 0x00, 0x00); |
52 pixels[3] = SkPackARGB32(0xFF, 0x00, 0x00, 0xFF); | 52 pixels[3] = SkPackARGB32(0xFF, 0x00, 0x00, 0xFF); |
53 pt.set(30 * SK_Scalar1, 30 * SK_Scalar1); | 53 pt.set(30 * SK_Scalar1, 30 * SK_Scalar1); |
54 m.mapPoints(&pt, 1); | 54 m.mapPoints(&pt, 1); |
55 SkMatrix s; | 55 SkMatrix s; |
56 s.reset(); | 56 s.reset(); |
57 s.setScale(SK_Scalar1 / 1000, SK_Scalar1 / 1000); | 57 s.setScale(SK_Scalar1 / 1000, SK_Scalar1 / 1000); |
58 SkShader* shader = SkShader::CreateBitmapShader( | 58 paint.setShader(SkShader::MakeBitmapShader(bmp, SkShader::kRepeat_TileMo
de, |
59 bmp, | 59 SkShader::kRepeat_TileMode, &
s)); |
60 SkShader::kRepeat_TileMode, | |
61 SkShader::kRepeat_TileMode, | |
62 &s); | |
63 paint.setShader(shader)->unref(); | |
64 paint.setAntiAlias(false); | 60 paint.setAntiAlias(false); |
65 paint.setFilterQuality(kLow_SkFilterQuality); | 61 paint.setFilterQuality(kLow_SkFilterQuality); |
66 rect.setLTRB(pt.fX - small, pt.fY - small, | 62 rect.setLTRB(pt.fX - small, pt.fY - small, |
67 pt.fX + small, pt.fY + small); | 63 pt.fX + small, pt.fY + small); |
68 canvas->drawRect(rect, paint); | 64 canvas->drawRect(rect, paint); |
69 } | 65 } |
OLD | NEW |