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 | 8 |
9 #include "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
10 #include "GrGLStencilBuffer.h" | 10 #include "GrGLStencilBuffer.h" |
(...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 GrDrawState::AutoViewMatrixRestore avmr; | 1718 GrDrawState::AutoViewMatrixRestore avmr; |
1719 SkRect bounds = SkRect::MakeLTRB(0, 0, | 1719 SkRect bounds = SkRect::MakeLTRB(0, 0, |
1720 SkIntToScalar(drawState->getRenderTarge
t()->width()), | 1720 SkIntToScalar(drawState->getRenderTarge
t()->width()), |
1721 SkIntToScalar(drawState->getRenderTarge
t()->height())); | 1721 SkIntToScalar(drawState->getRenderTarge
t()->height())); |
1722 SkMatrix vmi; | 1722 SkMatrix vmi; |
1723 // mapRect through persp matrix may not be correct | 1723 // mapRect through persp matrix may not be correct |
1724 if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewIn
verse(&vmi)) { | 1724 if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewIn
verse(&vmi)) { |
1725 vmi.mapRect(&bounds); | 1725 vmi.mapRect(&bounds); |
1726 // theoretically could set bloat = 0, instead leave it because of ma
trix inversion | 1726 // theoretically could set bloat = 0, instead leave it because of ma
trix inversion |
1727 // precision. | 1727 // precision. |
1728 SkScalar bloat = drawState->getViewMatrix().getMaxStretch() * SK_Sca
larHalf; | 1728 SkScalar bloat = drawState->getViewMatrix().getMaxScale() * SK_Scala
rHalf; |
1729 bounds.outset(bloat, bloat); | 1729 bounds.outset(bloat, bloat); |
1730 } else { | 1730 } else { |
1731 avmr.setIdentity(drawState); | 1731 avmr.setIdentity(drawState); |
1732 } | 1732 } |
1733 | 1733 |
1734 this->drawSimpleRect(bounds, NULL); | 1734 this->drawSimpleRect(bounds, NULL); |
1735 } | 1735 } |
1736 } | 1736 } |
1737 | 1737 |
1738 void GrGpuGL::onGpuDrawPaths(int pathCount, const GrPath** paths, | 1738 void GrGpuGL::onGpuDrawPaths(int pathCount, const GrPath** paths, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1811 GrDrawState::AutoViewMatrixRestore avmr; | 1811 GrDrawState::AutoViewMatrixRestore avmr; |
1812 SkRect bounds = SkRect::MakeLTRB(0, 0, | 1812 SkRect bounds = SkRect::MakeLTRB(0, 0, |
1813 SkIntToScalar(drawState->getRenderTarge
t()->width()), | 1813 SkIntToScalar(drawState->getRenderTarge
t()->width()), |
1814 SkIntToScalar(drawState->getRenderTarge
t()->height())); | 1814 SkIntToScalar(drawState->getRenderTarge
t()->height())); |
1815 SkMatrix vmi; | 1815 SkMatrix vmi; |
1816 // mapRect through persp matrix may not be correct | 1816 // mapRect through persp matrix may not be correct |
1817 if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewIn
verse(&vmi)) { | 1817 if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewIn
verse(&vmi)) { |
1818 vmi.mapRect(&bounds); | 1818 vmi.mapRect(&bounds); |
1819 // theoretically could set bloat = 0, instead leave it because of ma
trix inversion | 1819 // theoretically could set bloat = 0, instead leave it because of ma
trix inversion |
1820 // precision. | 1820 // precision. |
1821 SkScalar bloat = drawState->getViewMatrix().getMaxStretch() * SK_Sca
larHalf; | 1821 SkScalar bloat = drawState->getViewMatrix().getMaxScale() * SK_Scala
rHalf; |
1822 bounds.outset(bloat, bloat); | 1822 bounds.outset(bloat, bloat); |
1823 } else { | 1823 } else { |
1824 avmr.setIdentity(drawState); | 1824 avmr.setIdentity(drawState); |
1825 } | 1825 } |
1826 | 1826 |
1827 this->drawSimpleRect(bounds, NULL); | 1827 this->drawSimpleRect(bounds, NULL); |
1828 } | 1828 } |
1829 } | 1829 } |
1830 | 1830 |
1831 void GrGpuGL::onResolveRenderTarget(GrRenderTarget* target) { | 1831 void GrGpuGL::onResolveRenderTarget(GrRenderTarget* target) { |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2803 this->setVertexArrayID(gpu, 0); | 2803 this->setVertexArrayID(gpu, 0); |
2804 } | 2804 } |
2805 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2805 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2806 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2806 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2807 fDefaultVertexArrayAttribState.resize(attrCount); | 2807 fDefaultVertexArrayAttribState.resize(attrCount); |
2808 } | 2808 } |
2809 attribState = &fDefaultVertexArrayAttribState; | 2809 attribState = &fDefaultVertexArrayAttribState; |
2810 } | 2810 } |
2811 return attribState; | 2811 return attribState; |
2812 } | 2812 } |
OLD | NEW |