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

Unified Diff: src/gpu/gl/GrGLPathRendering.cpp

Issue 1176113008: Stop using the NVPR glyph loading functionality (Closed) Base URL: https://skia.googlesource.com/skia.git@chromium-pathrendering-prepare-01-for-fragment-bind
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLPathRendering.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLPathRendering.cpp
diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp
index e81d54c338250fa16a4331d4a90055bfbfd723ea..eb9f5a86f751a0b483c684478994eb3bfe372d3a 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -69,8 +69,6 @@ GrGLPathRendering::GrGLPathRendering(GrGLGpu* gpu)
NULL != glInterface->fFunctions.fStencilThenCoverStrokePathInstanced;
fCaps.fragmentInputGenSupport =
NULL != glInterface->fFunctions.fProgramPathFragmentInputGen;
- fCaps.glyphLoadingSupport =
- NULL != glInterface->fFunctions.fPathMemoryGlyphIndexArray;
SkASSERT(fCaps.fragmentInputGenSupport);
}
@@ -100,63 +98,6 @@ GrPathRange* GrGLPathRendering::createPathRange(GrPathRange::PathGenerator* path
return SkNEW_ARGS(GrGLPathRange, (this->gpu(), pathGenerator, stroke));
}
-GrPathRange* GrGLPathRendering::createGlyphs(const SkTypeface* typeface,
- const SkDescriptor* desc,
- const GrStrokeInfo& stroke) {
- if (NULL != desc || !caps().glyphLoadingSupport || stroke.isDashed()) {
- return GrPathRendering::createGlyphs(typeface, desc, stroke);
- }
-
- if (NULL == typeface) {
- typeface = SkTypeface::GetDefaultTypeface();
- SkASSERT(NULL != typeface);
- }
-
- int faceIndex;
- SkStreamAsset* asset = typeface->openStream(&faceIndex);
- if (!asset) {
- return GrPathRendering::createGlyphs(typeface, NULL, stroke);
- }
- SkAutoTDelete<SkStream> fontStream(asset);
-
- const size_t fontDataLength = fontStream->getLength();
- if (0 == fontDataLength) {
- return GrPathRendering::createGlyphs(typeface, NULL, stroke);
- }
-
- SkTArray<uint8_t> fontTempBuffer;
- const void* fontData = fontStream->getMemoryBase();
- if (NULL == fontData) {
- // TODO: Find a more efficient way to pass the font data (e.g. open file descriptor).
- fontTempBuffer.reset(SkToInt(fontDataLength));
- fontStream->read(&fontTempBuffer.front(), fontDataLength);
- fontData = &fontTempBuffer.front();
- }
-
- const int numPaths = typeface->countGlyphs();
- const GrGLuint basePathID = this->genPaths(numPaths);
-
- // Init the basePathID as the template path.
- GrGLPath::InitPathObject(this->gpu(), basePathID, SkPath(), stroke);
-
- GrGLenum status;
- GL_CALL_RET(status, PathMemoryGlyphIndexArray(basePathID, GR_GL_STANDARD_FONT_FORMAT,
- fontDataLength, fontData, faceIndex, 0,
- numPaths, basePathID,
- SkPaint::kCanonicalTextSizeForPaths));
-
- if (GR_GL_FONT_GLYPHS_AVAILABLE != status) {
- this->deletePaths(basePathID, numPaths);
- return GrPathRendering::createGlyphs(typeface, NULL, stroke);
- }
-
- // This is a crude approximation. We may want to consider giving this class
- // a pseudo PathGenerator whose sole purpose is to track the approximate gpu
- // memory size.
- const size_t gpuMemorySize = fontDataLength / 4;
- return SkNEW_ARGS(GrGLPathRange, (this->gpu(), basePathID, numPaths, gpuMemorySize, stroke));
-}
-
void GrGLPathRendering::onStencilPath(const StencilPathArgs& args, const GrPath* path) {
GrGLGpu* gpu = this->gpu();
SkASSERT(gpu->caps()->shaderCaps()->pathRenderingSupport());
« no previous file with comments | « src/gpu/gl/GrGLPathRendering.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698