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 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1684 SkScalar bloat = drawState->getViewMatrix().getMaxStretch() * SK_Sca
larHalf; | 1684 SkScalar bloat = drawState->getViewMatrix().getMaxStretch() * SK_Sca
larHalf; |
1685 bounds.outset(bloat, bloat); | 1685 bounds.outset(bloat, bloat); |
1686 } else { | 1686 } else { |
1687 avmr.setIdentity(drawState); | 1687 avmr.setIdentity(drawState); |
1688 } | 1688 } |
1689 | 1689 |
1690 this->drawSimpleRect(bounds, NULL); | 1690 this->drawSimpleRect(bounds, NULL); |
1691 } | 1691 } |
1692 } | 1692 } |
1693 | 1693 |
1694 void GrGpuGL::onGpuDrawPaths(size_t pathCount, const GrPath** paths, | 1694 void GrGpuGL::onGpuDrawPaths(int pathCount, const GrPath** paths, |
1695 const SkMatrix* transforms, | 1695 const SkMatrix* transforms, |
1696 SkPath::FillType fill, | 1696 SkPath::FillType fill, |
1697 SkStrokeRec::Style stroke) { | 1697 SkStrokeRec::Style stroke) { |
1698 SkASSERT(this->caps()->pathRenderingSupport()); | 1698 SkASSERT(this->caps()->pathRenderingSupport()); |
1699 SkASSERT(NULL != this->drawState()->getRenderTarget()); | 1699 SkASSERT(NULL != this->drawState()->getRenderTarget()); |
1700 SkASSERT(NULL != this->drawState()->getRenderTarget()->getStencilBuffer()); | 1700 SkASSERT(NULL != this->drawState()->getRenderTarget()->getStencilBuffer()); |
1701 SkASSERT(!fCurrentProgram->hasVertexShader()); | 1701 SkASSERT(!fCurrentProgram->hasVertexShader()); |
1702 SkASSERT(stroke != SkStrokeRec::kHairline_Style); | 1702 SkASSERT(stroke != SkStrokeRec::kHairline_Style); |
1703 | 1703 |
1704 SkAutoMalloc pathData(pathCount * sizeof(GrGLuint)); | 1704 SkAutoMalloc pathData(pathCount * sizeof(GrGLuint)); |
1705 SkAutoMalloc transformData(pathCount * sizeof(GrGLfloat) * 6); | 1705 SkAutoMalloc transformData(pathCount * sizeof(GrGLfloat) * 6); |
1706 GrGLfloat* transformValues = | 1706 GrGLfloat* transformValues = |
1707 reinterpret_cast<GrGLfloat*>(transformData.get()); | 1707 reinterpret_cast<GrGLfloat*>(transformData.get()); |
1708 GrGLuint* pathIDs = reinterpret_cast<GrGLuint*>(pathData.get()); | 1708 GrGLuint* pathIDs = reinterpret_cast<GrGLuint*>(pathData.get()); |
1709 | 1709 |
1710 for (size_t i = 0; i < pathCount; ++i) { | 1710 for (int i = 0; i < pathCount; ++i) { |
1711 SkASSERT(transforms[i].asAffine(NULL)); | 1711 SkASSERT(transforms[i].asAffine(NULL)); |
1712 const SkMatrix& m = transforms[i]; | 1712 const SkMatrix& m = transforms[i]; |
1713 transformValues[i * 6] = m.getScaleX(); | 1713 transformValues[i * 6] = m.getScaleX(); |
1714 transformValues[i * 6 + 1] = m.getSkewY(); | 1714 transformValues[i * 6 + 1] = m.getSkewY(); |
1715 transformValues[i * 6 + 2] = m.getSkewX(); | 1715 transformValues[i * 6 + 2] = m.getSkewX(); |
1716 transformValues[i * 6 + 3] = m.getScaleY(); | 1716 transformValues[i * 6 + 3] = m.getScaleY(); |
1717 transformValues[i * 6 + 4] = m.getTranslateX(); | 1717 transformValues[i * 6 + 4] = m.getTranslateX(); |
1718 transformValues[i * 6 + 5] = m.getTranslateY(); | 1718 transformValues[i * 6 + 5] = m.getTranslateY(); |
1719 pathIDs[i] = static_cast<const GrGLPath*>(paths[i])->pathID(); | 1719 pathIDs[i] = static_cast<const GrGLPath*>(paths[i])->pathID(); |
1720 } | 1720 } |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2789 this->setVertexArrayID(gpu, 0); | 2789 this->setVertexArrayID(gpu, 0); |
2790 } | 2790 } |
2791 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2791 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2792 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2792 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2793 fDefaultVertexArrayAttribState.resize(attrCount); | 2793 fDefaultVertexArrayAttribState.resize(attrCount); |
2794 } | 2794 } |
2795 attribState = &fDefaultVertexArrayAttribState; | 2795 attribState = &fDefaultVertexArrayAttribState; |
2796 } | 2796 } |
2797 return attribState; | 2797 return attribState; |
2798 } | 2798 } |
OLD | NEW |