diff options
author | 2011-04-27 19:55:29 +0000 | |
---|---|---|
committer | 2011-04-27 19:55:29 +0000 | |
commit | 6aa25c3f555dc2a6711365d14279db3ec909e064 (patch) | |
tree | 812992d91c5188d65e321b95eb3e12f7bdcfdc42 /gpu/src/GrGpuGL.cpp | |
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/src/GrGpuGL.cpp')
-rw-r--r-- | gpu/src/GrGpuGL.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/gpu/src/GrGpuGL.cpp b/gpu/src/GrGpuGL.cpp index 4bdf10e0e8..352ad3f39b 100644 --- a/gpu/src/GrGpuGL.cpp +++ b/gpu/src/GrGpuGL.cpp @@ -1166,15 +1166,25 @@ void GrGpuGL::flushScissor(const GrIRect* rect) { } } -void GrGpuGL::onClear(GrColor color) { +void GrGpuGL::onClear(const GrIRect* rect, GrColor color) { if (NULL == fCurrDrawState.fRenderTarget) { return; } - flushRenderTarget(); - if (fHWBounds.fScissorEnabled) { - GR_GL(Disable(GR_GL_SCISSOR_TEST)); - fHWBounds.fScissorEnabled = false; + GrIRect r; + if (NULL != rect) { + // flushScissor expects rect to be clipped to the target. + r = *rect; + GrIRect rtRect(0, 0, + fCurrDrawState.fRenderTarget->width(), + fCurrDrawState.fRenderTarget->height()); + if (r.intersectWith(rtRect)) { + rect = &r; + } else { + return; + } } + this->flushRenderTarget(); + this->flushScissor(rect); GR_GL(ColorMask(GR_GL_TRUE,GR_GL_TRUE,GR_GL_TRUE,GR_GL_TRUE)); fHWDrawState.fFlagBits &= ~kNoColorWrites_StateBit; GR_GL(ClearColor(GrColorUnpackR(color)/255.f, |