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

Side by Side Diff: src/gpu/GrGpu.cpp

Issue 1262473004: Make GrGpu read/write pixels take GrSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments Created 5 years, 4 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 | « src/gpu/GrGpu.h ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // If we don't have a fallback to a straight upload then fail. 280 // If we don't have a fallback to a straight upload then fail.
281 if (kRequireDraw_DrawPreference == *drawPreference || 281 if (kRequireDraw_DrawPreference == *drawPreference ||
282 !this->caps()->isConfigTexturable(srcConfig)) { 282 !this->caps()->isConfigTexturable(srcConfig)) {
283 return false; 283 return false;
284 } 284 }
285 *drawPreference = kNoDraw_DrawPreference; 285 *drawPreference = kNoDraw_DrawPreference;
286 } 286 }
287 return true; 287 return true;
288 } 288 }
289 289
290 bool GrGpu::readPixels(GrRenderTarget* target, 290 bool GrGpu::readPixels(GrSurface* surface,
291 int left, int top, int width, int height, 291 int left, int top, int width, int height,
292 GrPixelConfig config, void* buffer, 292 GrPixelConfig config, void* buffer,
293 size_t rowBytes) { 293 size_t rowBytes) {
294 this->handleDirtyContext(); 294 this->handleDirtyContext();
295 return this->onReadPixels(target, left, top, width, height, 295 return this->onReadPixels(surface, left, top, width, height, config, buffer, rowBytes);
296 config, buffer, rowBytes);
297 } 296 }
298 297
299 bool GrGpu::writeTexturePixels(GrTexture* texture, 298 bool GrGpu::writePixels(GrSurface* surface,
300 int left, int top, int width, int height, 299 int left, int top, int width, int height,
301 GrPixelConfig config, const void* buffer, 300 GrPixelConfig config, const void* buffer,
302 size_t rowBytes) { 301 size_t rowBytes) {
303 this->handleDirtyContext(); 302 this->handleDirtyContext();
304 if (this->onWriteTexturePixels(texture, left, top, width, height, 303 if (this->onWritePixels(surface, left, top, width, height, config, buffer, r owBytes)) {
305 config, buffer, rowBytes)) {
306 fStats.incTextureUploads(); 304 fStats.incTextureUploads();
307 return true; 305 return true;
308 } 306 }
309 return false; 307 return false;
310 } 308 }
311 309
312 void GrGpu::resolveRenderTarget(GrRenderTarget* target) { 310 void GrGpu::resolveRenderTarget(GrRenderTarget* target) {
313 SkASSERT(target); 311 SkASSERT(target);
314 this->handleDirtyContext(); 312 this->handleDirtyContext();
315 this->onResolveRenderTarget(target); 313 this->onResolveRenderTarget(target);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 //////////////////////////////////////////////////////////////////////////////// 357 ////////////////////////////////////////////////////////////////////////////////
360 358
361 void GrGpu::draw(const DrawArgs& args, const GrVertices& vertices) { 359 void GrGpu::draw(const DrawArgs& args, const GrVertices& vertices) {
362 this->handleDirtyContext(); 360 this->handleDirtyContext();
363 GrVertices::Iterator iter; 361 GrVertices::Iterator iter;
364 const GrNonInstancedVertices* verts = iter.init(vertices); 362 const GrNonInstancedVertices* verts = iter.init(vertices);
365 do { 363 do {
366 this->onDraw(args, *verts); 364 this->onDraw(args, *verts);
367 } while ((verts = iter.next())); 365 } while ((verts = iter.next()));
368 } 366 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698