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

Side by Side Diff: gm/image.cpp

Issue 848903004: Require budget decision when creating a RenderTarget SkSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make compatible with chrome Created 5 years, 11 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 | « gm/discard.cpp ('k') | gm/surface.cpp » ('j') | gm/xfermodes3.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 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkSurface.h" 9 #include "SkSurface.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 // since we draw into this directly, we need to start fresh 171 // since we draw into this directly, we need to start fresh
172 sk_bzero(fBuffer, fBufferSize); 172 sk_bzero(fBuffer, fBufferSize);
173 173
174 SkImageInfo info = SkImageInfo::MakeN32Premul(W, H); 174 SkImageInfo info = SkImageInfo::MakeN32Premul(W, H);
175 SkAutoTUnref<SkSurface> surf0(SkSurface::NewRasterDirect(info, fBuffer, RB)); 175 SkAutoTUnref<SkSurface> surf0(SkSurface::NewRasterDirect(info, fBuffer, RB));
176 SkAutoTUnref<SkSurface> surf1(SkSurface::NewRaster(info)); 176 SkAutoTUnref<SkSurface> surf1(SkSurface::NewRaster(info));
177 #if SK_SUPPORT_GPU 177 #if SK_SUPPORT_GPU
178 GrContext* ctx = canvas->getGrContext(); 178 GrContext* ctx = canvas->getGrContext();
179 179
180 SkAutoTUnref<SkSurface> surf4(SkSurface::NewRenderTarget(ctx, info)); 180 SkAutoTUnref<SkSurface> surf4(SkSurface::NewRenderTarget(
181 ctx, SkSurface::kNo_Budgeted, info));
181 #endif 182 #endif
182 183
183 test_surface(canvas, surf0, true); 184 test_surface(canvas, surf0, true);
184 canvas->translate(80, 0); 185 canvas->translate(80, 0);
185 test_surface(canvas, surf1, true); 186 test_surface(canvas, surf1, true);
186 #if SK_SUPPORT_GPU 187 #if SK_SUPPORT_GPU
187 if (ctx) { 188 if (ctx) {
188 canvas->translate(80, 0); 189 canvas->translate(80, 0);
189 test_surface(canvas, surf4, true); 190 test_surface(canvas, surf4, true);
190 } 191 }
191 #endif 192 #endif
192 } 193 }
193 194
194 uint32_t onGetFlags() const SK_OVERRIDE { 195 uint32_t onGetFlags() const SK_OVERRIDE {
195 return GM::kSkipPicture_Flag | GM::kSkipPipe_Flag; 196 return GM::kSkipPicture_Flag | GM::kSkipPipe_Flag;
196 } 197 }
197 198
198 private: 199 private:
199 typedef skiagm::GM INHERITED; 200 typedef skiagm::GM INHERITED;
200 }; 201 };
201 202
202 ////////////////////////////////////////////////////////////////////////////// 203 //////////////////////////////////////////////////////////////////////////////
203 204
204 static skiagm::GM* MyFactory(void*) { return new ImageGM; } 205 static skiagm::GM* MyFactory(void*) { return new ImageGM; }
205 static skiagm::GMRegistry reg(MyFactory); 206 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « gm/discard.cpp ('k') | gm/surface.cpp » ('j') | gm/xfermodes3.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698