OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "Resources.h" | 10 #include "Resources.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 | 106 |
107 void drawSomething(SkCanvas* canvas) { | 107 void drawSomething(SkCanvas* canvas) { |
108 SkPaint paint; | 108 SkPaint paint; |
109 | 109 |
110 canvas->save(); | 110 canvas->save(); |
111 canvas->scale(0.5f, 0.5f); | 111 canvas->scale(0.5f, 0.5f); |
112 canvas->drawBitmap(fBitmap, 0, 0, NULL); | 112 canvas->drawBitmap(fBitmap, 0, 0, NULL); |
113 canvas->restore(); | 113 canvas->restore(); |
114 | 114 |
115 const char beforeStr[] = "before circle"; | |
116 const char afterStr[] = "after circle"; | |
117 | |
118 paint.setAntiAlias(true); | 115 paint.setAntiAlias(true); |
119 | 116 |
120 paint.setColor(SK_ColorRED); | 117 paint.setColor(SK_ColorRED); |
121 canvas->drawData(beforeStr, sizeof(beforeStr)); | |
122 canvas->drawCircle(SkIntToScalar(50), SkIntToScalar(50), | 118 canvas->drawCircle(SkIntToScalar(50), SkIntToScalar(50), |
123 SkIntToScalar(40), paint); | 119 SkIntToScalar(40), paint); |
124 canvas->drawData(afterStr, sizeof(afterStr)); | |
125 paint.setColor(SK_ColorBLACK); | 120 paint.setColor(SK_ColorBLACK); |
126 paint.setTextSize(SkIntToScalar(40)); | 121 paint.setTextSize(SkIntToScalar(40)); |
127 canvas->drawText("Picture", 7, SkIntToScalar(50), SkIntToScalar(62), | 122 canvas->drawText("Picture", 7, SkIntToScalar(50), SkIntToScalar(62), |
128 paint); | 123 paint); |
129 | 124 |
130 } | 125 } |
131 | 126 |
132 virtual void onDrawContent(SkCanvas* canvas) { | 127 virtual void onDrawContent(SkCanvas* canvas) { |
133 this->drawSomething(canvas); | 128 this->drawSomething(canvas); |
134 | 129 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 SkPicture* fPicture; | 187 SkPicture* fPicture; |
193 SkPicture* fSubPicture; | 188 SkPicture* fSubPicture; |
194 | 189 |
195 typedef SampleView INHERITED; | 190 typedef SampleView INHERITED; |
196 }; | 191 }; |
197 | 192 |
198 ////////////////////////////////////////////////////////////////////////////// | 193 ////////////////////////////////////////////////////////////////////////////// |
199 | 194 |
200 static SkView* MyFactory() { return new PictureView; } | 195 static SkView* MyFactory() { return new PictureView; } |
201 static SkViewRegister reg(MyFactory); | 196 static SkViewRegister reg(MyFactory); |
OLD | NEW |