aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLGpu.cpp
diff options
context:
space:
mode:
authorGravatar csmartdalton <csmartdalton@google.com>2016-08-31 11:55:52 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-31 11:55:52 -0700
commit29df76096fd30941086324902a82656df2d8becd (patch)
tree37740539e50fcdc09d694bc39e98e55aa26cf3f4 /src/gpu/gl/GrGLGpu.cpp
parentdc43898bbbd06202562514ae785116e0cc40f825 (diff)
Define clear regions in terms of GrFixedClip
Updates clear APIs to take GrFixedClip instead of a rectangle. This will allow us to use window rectangles with clears. Removes stencil knobs from GrFixedClip. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2262473003 Review-Url: https://codereview.chromium.org/2262473003
Diffstat (limited to 'src/gpu/gl/GrGLGpu.cpp')
-rw-r--r--src/gpu/gl/GrGLGpu.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 1370bf992b..a141767e89 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -11,6 +11,7 @@
#include "GrGLGpuCommandBuffer.h"
#include "GrGLStencilAttachment.h"
#include "GrGLTextureRenderTarget.h"
+#include "GrFixedClip.h"
#include "GrGpuResourcePriv.h"
#include "GrMesh.h"
#include "GrPipeline.h"
@@ -2197,17 +2198,15 @@ void GrGLGpu::disableScissor() {
}
}
-void GrGLGpu::clear(const SkIRect& rect, GrColor color, GrRenderTarget* target) {
+void GrGLGpu::clear(const GrFixedClip& clip, GrColor color, GrRenderTarget* target) {
this->handleDirtyContext();
// parent class should never let us get here with no RT
SkASSERT(target);
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target);
- this->flushRenderTarget(glRT, &rect);
- GrScissorState scissorState;
- scissorState.set(rect);
- this->flushScissor(scissorState, glRT->getViewport(), glRT->origin());
+ this->flushRenderTarget(glRT, clip.scissorEnabled() ? &clip.scissorRect() : nullptr);
+ this->flushScissor(clip.scissorState(), glRT->getViewport(), glRT->origin());
this->disableWindowRectangles();
GrGLfloat r, g, b, a;
@@ -2240,7 +2239,9 @@ void GrGLGpu::clearStencil(GrRenderTarget* target) {
fHWStencilSettings.invalidate();
}
-void GrGLGpu::clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTarget* target) {
+void GrGLGpu::clearStencilClip(const GrFixedClip& clip,
+ bool insideStencilMask,
+ GrRenderTarget* target) {
SkASSERT(target);
this->handleDirtyContext();
@@ -2261,7 +2262,7 @@ void GrGLGpu::clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTar
static const GrGLint clipStencilMask = ~0;
#endif
GrGLint value;
- if (insideClip) {
+ if (insideStencilMask) {
value = (1 << (stencilBitCount - 1));
} else {
value = 0;
@@ -2269,9 +2270,7 @@ void GrGLGpu::clearStencilClip(const SkIRect& rect, bool insideClip, GrRenderTar
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(target);
this->flushRenderTarget(glRT, &SkIRect::EmptyIRect());
- GrScissorState scissorState;
- scissorState.set(rect);
- this->flushScissor(scissorState, glRT->getViewport(), glRT->origin());
+ this->flushScissor(clip.scissorState(), glRT->getViewport(), glRT->origin());
this->disableWindowRectangles();
GL_CALL(StencilMask((uint32_t) clipStencilMask));