diff options
-rw-r--r-- | gpu/include/GrContext.h | 4 | ||||
-rw-r--r-- | gpu/include/GrGpu.h | 10 | ||||
-rw-r--r-- | gpu/src/GrContext.cpp | 7 | ||||
-rw-r--r-- | gpu/src/GrGpu.cpp | 6 | ||||
-rw-r--r-- | gpu/src/GrGpuGL.cpp | 8 | ||||
-rw-r--r-- | gpu/src/GrGpuGL.h | 6 | ||||
-rw-r--r-- | include/core/SkDevice.h | 13 | ||||
-rw-r--r-- | include/gpu/SkGpuDevice.h | 1 | ||||
-rw-r--r-- | src/core/SkDevice.cpp | 4 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 6 |
10 files changed, 39 insertions, 26 deletions
diff --git a/gpu/include/GrContext.h b/gpu/include/GrContext.h index 7b6803c51c..5eda2b7186 100644 --- a/gpu/include/GrContext.h +++ b/gpu/include/GrContext.h @@ -283,9 +283,9 @@ public: // Draws /** - * Erase the entire render target, ignoring any clips + * Clear the entire render target, ignoring any clips */ - void eraseColor(GrColor color); + void clear(GrColor color); /** * Draw everywhere (respecting the clip) with the paint. diff --git a/gpu/include/GrGpu.h b/gpu/include/GrGpu.h index 61dae2cfa6..7dd9959af9 100644 --- a/gpu/include/GrGpu.h +++ b/gpu/include/GrGpu.h @@ -235,11 +235,11 @@ public: GrIndexBuffer* createIndexBuffer(uint32_t size, bool dynamic); /** - * Erase the entire render target, ignoring any clips/scissors. + * Clear the entire render target, ignoring any clips/scissors. * * This is issued to the GPU driver immediately. */ - void eraseColor(GrColor color); + void clear(GrColor color); /** * Are 8 bit paletted textures supported. @@ -498,8 +498,8 @@ protected: virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size, bool dynamic) = 0; - // overridden by API-specific derivated class to perform the erase. - virtual void onEraseColor(GrColor color) = 0; + // overridden by API-specific derivated class to perform the clear. + virtual void onClear(GrColor color) = 0; // overridden by API-specific derived class to perform the draw call. virtual void onDrawIndexed(GrPrimitiveType type, @@ -539,7 +539,7 @@ protected: virtual void flushScissor(const GrIRect* rect) = 0; // GrGpu subclass removes the clip from the stencil buffer - virtual void eraseStencilClip(const GrIRect& rect) = 0; + virtual void clearStencilClip(const GrIRect& rect) = 0; private: GrContext* fContext; // not reffed (context refs gpu) diff --git a/gpu/src/GrContext.cpp b/gpu/src/GrContext.cpp index 8017f73eba..f68564a2ba 100644 --- a/gpu/src/GrContext.cpp +++ b/gpu/src/GrContext.cpp @@ -325,8 +325,11 @@ void GrContext::setClip(const GrIRect& rect) { //////////////////////////////////////////////////////////////////////////////// -void GrContext::eraseColor(GrColor color) { - fGpu->eraseColor(color); +void GrContext::clear(GrColor color) { + // gpu flush call is immediate, must flush. + // (could in theory skip draws to current render target.) + this->flush(); + fGpu->clear(color); } void GrContext::drawPaint(const GrPaint& paint) { diff --git a/gpu/src/GrGpu.cpp b/gpu/src/GrGpu.cpp index 43fe648fbf..c8e2bc77ab 100644 --- a/gpu/src/GrGpu.cpp +++ b/gpu/src/GrGpu.cpp @@ -173,9 +173,9 @@ GrIndexBuffer* GrGpu::createIndexBuffer(uint32_t size, bool dynamic) { return this->onCreateIndexBuffer(size, dynamic); } -void GrGpu::eraseColor(GrColor color) { +void GrGpu::clear(GrColor color) { this->handleDirtyContext(); - this->onEraseColor(color); + this->onClear(color); } void GrGpu::forceRenderTargetFlush() { @@ -423,7 +423,7 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) { AutoInternalDrawGeomRestore aidgr(this); this->setViewMatrix(GrMatrix::I()); - this->eraseStencilClip(clipRect); + this->clearStencilClip(clipRect); this->flushScissor(NULL); #if !VISUALIZE_COMPLEX_CLIP this->enableState(kNoColorWrites_StateBit); diff --git a/gpu/src/GrGpuGL.cpp b/gpu/src/GrGpuGL.cpp index fe461cca3b..64431a35f8 100644 --- a/gpu/src/GrGpuGL.cpp +++ b/gpu/src/GrGpuGL.cpp @@ -1080,7 +1080,7 @@ GrTexture* GrGpuGL::onCreateTexture(const TextureDesc& desc, if (!(desc.fFlags & kNoStencil_TextureFlag)) { GrRenderTarget* rtSave = fCurrDrawState.fRenderTarget; fCurrDrawState.fRenderTarget = rt; - eraseStencil(0, ~0); + this->clearStencil(0, ~0); fCurrDrawState.fRenderTarget = rtSave; } } @@ -1165,7 +1165,7 @@ void GrGpuGL::flushScissor(const GrIRect* rect) { } } -void GrGpuGL::onEraseColor(GrColor color) { +void GrGpuGL::onClear(GrColor color) { if (NULL == fCurrDrawState.fRenderTarget) { return; } @@ -1183,7 +1183,7 @@ void GrGpuGL::onEraseColor(GrColor color) { GR_GL(Clear(GR_GL_COLOR_BUFFER_BIT)); } -void GrGpuGL::eraseStencil(uint32_t value, uint32_t mask) { +void GrGpuGL::clearStencil(uint32_t value, uint32_t mask) { if (NULL == fCurrDrawState.fRenderTarget) { return; } @@ -1198,7 +1198,7 @@ void GrGpuGL::eraseStencil(uint32_t value, uint32_t mask) { fHWDrawState.fStencilSettings.invalidate(); } -void GrGpuGL::eraseStencilClip(const GrIRect& rect) { +void GrGpuGL::clearStencilClip(const GrIRect& rect) { GrAssert(NULL != fCurrDrawState.fRenderTarget); #if 0 GrGLint stencilBitCount = fCurrDrawState.fRenderTarget->stencilBits(); diff --git a/gpu/src/GrGpuGL.h b/gpu/src/GrGpuGL.h index eaeec5eef3..08edb27a7e 100644 --- a/gpu/src/GrGpuGL.h +++ b/gpu/src/GrGpuGL.h @@ -87,7 +87,7 @@ protected: int width, int height); virtual GrRenderTarget* onCreateRenderTargetFrom3DApiState(); - virtual void onEraseColor(GrColor color); + virtual void onClear(GrColor color); virtual void onForceRenderTargetFlush(); @@ -104,8 +104,8 @@ protected: uint32_t vertexCount, uint32_t numVertices); virtual void flushScissor(const GrIRect* rect); - void eraseStencil(uint32_t value, uint32_t mask); - virtual void eraseStencilClip(const GrIRect& rect); + void clearStencil(uint32_t value, uint32_t mask); + virtual void clearStencilClip(const GrIRect& rect); // binds texture unit in GL void setTextureUnit(int unitIdx); diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index 8889fb4b24..5755e955e0 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -115,10 +115,15 @@ public: */ const SkBitmap& accessBitmap(bool changePixels); - /** Helper to erase the entire device to the specified color (including - alpha). - */ - void eraseColor(SkColor eraseColor); + /** Clears the entire device to the specified color (including alpha). + * Ignores the clip. + */ + virtual void clear(SkColor color); + + /** + * Deprecated name for clear. + */ + void eraseColor(SkColor eraseColor) { this->clear(eraseColor); } /** Called when this device is installed into a Canvas. Balanaced by a call to unlockPixels() when the device is removed from a Canvas. diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h index fbe59297e7..ff1bb0d362 100644 --- a/include/gpu/SkGpuDevice.h +++ b/include/gpu/SkGpuDevice.h @@ -75,6 +75,7 @@ public: // overrides from SkDevice + virtual void clear(SkColor color); virtual bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap); virtual void writePixels(const SkBitmap& bitmap, int x, int y); diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp index 69d0c1cc34..6305e190fe 100644 --- a/src/core/SkDevice.cpp +++ b/src/core/SkDevice.cpp @@ -65,8 +65,8 @@ bool SkDevice::intersects(const SkIRect& r, SkIRect* sect) const { return sect ? sect->intersect(r, bounds) : SkIRect::Intersects(r, bounds); } -void SkDevice::eraseColor(SkColor eraseColor) { - fBitmap.eraseColor(eraseColor); +void SkDevice::clear(SkColor color) { + fBitmap.eraseColor(color); } void SkDevice::onAccessBitmap(SkBitmap* bitmap) {} diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 723c635766..f89d4b18a5 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -323,7 +323,7 @@ void SkGpuDevice::gainFocus(SkCanvas* canvas, const SkMatrix& matrix, convert_matrixclip(fContext, matrix, clipStack, clip, this->getOrigin()); if (fNeedClear) { - fContext->eraseColor(0x0); + fContext->clear(0x0); fNeedClear = false; } } @@ -591,6 +591,10 @@ private: /////////////////////////////////////////////////////////////////////////////// +void SkGpuDevice::clear(SkColor color) { + fContext->clear(color); +} + void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { CHECK_SHOULD_DRAW(draw); |