Index: src/gpu/gl/GrGLGpu.cpp |
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp |
index 3e44138328d884a36bfbad1e1820f3e0d6fa8aa4..83d2df29bfdb81a4c21540604a4c4d9dc1e55c58 100644 |
--- a/src/gpu/gl/GrGLGpu.cpp |
+++ b/src/gpu/gl/GrGLGpu.cpp |
@@ -2004,17 +2004,21 @@ void GrGLGpu::flushWindowRectangles(const GrWindowRectangles& windows, const GrG |
if (!this->caps()->maxWindowRectangles() || |
fHWWindowRects.equal(rt->origin(), rt->getViewport(), windows)) { |
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); |
+ |
GrGLIRect glwindows[GrWindowRectangles::kMaxWindows]; |
const SkIRect* skwindows = windows.data(); |
- for (int i = 0; i < windows.count(); ++i) { |
+ for (int i = 0; i < numWindows; ++i) { |
glwindows[i].setRelativeTo(rt->getViewport(), skwindows[i], rt->origin()); |
} |
GrGLenum glmode = (Mode::kExclusive == windows.mode()) ? GR_GL_EXCLUSIVE : GR_GL_INCLUSIVE; |
- GL_CALL(WindowRectangles(glmode, windows.count(), glwindows->asInts())); |
+ GL_CALL(WindowRectangles(glmode, numWindows, glwindows->asInts())); |
fHWWindowRects.set(rt->origin(), rt->getViewport(), windows); |
} |