diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-04-27 19:55:29 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-04-27 19:55:29 +0000 |
commit | 6aa25c3f555dc2a6711365d14279db3ec909e064 (patch) | |
tree | 812992d91c5188d65e321b95eb3e12f7bdcfdc42 /gpu/include | |
parent | c4654ba2e80b200d693894477d07460c45aaa307 (diff) |
Make Gr clear take a rect for a partial-clear
Review URL: http://codereview.appspot.com/4442093/
git-svn-id: http://skia.googlecode.com/svn/trunk@1203 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gpu/include')
-rw-r--r-- | gpu/include/GrContext.h | 6 | ||||
-rw-r--r-- | gpu/include/GrDrawTarget.h | 7 | ||||
-rw-r--r-- | gpu/include/GrGpu.h | 7 | ||||
-rw-r--r-- | gpu/include/GrInOrderDrawBuffer.h | 3 | ||||
-rw-r--r-- | gpu/include/GrRect.h | 7 |
5 files changed, 19 insertions, 11 deletions
diff --git a/gpu/include/GrContext.h b/gpu/include/GrContext.h index 3112112ff8..214fc0543f 100644 --- a/gpu/include/GrContext.h +++ b/gpu/include/GrContext.h @@ -282,9 +282,11 @@ public: // Draws /** - * Clear the entire render target, ignoring any clips + * Clear the entire or rect of the render target, ignoring any clips. + * @param rect the rect to clear or the whole thing if rect is NULL. + * @param color the color to clear to. */ - void clear(GrColor color); + void clear(const GrIRect* rect, GrColor color); /** * Draw everywhere (respecting the clip) with the paint. diff --git a/gpu/include/GrDrawTarget.h b/gpu/include/GrDrawTarget.h index cb36d3c91a..c971e717b7 100644 --- a/gpu/include/GrDrawTarget.h +++ b/gpu/include/GrDrawTarget.h @@ -731,10 +731,11 @@ public: } /** - * Clear the entire render target. Ignores the clip an all other draw state - * (blend mode, stages, etc). + * Clear the render target. Ignores the clip and all other draw state + * (blend mode, stages, etc). Clears the whole thing if rect is NULL, + * otherwise just the rect. */ - virtual void clear(GrColor color) = 0; + virtual void clear(const GrIRect* rect, GrColor color) = 0; /////////////////////////////////////////////////////////////////////////// diff --git a/gpu/include/GrGpu.h b/gpu/include/GrGpu.h index 19f3746616..590712bd48 100644 --- a/gpu/include/GrGpu.h +++ b/gpu/include/GrGpu.h @@ -263,7 +263,7 @@ public: virtual void drawNonIndexed(GrPrimitiveType type, int startVertex, int vertexCount); - virtual void clear(GrColor color); + virtual void clear(const GrIRect* rect, GrColor color); /** * Installs a path renderer that will be used to draw paths that are @@ -444,8 +444,9 @@ protected: virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size, bool dynamic) = 0; - // overridden by API-specific derivated class to perform the clear. - virtual void onClear(GrColor color) = 0; + // overridden by API-specific derivated class to perform the clear and + // clearRect. NULL rect means clear whole target. + virtual void onClear(const GrIRect* rect, GrColor color) = 0; // overridden by API-specific derived class to perform the draw call. virtual void onDrawIndexed(GrPrimitiveType type, diff --git a/gpu/include/GrInOrderDrawBuffer.h b/gpu/include/GrInOrderDrawBuffer.h index 03a2f2d1ee..b26cd7294e 100644 --- a/gpu/include/GrInOrderDrawBuffer.h +++ b/gpu/include/GrInOrderDrawBuffer.h @@ -100,7 +100,7 @@ public: int* vertexCount, int* indexCount) const; - virtual void clear(GrColor color); + virtual void clear(const GrIRect* rect, GrColor color); private: @@ -119,6 +119,7 @@ private: struct Clear { int fBeforeDrawIdx; + GrIRect fRect; GrColor fColor; }; diff --git a/gpu/include/GrRect.h b/gpu/include/GrRect.h index a9ff6ec14d..b85574ab14 100644 --- a/gpu/include/GrRect.h +++ b/gpu/include/GrRect.h @@ -76,19 +76,22 @@ struct GrIRect { /** * Sets this rect to the intersection with a clip rect. If there is no - * intersection then this rect will be made empty. + * intersection then this rect will be made empty and the function will + * return false. */ - void intersectWith(const GrIRect& clipRect) { + bool intersectWith(const GrIRect& clipRect) { if (fRight < clipRect.fLeft || fLeft > clipRect.fRight || fBottom < clipRect.fTop || fTop > clipRect.fBottom) { this->setEmpty(); + return false; } else { fLeft = GrMax(fLeft, clipRect.fLeft); fRight = GrMin(fRight, clipRect.fRight); fTop = GrMax(fTop, clipRect.fTop); fBottom = GrMin(fBottom, clipRect.fBottom); + return true; } } |