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

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

Issue 849103004: Make SkStream *not* ref counted. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Treat SkFontMgr::createFromStream as taking ownership of the stream (is this correct?) Created 5 years, 11 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
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (NULL != desc || !caps().glyphLoadingSupport) { 117 if (NULL != desc || !caps().glyphLoadingSupport) {
118 return GrPathRendering::createGlyphs(typeface, desc, stroke); 118 return GrPathRendering::createGlyphs(typeface, desc, stroke);
119 } 119 }
120 120
121 if (NULL == typeface) { 121 if (NULL == typeface) {
122 typeface = SkTypeface::GetDefaultTypeface(); 122 typeface = SkTypeface::GetDefaultTypeface();
123 SkASSERT(NULL != typeface); 123 SkASSERT(NULL != typeface);
124 } 124 }
125 125
126 int faceIndex; 126 int faceIndex;
127 SkAutoTUnref<SkStream> fontStream(typeface->openStream(&faceIndex)); 127 SkAutoTDelete<SkStream> fontStream(typeface->openStream(&faceIndex));
128 128
129 const size_t fontDataLength = fontStream->getLength(); 129 const size_t fontDataLength = fontStream->getLength();
130 if (0 == fontDataLength) { 130 if (0 == fontDataLength) {
131 return GrPathRendering::createGlyphs(typeface, NULL, stroke); 131 return GrPathRendering::createGlyphs(typeface, NULL, stroke);
132 } 132 }
133 133
134 SkTArray<uint8_t> fontTempBuffer; 134 SkTArray<uint8_t> fontTempBuffer;
135 const void* fontData = fontStream->getMemoryBase(); 135 const void* fontData = fontStream->getMemoryBase();
136 if (NULL == fontData) { 136 if (NULL == fontData) {
137 // TODO: Find a more efficient way to pass the font data (e.g. open file descriptor). 137 // TODO: Find a more efficient way to pass the font data (e.g. open file descriptor).
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 reference, mask, coverMode, transformType, 468 reference, mask, coverMode, transformType,
469 transformValues)); 469 transformValues));
470 return; 470 return;
471 } 471 }
472 472
473 GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, 473 GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase,
474 reference, mask, transformType, transform Values)); 474 reference, mask, transformType, transform Values));
475 GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, 475 GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase,
476 coverMode, transformType, transformValues)) ; 476 coverMode, transformType, transformValues)) ;
477 } 477 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698