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

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

Issue 53823003: Add can-ignore-rect hint to clear call (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: cleaned up Created 7 years, 1 month 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 | Annotate | Revision Log
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 "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "effects/GrTextureDomainEffect.h" 10 #include "effects/GrTextureDomainEffect.h"
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 if (NULL == fRenderTarget) { 541 if (NULL == fRenderTarget) {
542 return SkBitmap::kNo_Config; 542 return SkBitmap::kNo_Config;
543 } 543 }
544 544
545 bool isOpaque; 545 bool isOpaque;
546 return grConfig2skConfig(fRenderTarget->config(), &isOpaque); 546 return grConfig2skConfig(fRenderTarget->config(), &isOpaque);
547 } 547 }
548 548
549 void SkGpuDevice::clear(SkColor color) { 549 void SkGpuDevice::clear(SkColor color) {
550 SkIRect rect = SkIRect::MakeWH(this->width(), this->height()); 550 SkIRect rect = SkIRect::MakeWH(this->width(), this->height());
551 fContext->clear(&rect, SkColor2GrColor(color), fRenderTarget); 551 fContext->clear(&rect, SkColor2GrColor(color), true, fRenderTarget);
552 fNeedClear = false; 552 fNeedClear = false;
553 } 553 }
554 554
555 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { 555 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
556 CHECK_SHOULD_DRAW(draw, false); 556 CHECK_SHOULD_DRAW(draw, false);
557 557
558 GrPaint grPaint; 558 GrPaint grPaint;
559 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { 559 if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) {
560 return; 560 return;
561 } 561 }
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 if (NULL == mask->texture()) { 815 if (NULL == mask->texture()) {
816 return false; 816 return false;
817 } 817 }
818 818
819 GrTexture* maskTexture = mask->texture(); 819 GrTexture* maskTexture = mask->texture();
820 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); 820 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height());
821 821
822 GrContext::AutoRenderTarget art(context, maskTexture->asRenderTarget()); 822 GrContext::AutoRenderTarget art(context, maskTexture->asRenderTarget());
823 GrContext::AutoClip ac(context, clipRect); 823 GrContext::AutoClip ac(context, clipRect);
824 824
825 context->clear(NULL, 0x0); 825 context->clear(NULL, 0x0, true);
826 826
827 GrPaint tempPaint; 827 GrPaint tempPaint;
828 if (doAA) { 828 if (doAA) {
829 tempPaint.setAntiAlias(true); 829 tempPaint.setAntiAlias(true);
830 // AA uses the "coverage" stages on GrDrawTarget. Coverage with a dst 830 // AA uses the "coverage" stages on GrDrawTarget. Coverage with a dst
831 // blend coeff of zero requires dual source blending support in order 831 // blend coeff of zero requires dual source blending support in order
832 // to properly blend partially covered pixels. This means the AA 832 // to properly blend partially covered pixels. This means the AA
833 // code path may not be taken. So we use a dst blend coeff of ISA. We 833 // code path may not be taken. So we use a dst blend coeff of ISA. We
834 // could special case AA draws to a dst surface with known alpha=0 to 834 // could special case AA draws to a dst surface with known alpha=0 to
835 // use a zero dst coeff when dual source blending isn't available. 835 // use a zero dst coeff when dual source blending isn't available.
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 GrTexture* texture, 1851 GrTexture* texture,
1852 bool needClear) 1852 bool needClear)
1853 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { 1853 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
1854 1854
1855 SkASSERT(texture && texture->asRenderTarget()); 1855 SkASSERT(texture && texture->asRenderTarget());
1856 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture 1856 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture
1857 // cache. We pass true for the third argument so that it will get unlocked. 1857 // cache. We pass true for the third argument so that it will get unlocked.
1858 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1858 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1859 fNeedClear = needClear; 1859 fNeedClear = needClear;
1860 } 1860 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698