Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: gm/dftext.cpp

Issue 583453002: SkCanvas::drawImage is the new way for drawing an SkImage to a Canvas (Closed) Base URL: https://skia.googlesource.com/skia.git@refactor_skImage
Patch Set: Again Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gm/image.cpp » ('j') | src/core/SkCanvas.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « no previous file | gm/image.cpp » ('j') | src/core/SkCanvas.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698