OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "gm.h" | 7 #include "gm.h" |
8 #include "SkTypeface.h" | 8 #include "SkTypeface.h" |
9 | 9 |
10 namespace skiagm { | 10 namespace skiagm { |
(...skipping 20 matching lines...) Expand all Loading... |
31 SkScalar degrees, | 31 SkScalar degrees, |
32 SkScalar px, SkScalar py) { | 32 SkScalar px, SkScalar py) { |
33 canvas->translate(px, py); | 33 canvas->translate(px, py); |
34 canvas->rotate(degrees); | 34 canvas->rotate(degrees); |
35 canvas->translate(-px, -py); | 35 canvas->translate(-px, -py); |
36 } | 36 } |
37 | 37 |
38 virtual void onDraw(SkCanvas* originalCanvas) { | 38 virtual void onDraw(SkCanvas* originalCanvas) { |
39 SkISize size = this->getISize(); | 39 SkISize size = this->getISize(); |
40 SkBitmap bitmap; | 40 SkBitmap bitmap; |
41 bitmap.setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height(
)); | 41 bitmap.allocN32Pixels(size.width(), size.height()); |
42 bitmap.allocPixels(); | |
43 SkDeviceProperties properties = SkDeviceProperties::Make( | 42 SkDeviceProperties properties = SkDeviceProperties::Make( |
44 SkDeviceProperties::Geometry::Make(SkDeviceProperties::Geometry::kVe
rtical_Orientation, | 43 SkDeviceProperties::Geometry::Make(SkDeviceProperties::Geometry::kVe
rtical_Orientation, |
45 SkDeviceProperties::Geometry::kBG
R_Layout), | 44 SkDeviceProperties::Geometry::kBG
R_Layout), |
46 SK_Scalar1); | 45 SK_Scalar1); |
47 SkBitmapDevice device(bitmap, properties); | 46 SkBitmapDevice device(bitmap, properties); |
48 SkCanvas canvas(&device); | 47 SkCanvas canvas(&device); |
49 canvas.drawColor(SK_ColorWHITE); | 48 canvas.drawColor(SK_ColorWHITE); |
50 | 49 |
51 SkPaint paint; | 50 SkPaint paint; |
52 | 51 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 private: | 103 private: |
105 typedef GM INHERITED; | 104 typedef GM INHERITED; |
106 }; | 105 }; |
107 | 106 |
108 ////////////////////////////////////////////////////////////////////////////// | 107 ////////////////////////////////////////////////////////////////////////////// |
109 | 108 |
110 static GM* MyFactory(void*) { return new DevicePropertiesGM; } | 109 static GM* MyFactory(void*) { return new DevicePropertiesGM; } |
111 static GMRegistry reg(MyFactory); | 110 static GMRegistry reg(MyFactory); |
112 | 111 |
113 } | 112 } |
OLD | NEW |