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

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

Issue 1684313002: Make copySurface work for texture dsts, return a bool, & add unit test. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: try again Created 4 years, 10 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/GrDrawTarget.h ('k') | src/gpu/SkGrPixelRef.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 #include "GrDrawTarget.h" 9 #include "GrDrawTarget.h"
10 10
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 void GrDrawTarget::discard(GrRenderTarget* renderTarget) { 399 void GrDrawTarget::discard(GrRenderTarget* renderTarget) {
400 if (this->caps()->discardRenderTargetSupport()) { 400 if (this->caps()->discardRenderTargetSupport()) {
401 GrBatch* batch = new GrDiscardBatch(renderTarget); 401 GrBatch* batch = new GrDiscardBatch(renderTarget);
402 this->recordBatch(batch); 402 this->recordBatch(batch);
403 batch->unref(); 403 batch->unref();
404 } 404 }
405 } 405 }
406 406
407 //////////////////////////////////////////////////////////////////////////////// 407 ////////////////////////////////////////////////////////////////////////////////
408 408
409 void GrDrawTarget::copySurface(GrSurface* dst, 409 bool GrDrawTarget::copySurface(GrSurface* dst,
410 GrSurface* src, 410 GrSurface* src,
411 const SkIRect& srcRect, 411 const SkIRect& srcRect,
412 const SkIPoint& dstPoint) { 412 const SkIPoint& dstPoint) {
413 GrBatch* batch = GrCopySurfaceBatch::Create(dst, src, srcRect, dstPoint); 413 GrBatch* batch = GrCopySurfaceBatch::Create(dst, src, srcRect, dstPoint);
414 if (batch) { 414 if (!batch) {
415 return false;
416 }
415 #ifdef ENABLE_MDB 417 #ifdef ENABLE_MDB
416 this->addDependency(src); 418 this->addDependency(src);
417 #endif 419 #endif
418 420
419 this->recordBatch(batch); 421 this->recordBatch(batch);
420 batch->unref(); 422 batch->unref();
421 } 423 return true;
422 } 424 }
423 425
424 template <class Left, class Right> static bool intersect(const Left& a, const Ri ght& b) { 426 template <class Left, class Right> static bool intersect(const Left& a, const Ri ght& b) {
425 SkASSERT(a.fLeft <= a.fRight && a.fTop <= a.fBottom && 427 SkASSERT(a.fLeft <= a.fRight && a.fTop <= a.fBottom &&
426 b.fLeft <= b.fRight && b.fTop <= b.fBottom); 428 b.fLeft <= b.fRight && b.fTop <= b.fBottom);
427 return a.fLeft < b.fRight && b.fLeft < a.fRight && a.fTop < b.fBottom && b.f Top < a.fBottom; 429 return a.fLeft < b.fRight && b.fLeft < a.fRight && a.fTop < b.fBottom && b.f Top < a.fBottom;
428 } 430 }
429 431
430 void GrDrawTarget::recordBatch(GrBatch* batch) { 432 void GrDrawTarget::recordBatch(GrBatch* batch) {
431 // A closed drawTarget should never receive new/more batches 433 // A closed drawTarget should never receive new/more batches
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 532 }
531 533
532 return true; 534 return true;
533 } 535 }
534 536
535 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) { 537 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) {
536 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); 538 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt);
537 this->recordBatch(batch); 539 this->recordBatch(batch);
538 batch->unref(); 540 batch->unref();
539 } 541 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/SkGrPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698