| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "gl/GrGLPathRendering.h" | 8 #include "gl/GrGLPathRendering.h" |
| 9 #include "gl/GrGLNameAllocator.h" | 9 #include "gl/GrGLNameAllocator.h" |
| 10 #include "gl/GrGLUtil.h" | 10 #include "gl/GrGLUtil.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 const void* fontData = fontStream->getMemoryBase(); | 124 const void* fontData = fontStream->getMemoryBase(); |
| 125 if (NULL == fontData) { | 125 if (NULL == fontData) { |
| 126 // TODO: Find a more efficient way to pass the font data (e.g. open file
descriptor). | 126 // TODO: Find a more efficient way to pass the font data (e.g. open file
descriptor). |
| 127 fontTempBuffer.reset(SkToInt(fontDataLength)); | 127 fontTempBuffer.reset(SkToInt(fontDataLength)); |
| 128 fontStream->read(&fontTempBuffer.front(), fontDataLength); | 128 fontStream->read(&fontTempBuffer.front(), fontDataLength); |
| 129 fontData = &fontTempBuffer.front(); | 129 fontData = &fontTempBuffer.front(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 const int numPaths = typeface->countGlyphs(); | 132 const int numPaths = typeface->countGlyphs(); |
| 133 const GrGLuint basePathID = this->genPaths(numPaths); | 133 const GrGLuint basePathID = this->genPaths(numPaths); |
| 134 SkAutoTUnref<GrGLPath> templatePath(SkNEW_ARGS(GrGLPath, (fGpu, SkPath(), st
roke))); | 134 |
| 135 // Init the basePathID as the template path. |
| 136 GrGLPath::InitPathObject(fGpu, basePathID, SkPath(), stroke); |
| 135 | 137 |
| 136 GrGLenum status; | 138 GrGLenum status; |
| 137 GL_CALL_RET(status, PathMemoryGlyphIndexArray(basePathID, GR_GL_STANDARD_FON
T_FORMAT, | 139 GL_CALL_RET(status, PathMemoryGlyphIndexArray(basePathID, GR_GL_STANDARD_FON
T_FORMAT, |
| 138 fontDataLength, fontData, face
Index, 0, | 140 fontDataLength, fontData, face
Index, 0, |
| 139 numPaths, templatePath->pathID
(), | 141 numPaths, basePathID, |
| 140 SkPaint::kCanonicalTextSizeFor
Paths)); | 142 SkPaint::kCanonicalTextSizeFor
Paths)); |
| 141 | 143 |
| 142 if (GR_GL_FONT_GLYPHS_AVAILABLE != status) { | 144 if (GR_GL_FONT_GLYPHS_AVAILABLE != status) { |
| 143 this->deletePaths(basePathID, numPaths); | 145 this->deletePaths(basePathID, numPaths); |
| 144 return GrPathRendering::createGlyphs(typeface, NULL, stroke); | 146 return GrPathRendering::createGlyphs(typeface, NULL, stroke); |
| 145 } | 147 } |
| 146 | 148 |
| 147 // This is a crude approximation. We may want to consider giving this class | 149 // This is a crude approximation. We may want to consider giving this class |
| 148 // a pseudo PathGenerator whose sole purpose is to track the approximate gpu | 150 // a pseudo PathGenerator whose sole purpose is to track the approximate gpu |
| 149 // memory size. | 151 // memory size. |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 reference, mask, coverMode,
transformType, | 382 reference, mask, coverMode,
transformType, |
| 381 transformValues)); | 383 transformValues)); |
| 382 return; | 384 return; |
| 383 } | 385 } |
| 384 | 386 |
| 385 GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, | 387 GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, |
| 386 reference, mask, transformType, transform
Values)); | 388 reference, mask, transformType, transform
Values)); |
| 387 GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, | 389 GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, |
| 388 coverMode, transformType, transformValues))
; | 390 coverMode, transformType, transformValues))
; |
| 389 } | 391 } |
| OLD | NEW |