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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) { | 142 for (size_t i = 0; i < SK_ARRAY_COUNT(fg); ++i) { |
143 paint.setColor(fg[i]); | 143 paint.setColor(fg[i]); |
144 | 144 |
145 canvas->drawText(text, textLen, x, y, paint); | 145 canvas->drawText(text, textLen, x, y, paint); |
146 y += paint.getFontMetrics(NULL); | 146 y += paint.getFontMetrics(NULL); |
147 } | 147 } |
148 | 148 |
149 #if SK_SUPPORT_GPU | 149 #if SK_SUPPORT_GPU |
150 // render offscreen buffer | 150 // render offscreen buffer |
151 SkImage* image = surface->newImageSnapshot(); | 151 SkImage* image = surface->newImageSnapshot(); |
152 image->draw(inputCanvas, 0, 0, NULL); | 152 inputCanvas->drawImage(image, 0, 0, NULL); |
153 image->unref(); | 153 image->unref(); |
154 #endif | 154 #endif |
155 } | 155 } |
156 | 156 |
157 private: | 157 private: |
158 typedef GM INHERITED; | 158 typedef GM INHERITED; |
159 }; | 159 }; |
160 | 160 |
161 ////////////////////////////////////////////////////////////////////////////// | 161 ////////////////////////////////////////////////////////////////////////////// |
162 | 162 |
163 static GM* MyFactory(void*) { return new DFTextGM; } | 163 static GM* MyFactory(void*) { return new DFTextGM; } |
164 static GMRegistry reg(MyFactory); | 164 static GMRegistry reg(MyFactory); |
165 | 165 |
166 } | 166 } |
OLD | NEW |