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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 const size_t fontDataLength = fontStream->getLength(); | 130 const size_t fontDataLength = fontStream->getLength(); |
131 if (0 == fontDataLength) { | 131 if (0 == fontDataLength) { |
132 return GrPathRendering::createGlyphs(typeface, NULL, stroke); | 132 return GrPathRendering::createGlyphs(typeface, NULL, stroke); |
133 } | 133 } |
134 | 134 |
135 SkTArray<uint8_t> fontTempBuffer; | 135 SkTArray<uint8_t> fontTempBuffer; |
136 const void* fontData = fontStream->getMemoryBase(); | 136 const void* fontData = fontStream->getMemoryBase(); |
137 if (NULL == fontData) { | 137 if (NULL == fontData) { |
138 // TODO: Find a more efficient way to pass the font data (e.g. open file
descriptor). | 138 // TODO: Find a more efficient way to pass the font data (e.g. open file
descriptor). |
139 fontTempBuffer.reset(fontDataLength); | 139 fontTempBuffer.reset(SkToU32(fontDataLength)); |
140 fontStream->read(&fontTempBuffer.front(), fontDataLength); | 140 fontStream->read(&fontTempBuffer.front(), fontDataLength); |
141 fontData = &fontTempBuffer.front(); | 141 fontData = &fontTempBuffer.front(); |
142 } | 142 } |
143 | 143 |
144 const size_t numPaths = typeface->countGlyphs(); | 144 const int numPaths = typeface->countGlyphs(); |
145 const GrGLuint basePathID = this->genPaths(numPaths); | 145 const GrGLuint basePathID = this->genPaths(numPaths); |
146 SkAutoTUnref<GrGLPath> templatePath(SkNEW_ARGS(GrGLPath, (fGpu, SkPath(), st
roke))); | 146 SkAutoTUnref<GrGLPath> templatePath(SkNEW_ARGS(GrGLPath, (fGpu, SkPath(), st
roke))); |
147 | 147 |
148 GrGLenum status; | 148 GrGLenum status; |
149 GL_CALL_RET(status, PathMemoryGlyphIndexArray(basePathID, GR_GL_STANDARD_FON
T_FORMAT, | 149 GL_CALL_RET(status, PathMemoryGlyphIndexArray(basePathID, GR_GL_STANDARD_FON
T_FORMAT, |
150 fontDataLength, fontData, face
Index, 0, | 150 fontDataLength, fontData, face
Index, 0, |
151 numPaths, templatePath->pathID
(), | 151 numPaths, templatePath->pathID
(), |
152 SkPaint::kCanonicalTextSizeFor
Paths)); | 152 SkPaint::kCanonicalTextSizeFor
Paths)); |
153 | 153 |
154 if (GR_GL_FONT_GLYPHS_AVAILABLE != status) { | 154 if (GR_GL_FONT_GLYPHS_AVAILABLE != status) { |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 reference, mask, coverMode,
transformType, | 469 reference, mask, coverMode,
transformType, |
470 transformValues)); | 470 transformValues)); |
471 return; | 471 return; |
472 } | 472 } |
473 | 473 |
474 GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, | 474 GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, |
475 reference, mask, transformType, transform
Values)); | 475 reference, mask, transformType, transform
Values)); |
476 GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, | 476 GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, |
477 coverMode, transformType, transformValues))
; | 477 coverMode, transformType, transformValues))
; |
478 } | 478 } |
OLD | NEW |