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 #include "gm.h" | 7 #include "gm.h" |
8 #include "SkSurface.h" | 8 #include "SkSurface.h" |
9 #include "SkTypeface.h" | 9 #include "SkTypeface.h" |
10 | 10 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 paint.setColor(fg[i]); | 169 paint.setColor(fg[i]); |
170 | 170 |
171 canvas->drawText(text, textLen, x, y, paint); | 171 canvas->drawText(text, textLen, x, y, paint); |
172 y += paint.getFontMetrics(NULL); | 172 y += paint.getFontMetrics(NULL); |
173 } | 173 } |
174 | 174 |
175 #if SK_SUPPORT_GPU | 175 #if SK_SUPPORT_GPU |
176 // render offscreen buffer | 176 // render offscreen buffer |
177 if (surface) { | 177 if (surface) { |
178 SkImage* image = surface->newImageSnapshot(); | 178 SkImage* image = surface->newImageSnapshot(); |
179 image->draw(inputCanvas, 0, 0, NULL); | 179 inputCanvas->drawImage(image, 0, 0, NULL); |
180 image->unref(); | 180 image->unref(); |
181 } | 181 } |
182 #endif | 182 #endif |
183 } | 183 } |
184 | 184 |
185 private: | 185 private: |
186 typedef GM INHERITED; | 186 typedef GM INHERITED; |
187 }; | 187 }; |
188 | 188 |
189 ////////////////////////////////////////////////////////////////////////////// | 189 ////////////////////////////////////////////////////////////////////////////// |
190 | 190 |
191 static GM* MyFactory(void*) { return new DFTextGM; } | 191 static GM* MyFactory(void*) { return new DFTextGM; } |
192 static GMRegistry reg(MyFactory); | 192 static GMRegistry reg(MyFactory); |
193 | 193 |
194 } | 194 } |
OLD | NEW |