OLD | NEW |
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 Loading... |
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 bool GrDrawTarget::copySurface(GrSurface* dst, | 409 void 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 } | |
417 #ifdef ENABLE_MDB | 415 #ifdef ENABLE_MDB |
418 this->addDependency(src); | 416 this->addDependency(src); |
419 #endif | 417 #endif |
420 | 418 |
421 this->recordBatch(batch); | 419 this->recordBatch(batch); |
422 batch->unref(); | 420 batch->unref(); |
423 return true; | 421 } |
424 } | 422 } |
425 | 423 |
426 template <class Left, class Right> static bool intersect(const Left& a, const Ri
ght& b) { | 424 template <class Left, class Right> static bool intersect(const Left& a, const Ri
ght& b) { |
427 SkASSERT(a.fLeft <= a.fRight && a.fTop <= a.fBottom && | 425 SkASSERT(a.fLeft <= a.fRight && a.fTop <= a.fBottom && |
428 b.fLeft <= b.fRight && b.fTop <= b.fBottom); | 426 b.fLeft <= b.fRight && b.fTop <= b.fBottom); |
429 return a.fLeft < b.fRight && b.fLeft < a.fRight && a.fTop < b.fBottom && b.f
Top < a.fBottom; | 427 return a.fLeft < b.fRight && b.fLeft < a.fRight && a.fTop < b.fBottom && b.f
Top < a.fBottom; |
430 } | 428 } |
431 | 429 |
432 void GrDrawTarget::recordBatch(GrBatch* batch) { | 430 void GrDrawTarget::recordBatch(GrBatch* batch) { |
433 // A closed drawTarget should never receive new/more batches | 431 // A closed drawTarget should never receive new/more batches |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 } | 530 } |
533 | 531 |
534 return true; | 532 return true; |
535 } | 533 } |
536 | 534 |
537 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { | 535 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend
erTarget* rt) { |
538 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); | 536 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); |
539 this->recordBatch(batch); | 537 this->recordBatch(batch); |
540 batch->unref(); | 538 batch->unref(); |
541 } | 539 } |
OLD | NEW |