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

Side by Side Diff: src/gpu/GrContext.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 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 "GrContext.h" 10 #include "GrContext.h"
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 } 638 }
639 } 639 }
640 return true; 640 return true;
641 } 641 }
642 642
643 643
644 //////////////////////////////////////////////////////////////////////////////// 644 ////////////////////////////////////////////////////////////////////////////////
645 645
646 void GrContext::clear(const SkIRect* rect, 646 void GrContext::clear(const SkIRect* rect,
647 const GrColor color, 647 const GrColor color,
648 bool canIgnoreRect,
648 GrRenderTarget* target) { 649 GrRenderTarget* target) {
649 AutoRestoreEffects are; 650 AutoRestoreEffects are;
650 AutoCheckFlush acf(this); 651 AutoCheckFlush acf(this);
651 this->prepareToDraw(NULL, BUFFERED_DRAW, &are, &acf)->clear(rect, color, tar get); 652 this->prepareToDraw(NULL, BUFFERED_DRAW, &are, &acf)->clear(rect, color,
653 canIgnoreRect, t arget);
652 } 654 }
653 655
654 void GrContext::drawPaint(const GrPaint& origPaint) { 656 void GrContext::drawPaint(const GrPaint& origPaint) {
655 // set rect to be big enough to fill the space, but not super-huge, so we 657 // set rect to be big enough to fill the space, but not super-huge, so we
656 // don't overflow fixed-point implementations 658 // don't overflow fixed-point implementations
657 SkRect r; 659 SkRect r;
658 r.setLTRB(0, 0, 660 r.setLTRB(0, 0,
659 SkIntToScalar(getRenderTarget()->width()), 661 SkIntToScalar(getRenderTarget()->width()),
660 SkIntToScalar(getRenderTarget()->height())); 662 SkIntToScalar(getRenderTarget()->height()));
661 SkMatrix inverse; 663 SkMatrix inverse;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 // Does the rect bound the RT? 828 // Does the rect bound the RT?
827 SkPoint srcSpaceRTQuad[4]; 829 SkPoint srcSpaceRTQuad[4];
828 invM.mapRectToQuad(srcSpaceRTQuad, rtRect); 830 invM.mapRectToQuad(srcSpaceRTQuad, rtRect);
829 if (rect_contains_inclusive(rect, srcSpaceRTQuad[0]) && 831 if (rect_contains_inclusive(rect, srcSpaceRTQuad[0]) &&
830 rect_contains_inclusive(rect, srcSpaceRTQuad[1]) && 832 rect_contains_inclusive(rect, srcSpaceRTQuad[1]) &&
831 rect_contains_inclusive(rect, srcSpaceRTQuad[2]) && 833 rect_contains_inclusive(rect, srcSpaceRTQuad[2]) &&
832 rect_contains_inclusive(rect, srcSpaceRTQuad[3])) { 834 rect_contains_inclusive(rect, srcSpaceRTQuad[3])) {
833 // Will it blend? 835 // Will it blend?
834 GrColor clearColor; 836 GrColor clearColor;
835 if (paint.isOpaqueAndConstantColor(&clearColor)) { 837 if (paint.isOpaqueAndConstantColor(&clearColor)) {
836 target->clear(NULL, clearColor); 838 target->clear(NULL, clearColor, true);
837 return; 839 return;
838 } 840 }
839 } 841 }
840 } 842 }
841 } 843 }
842 844
843 SkRect devBoundRect; 845 SkRect devBoundRect;
844 bool useVertexCoverage; 846 bool useVertexCoverage;
845 bool needAA = paint.isAntiAlias() && 847 bool needAA = paint.isAntiAlias() &&
846 !target->getDrawState().getRenderTarget()->isMultisampled(); 848 !target->getDrawState().getRenderTarget()->isMultisampled();
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 return NULL; 1811 return NULL;
1810 } 1812 }
1811 } 1813 }
1812 1814
1813 /////////////////////////////////////////////////////////////////////////////// 1815 ///////////////////////////////////////////////////////////////////////////////
1814 #if GR_CACHE_STATS 1816 #if GR_CACHE_STATS
1815 void GrContext::printCacheStats() const { 1817 void GrContext::printCacheStats() const {
1816 fTextureCache->printStats(); 1818 fTextureCache->printStats();
1817 } 1819 }
1818 #endif 1820 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrDrawTarget.h » ('j') | src/gpu/GrDrawTarget.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698