Add blend optimization helpers and use to convert rect draws to clears.
R=robertphillips@google.com, jvanverth@google.com
Author: bsalomon@google.com
Review URL: https://chromiumcodereview.appspot.com/22558003
git-svn-id: http://skia.googlecode.com/svn/trunk@10723 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h
index 52a5665..eeb63ad 100644
--- a/include/gpu/GrSurface.h
+++ b/include/gpu/GrSurface.h
@@ -11,6 +11,7 @@
#include "GrTypes.h"
#include "GrResource.h"
+#include "SkRect.h"
class GrTexture;
class GrRenderTarget;
@@ -33,6 +34,12 @@
*/
int height() const { return fDesc.fHeight; }
+ /**
+ * Helper that gets the width and height of the surface as a bounding rectangle.
+ */
+ void getBoundsRect(SkRect* rect) const { rect->setWH(SkIntToScalar(this->width()),
+ SkIntToScalar(this->height())); }
+
GrSurfaceOrigin origin() const {
GrAssert(kTopLeft_GrSurfaceOrigin == fDesc.fOrigin || kBottomLeft_GrSurfaceOrigin == fDesc.fOrigin);
return fDesc.fOrigin;