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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 if (NULL != desc || !caps().glyphLoadingSupport || stroke.isDashed()) { | 106 if (NULL != desc || !caps().glyphLoadingSupport || stroke.isDashed()) { |
107 return GrPathRendering::createGlyphs(typeface, desc, stroke); | 107 return GrPathRendering::createGlyphs(typeface, desc, stroke); |
108 } | 108 } |
109 | 109 |
110 if (NULL == typeface) { | 110 if (NULL == typeface) { |
111 typeface = SkTypeface::GetDefaultTypeface(); | 111 typeface = SkTypeface::GetDefaultTypeface(); |
112 SkASSERT(NULL != typeface); | 112 SkASSERT(NULL != typeface); |
113 } | 113 } |
114 | 114 |
115 int faceIndex; | 115 int faceIndex; |
116 SkAutoTDelete<SkStream> fontStream(typeface->openStream(&faceIndex)); | 116 SkStreamAsset* asset = typeface->openStream(&faceIndex); |
| 117 if (!asset) { |
| 118 return GrPathRendering::createGlyphs(typeface, NULL, stroke); |
| 119 } |
| 120 SkAutoTDelete<SkStream> fontStream(asset); |
117 | 121 |
118 const size_t fontDataLength = fontStream->getLength(); | 122 const size_t fontDataLength = fontStream->getLength(); |
119 if (0 == fontDataLength) { | 123 if (0 == fontDataLength) { |
120 return GrPathRendering::createGlyphs(typeface, NULL, stroke); | 124 return GrPathRendering::createGlyphs(typeface, NULL, stroke); |
121 } | 125 } |
122 | 126 |
123 SkTArray<uint8_t> fontTempBuffer; | 127 SkTArray<uint8_t> fontTempBuffer; |
124 const void* fontData = fontStream->getMemoryBase(); | 128 const void* fontData = fontStream->getMemoryBase(); |
125 if (NULL == fontData) { | 129 if (NULL == fontData) { |
126 // TODO: Find a more efficient way to pass the font data (e.g. open file
descriptor). | 130 // TODO: Find a more efficient way to pass the font data (e.g. open file
descriptor). |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 407 |
404 GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, | 408 GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, |
405 reference, mask, transformType, transform
Values)); | 409 reference, mask, transformType, transform
Values)); |
406 GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, | 410 GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, |
407 coverMode, transformType, transformValues))
; | 411 coverMode, transformType, transformValues))
; |
408 } | 412 } |
409 | 413 |
410 inline GrGLGpu* GrGLPathRendering::gpu() { | 414 inline GrGLGpu* GrGLPathRendering::gpu() { |
411 return static_cast<GrGLGpu*>(fGpu); | 415 return static_cast<GrGLGpu*>(fGpu); |
412 } | 416 } |
OLD | NEW |