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 "Resources.h" | 8 #include "Resources.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkStream.h" | 10 #include "SkStream.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 paint.setTypeface(fEmojiTypeface); | 194 paint.setTypeface(fEmojiTypeface); |
195 paint.setTextSize(SkIntToScalar(19)); | 195 paint.setTextSize(SkIntToScalar(19)); |
196 canvas->drawText(fEmojiText, strlen(fEmojiText), 670, 90, paint); | 196 canvas->drawText(fEmojiText, strlen(fEmojiText), 670, 90, paint); |
197 } | 197 } |
198 #if SK_SUPPORT_GPU | 198 #if SK_SUPPORT_GPU |
199 // render offscreen buffer | 199 // render offscreen buffer |
200 if (surface) { | 200 if (surface) { |
201 SkAutoCanvasRestore acr(inputCanvas, true); | 201 SkAutoCanvasRestore acr(inputCanvas, true); |
202 // since we prepended this matrix already, we blit using identity | 202 // since we prepended this matrix already, we blit using identity |
203 inputCanvas->resetMatrix(); | 203 inputCanvas->resetMatrix(); |
204 SkImage* image = surface->newImageSnapshot(); | 204 inputCanvas->drawImage(surface->makeImageSnapshot().get(), 0, 0, nul
lptr); |
205 inputCanvas->drawImage(image, 0, 0, nullptr); | |
206 image->unref(); | |
207 } | 205 } |
208 #endif | 206 #endif |
209 } | 207 } |
210 | 208 |
211 private: | 209 private: |
212 SkAutoTUnref<SkTypeface> fEmojiTypeface; | 210 SkAutoTUnref<SkTypeface> fEmojiTypeface; |
213 const char* fEmojiText; | 211 const char* fEmojiText; |
214 | 212 |
215 typedef skiagm::GM INHERITED; | 213 typedef skiagm::GM INHERITED; |
216 }; | 214 }; |
217 | 215 |
218 DEF_GM(return new DFTextGM;) | 216 DEF_GM(return new DFTextGM;) |
OLD | NEW |