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

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

Issue 582033003: Fix stack-allocated GPU path object (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698