Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: src/gpu/gl/GrGLGpu.cpp

Issue 913693002: Clean up clipping code a bit (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix assert Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/core/SkClipStack.cpp ('K') | « src/gpu/effects/GrConfigConversionEffect.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLGpu.cpp
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 6419aa6b522b15e6f8ab31cc9f6ff01ec2fa325d..21d2f6327bc90915ddd036515d04dd92dbf1eee9 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -1327,13 +1327,13 @@ GrIndexBuffer* GrGLGpu::onCreateIndexBuffer(size_t size, bool dynamic) {
void GrGLGpu::flushScissor(const GrScissorState& scissorState,
const GrGLIRect& rtViewport,
GrSurfaceOrigin rtOrigin) {
- if (scissorState.fEnabled) {
+ if (scissorState.enabled()) {
GrGLIRect scissor;
scissor.setRelativeTo(rtViewport,
- scissorState.fRect.fLeft,
- scissorState.fRect.fTop,
- scissorState.fRect.width(),
- scissorState.fRect.height(),
+ scissorState.rect().fLeft,
+ scissorState.rect().fTop,
+ scissorState.rect().width(),
+ scissorState.rect().height(),
rtOrigin);
// if the scissor fully contains the viewport then we fall through and
// disable the scissor test.
@@ -1489,9 +1489,8 @@ void GrGLGpu::onClear(GrRenderTarget* target, const SkIRect* rect, GrColor color
this->flushRenderTarget(glRT, rect);
GrScissorState scissorState;
- scissorState.fEnabled = SkToBool(rect);
- if (scissorState.fEnabled) {
- scissorState.fRect = *rect;
+ if (rect) {
+ scissorState.set(*rect);
}
this->flushScissor(scissorState, glRT->getViewport(), glRT->origin());
@@ -1602,8 +1601,7 @@ void GrGLGpu::onClearStencilClip(GrRenderTarget* target, const SkIRect& rect, bo
this->flushRenderTarget(glRT, &SkIRect::EmptyIRect());
GrScissorState scissorState;
- scissorState.fEnabled = true;
- scissorState.fRect = rect;
+ scissorState.set(rect);
this->flushScissor(scissorState, glRT->getViewport(), glRT->origin());
GL_CALL(StencilMask((uint32_t) clipStencilMask));
@@ -1930,18 +1928,18 @@ void GrGLGpu::onResolveRenderTarget(GrRenderTarget* target) {
fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID;
const GrGLIRect& vp = rt->getViewport();
const SkIRect dirtyRect = rt->getResolveRect();
- GrGLIRect r;
- r.setRelativeTo(vp, dirtyRect.fLeft, dirtyRect.fTop,
- dirtyRect.width(), dirtyRect.height(), target->origin());
if (GrGLCaps::kES_Apple_MSFBOType == this->glCaps().msFBOType()) {
// Apple's extension uses the scissor as the blit bounds.
GrScissorState scissorState;
- scissorState.fEnabled = true;
- scissorState.fRect = dirtyRect;
- this->flushScissor(scissorState, rt->getViewport(), rt->origin());
+ scissorState.set(dirtyRect);
+ this->flushScissor(scissorState, vp, rt->origin());
GL_CALL(ResolveMultisampleFramebuffer());
} else {
+ GrGLIRect r;
+ r.setRelativeTo(vp, dirtyRect.fLeft, dirtyRect.fTop,
+ dirtyRect.width(), dirtyRect.height(), target->origin());
+
int right = r.fLeft + r.fWidth;
int top = r.fBottom + r.fHeight;
« src/core/SkClipStack.cpp ('K') | « src/gpu/effects/GrConfigConversionEffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698