Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1199)

Side by Side Diff: src/gpu/gl/GrGLPathRendering.cpp

Issue 1185803003: don't rely on fonts having a stream (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/fonts/SkTestScalerContext.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/fonts/SkTestScalerContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698