Index: src/gpu/gl/GrGLGpu.cpp |
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp |
index 466af6c6ab4bda73273d0361dfe8fc82b376c704..e002d5101bab5a114a75f5ea8d0e219989d0a675 100644 |
--- a/src/gpu/gl/GrGLGpu.cpp |
+++ b/src/gpu/gl/GrGLGpu.cpp |
@@ -564,7 +564,7 @@ void GrGLGpu::onResetContext(uint32_t resetBits) { |
if (resetBits & kView_GrGLBackendState) { |
fHWScissorSettings.invalidate(); |
- fHWWindowRects.invalidate(); |
+ fHWWindowRectsState.invalidate(); |
fHWViewport.invalidate(); |
} |
@@ -1997,39 +1997,42 @@ void GrGLGpu::flushScissor(const GrScissorState& scissorState, |
this->disableScissor(); |
} |
-void GrGLGpu::flushWindowRectangles(const GrWindowRectangles& windows, const GrGLRenderTarget* rt) { |
- typedef GrWindowRectangles::Mode Mode; |
- SkASSERT(windows.count() <= this->caps()->maxWindowRectangles()); |
- SkASSERT(windows.disabled() || rt->renderFBOID()); // Window rectangles can't be used on-screen. |
+void GrGLGpu::flushWindowRectangles(const GrWindowRectsState& windowState, |
+ const GrGLRenderTarget* rt) { |
+ typedef GrWindowRectsState::Mode Mode; |
+ SkASSERT(!windowState.enabled() || rt->renderFBOID()); // Window rects can't be used on-screen. |
+ SkASSERT(windowState.numWindows() <= this->caps()->maxWindowRectangles()); |
if (!this->caps()->maxWindowRectangles() || |
- fHWWindowRects.equal(rt->origin(), rt->getViewport(), windows)) { |
+ fHWWindowRectsState.knownEqualTo(rt->origin(), rt->getViewport(), windowState)) { |
return; |
} |
// This is purely a workaround for a spurious warning generated by gcc. Otherwise the above |
// assert would be sufficient. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=5912 |
- int numWindows = SkTMin(windows.count(), int(GrWindowRectangles::kMaxWindows)); |
- SkASSERT(windows.count() == numWindows); |
+ int numWindows = SkTMin(windowState.numWindows(), int(GrWindowRectangles::kMaxWindows)); |
+ SkASSERT(windowState.numWindows() == numWindows); |
GrGLIRect glwindows[GrWindowRectangles::kMaxWindows]; |
- const SkIRect* skwindows = windows.data(); |
+ const SkIRect* skwindows = windowState.windows().data(); |
+ int dx = -windowState.origin().x(), dy = -windowState.origin().y(); |
for (int i = 0; i < numWindows; ++i) { |
- glwindows[i].setRelativeTo(rt->getViewport(), skwindows[i], rt->origin()); |
+ const SkIRect& skwindow = skwindows[i].makeOffset(dx, dy); |
+ glwindows[i].setRelativeTo(rt->getViewport(), skwindow, rt->origin()); |
} |
- GrGLenum glmode = (Mode::kExclusive == windows.mode()) ? GR_GL_EXCLUSIVE : GR_GL_INCLUSIVE; |
+ GrGLenum glmode = (Mode::kExclusive == windowState.mode()) ? GR_GL_EXCLUSIVE : GR_GL_INCLUSIVE; |
GL_CALL(WindowRectangles(glmode, numWindows, glwindows->asInts())); |
- fHWWindowRects.set(rt->origin(), rt->getViewport(), windows); |
+ fHWWindowRectsState.set(rt->origin(), rt->getViewport(), windowState); |
} |
void GrGLGpu::disableWindowRectangles() { |
- if (!this->caps()->maxWindowRectangles() || fHWWindowRects.disabled()) { |
+ if (!this->caps()->maxWindowRectangles() || fHWWindowRectsState.knownDisabled()) { |
return; |
} |
GL_CALL(WindowRectangles(GR_GL_EXCLUSIVE, 0, nullptr)); |
- fHWWindowRects.setDisabled(); |
+ fHWWindowRectsState.setDisabled(); |
} |
void GrGLGpu::flushMinSampleShading(float minSampleShading) { |
@@ -2079,7 +2082,7 @@ bool GrGLGpu::flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcesso |
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(pipeline.getRenderTarget()); |
this->flushStencil(pipeline.getStencil()); |
this->flushScissor(pipeline.getScissorState(), glRT->getViewport(), glRT->origin()); |
- this->flushWindowRectangles(pipeline.getWindowRectangles(), glRT); |
+ this->flushWindowRectangles(pipeline.getWindowRectsState(), glRT); |
this->flushHWAAState(glRT, pipeline.isHWAntialiasState(), !pipeline.getStencil().isDisabled()); |
// This must come after textures are flushed because a texture may need |
@@ -2207,7 +2210,7 @@ void GrGLGpu::clear(const GrFixedClip& clip, GrColor color, GrRenderTarget* targ |
this->flushRenderTarget(glRT, clip.scissorEnabled() ? &clip.scissorRect() : nullptr); |
this->flushScissor(clip.scissorState(), glRT->getViewport(), glRT->origin()); |
- this->disableWindowRectangles(); |
+ this->flushWindowRectangles(clip.windowRectsState(), glRT); |
GrGLfloat r, g, b, a; |
static const GrGLfloat scale255 = 1.f / 255.f; |
@@ -2271,7 +2274,7 @@ void GrGLGpu::clearStencilClip(const GrFixedClip& clip, |
this->flushRenderTarget(glRT, &SkIRect::EmptyIRect()); |
this->flushScissor(clip.scissorState(), glRT->getViewport(), glRT->origin()); |
- this->disableWindowRectangles(); |
+ this->flushWindowRectangles(clip.windowRectsState(), glRT); |
GL_CALL(StencilMask((uint32_t) clipStencilMask)); |
GL_CALL(ClearStencil(value)); |