OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrGLGpu.h" | 8 #include "GrGLGpu.h" |
9 #include "GrGLBuffer.h" | 9 #include "GrGLBuffer.h" |
10 #include "GrGLGLSL.h" | 10 #include "GrGLGLSL.h" |
(...skipping 1986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1997 } | 1997 } |
1998 | 1998 |
1999 void GrGLGpu::flushWindowRectangles(const GrWindowRectangles& windows, const GrG
LRenderTarget* rt) { | 1999 void GrGLGpu::flushWindowRectangles(const GrWindowRectangles& windows, const GrG
LRenderTarget* rt) { |
2000 typedef GrWindowRectangles::Mode Mode; | 2000 typedef GrWindowRectangles::Mode Mode; |
2001 SkASSERT(windows.count() <= this->caps()->maxWindowRectangles()); | 2001 SkASSERT(windows.count() <= this->caps()->maxWindowRectangles()); |
2002 SkASSERT(windows.disabled() || rt->renderFBOID()); // Window rectangles can'
t be used on-screen. | 2002 SkASSERT(windows.disabled() || rt->renderFBOID()); // Window rectangles can'
t be used on-screen. |
2003 | 2003 |
2004 if (!this->caps()->maxWindowRectangles() || | 2004 if (!this->caps()->maxWindowRectangles() || |
2005 fHWWindowRects.equal(rt->origin(), rt->getViewport(), windows)) { | 2005 fHWWindowRects.equal(rt->origin(), rt->getViewport(), windows)) { |
2006 return; | 2006 return; |
| 2007 } |
2007 | 2008 |
2008 } | 2009 // This is purely a workaround for a spurious warning generated by gcc. Othe
rwise the above |
| 2010 // assert would be sufficient. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=
5912 |
| 2011 int numWindows = SkTMin(windows.count(), int(GrWindowRectangles::kMaxWindows
)); |
| 2012 SkASSERT(windows.count() == numWindows); |
2009 | 2013 |
2010 GrGLIRect glwindows[GrWindowRectangles::kMaxWindows]; | 2014 GrGLIRect glwindows[GrWindowRectangles::kMaxWindows]; |
2011 const SkIRect* skwindows = windows.data(); | 2015 const SkIRect* skwindows = windows.data(); |
2012 for (int i = 0; i < windows.count(); ++i) { | 2016 for (int i = 0; i < numWindows; ++i) { |
2013 glwindows[i].setRelativeTo(rt->getViewport(), skwindows[i], rt->origin()
); | 2017 glwindows[i].setRelativeTo(rt->getViewport(), skwindows[i], rt->origin()
); |
2014 } | 2018 } |
2015 | 2019 |
2016 GrGLenum glmode = (Mode::kExclusive == windows.mode()) ? GR_GL_EXCLUSIVE : G
R_GL_INCLUSIVE; | 2020 GrGLenum glmode = (Mode::kExclusive == windows.mode()) ? GR_GL_EXCLUSIVE : G
R_GL_INCLUSIVE; |
2017 GL_CALL(WindowRectangles(glmode, windows.count(), glwindows->asInts())); | 2021 GL_CALL(WindowRectangles(glmode, numWindows, glwindows->asInts())); |
2018 | 2022 |
2019 fHWWindowRects.set(rt->origin(), rt->getViewport(), windows); | 2023 fHWWindowRects.set(rt->origin(), rt->getViewport(), windows); |
2020 } | 2024 } |
2021 | 2025 |
2022 void GrGLGpu::disableWindowRectangles() { | 2026 void GrGLGpu::disableWindowRectangles() { |
2023 if (!this->caps()->maxWindowRectangles() || fHWWindowRects.disabled()) { | 2027 if (!this->caps()->maxWindowRectangles() || fHWWindowRects.disabled()) { |
2024 return; | 2028 return; |
2025 } | 2029 } |
2026 GL_CALL(WindowRectangles(GR_GL_EXCLUSIVE, 0, nullptr)); | 2030 GL_CALL(WindowRectangles(GR_GL_EXCLUSIVE, 0, nullptr)); |
2027 fHWWindowRects.setDisabled(); | 2031 fHWWindowRects.setDisabled(); |
(...skipping 2629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4657 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 4661 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
4658 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 4662 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
4659 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 4663 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
4660 copyParams->fWidth = texture->width(); | 4664 copyParams->fWidth = texture->width(); |
4661 copyParams->fHeight = texture->height(); | 4665 copyParams->fHeight = texture->height(); |
4662 return true; | 4666 return true; |
4663 } | 4667 } |
4664 } | 4668 } |
4665 return false; | 4669 return false; |
4666 } | 4670 } |
OLD | NEW |