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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 const void* fontData = fontStream->getMemoryBase(); | 125 const void* fontData = fontStream->getMemoryBase(); |
126 if (NULL == fontData) { | 126 if (NULL == fontData) { |
127 // TODO: Find a more efficient way to pass the font data (e.g. open file
descriptor). | 127 // TODO: Find a more efficient way to pass the font data (e.g. open file
descriptor). |
128 fontTempBuffer.reset(fontDataLength); | 128 fontTempBuffer.reset(fontDataLength); |
129 fontStream->read(&fontTempBuffer.front(), fontDataLength); | 129 fontStream->read(&fontTempBuffer.front(), fontDataLength); |
130 fontData = &fontTempBuffer.front(); | 130 fontData = &fontTempBuffer.front(); |
131 } | 131 } |
132 | 132 |
133 const size_t numPaths = typeface->countGlyphs(); | 133 const size_t numPaths = typeface->countGlyphs(); |
134 const GrGLuint basePathID = this->genPaths(numPaths); | 134 const GrGLuint basePathID = this->genPaths(numPaths); |
| 135 SkAutoTUnref<GrGLPath> templatePath(SkNEW_ARGS(GrGLPath, (fGpu, SkPath(), st
roke))); |
135 | 136 |
136 GrGLenum status; | 137 GrGLenum status; |
137 GL_CALL_RET(status, PathMemoryGlyphIndexArray(basePathID, GR_GL_STANDARD_FON
T_FORMAT, | 138 GL_CALL_RET(status, PathMemoryGlyphIndexArray(basePathID, GR_GL_STANDARD_FON
T_FORMAT, |
138 fontDataLength, fontData, face
Index, 0, numPaths, | 139 fontDataLength, fontData, face
Index, 0, |
139 GrGLPath(fGpu, SkPath(), strok
e).pathID(), | 140 numPaths, templatePath->pathID
(), |
140 SkPaint::kCanonicalTextSizeFor
Paths)); | 141 SkPaint::kCanonicalTextSizeFor
Paths)); |
141 | 142 |
142 if (GR_GL_FONT_GLYPHS_AVAILABLE != status) { | 143 if (GR_GL_FONT_GLYPHS_AVAILABLE != status) { |
143 this->deletePaths(basePathID, numPaths); | 144 this->deletePaths(basePathID, numPaths); |
144 return GrPathRendering::createGlyphs(typeface, NULL, stroke); | 145 return GrPathRendering::createGlyphs(typeface, NULL, stroke); |
145 } | 146 } |
146 | 147 |
147 // This is a crude approximation. We may want to consider giving this class | 148 // 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 | 149 // a pseudo PathGenerator whose sole purpose is to track the approximate gpu |
149 // memory size. | 150 // memory size. |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 reference, mask, coverMode,
transformType, | 525 reference, mask, coverMode,
transformType, |
525 transformValues)); | 526 transformValues)); |
526 return; | 527 return; |
527 } | 528 } |
528 | 529 |
529 GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, | 530 GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, |
530 reference, mask, transformType, transform
Values)); | 531 reference, mask, transformType, transform
Values)); |
531 GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, | 532 GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, |
532 coverMode, transformType, transformValues))
; | 533 coverMode, transformType, transformValues))
; |
533 } | 534 } |
OLD | NEW |