From 591a2ca842cb34919695a32757d700dee8b7822c Mon Sep 17 00:00:00 2001 From: kkinnunen Date: Tue, 23 Jun 2015 07:27:40 -0700 Subject: Stop using the NVPR glyph loading functionality Remove the NVPR glyph loading functionality. A bit risky feature. Review URL: https://codereview.chromium.org/1176113008 --- src/gpu/GrPathRendering.h | 3 +- src/gpu/gl/GrGLAssembleInterface.cpp | 2 -- src/gpu/gl/GrGLInterface.cpp | 4 +-- src/gpu/gl/GrGLPathRendering.cpp | 59 ------------------------------------ src/gpu/gl/GrGLPathRendering.h | 4 --- 5 files changed, 2 insertions(+), 70 deletions(-) (limited to 'src/gpu') diff --git a/src/gpu/GrPathRendering.h b/src/gpu/GrPathRendering.h index ea276f3179..527a8430c5 100644 --- a/src/gpu/GrPathRendering.h +++ b/src/gpu/GrPathRendering.h @@ -124,8 +124,7 @@ public: * * @return a new path range populated with glyphs. */ - virtual GrPathRange* createGlyphs(const SkTypeface*, const SkDescriptor*, - const GrStrokeInfo&) = 0; + GrPathRange* createGlyphs(const SkTypeface*, const SkDescriptor*, const GrStrokeInfo&); /** None of these params are optional, pointers used just to avoid making copies. */ struct StencilPathArgs { diff --git a/src/gpu/gl/GrGLAssembleInterface.cpp b/src/gpu/gl/GrGLAssembleInterface.cpp index 86f3eb56bb..1fe53ebc3e 100644 --- a/src/gpu/gl/GrGLAssembleInterface.cpp +++ b/src/gpu/gl/GrGLAssembleInterface.cpp @@ -296,7 +296,6 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) { GET_PROC_SUFFIX(StencilThenCoverStrokePathInstanced, NV); // NV_path_rendering v1.3 (These methods may not be present) GET_PROC_SUFFIX(ProgramPathFragmentInputGen, NV); - GET_PROC_SUFFIX(PathMemoryGlyphIndexArray, NV); } if (extensions.has("GL_NV_framebuffer_mixed_samples")) { @@ -703,7 +702,6 @@ const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) { GET_PROC_SUFFIX(StencilThenCoverFillPathInstanced, NV); GET_PROC_SUFFIX(StencilThenCoverStrokePathInstanced, NV); GET_PROC_SUFFIX(ProgramPathFragmentInputGen, NV); - GET_PROC_SUFFIX(PathMemoryGlyphIndexArray, NV); } if (extensions.has("GL_NV_framebuffer_mixed_samples")) { diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp index 9158f25b4b..3d44f6d602 100644 --- a/src/gpu/gl/GrGLInterface.cpp +++ b/src/gpu/gl/GrGLInterface.cpp @@ -61,7 +61,6 @@ const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface* interface) { newInterface->fFunctions.fStencilThenCoverFillPathInstanced = NULL; newInterface->fFunctions.fStencilThenCoverStrokePathInstanced = NULL; newInterface->fFunctions.fProgramPathFragmentInputGen = NULL; - newInterface->fFunctions.fPathMemoryGlyphIndexArray = NULL; return newInterface; } @@ -518,8 +517,7 @@ bool GrGLInterface::validate() const { NULL == fFunctions.fStencilThenCoverStrokePath || NULL == fFunctions.fStencilThenCoverFillPathInstanced || NULL == fFunctions.fStencilThenCoverStrokePathInstanced || - NULL == fFunctions.fProgramPathFragmentInputGen || - NULL == fFunctions.fPathMemoryGlyphIndexArray) { + NULL == fFunctions.fProgramPathFragmentInputGen) { RETURN_FALSE_INTERFACE } } diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp index e81d54c338..eb9f5a86f7 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 fontStream(asset); - - const size_t fontDataLength = fontStream->getLength(); - if (0 == fontDataLength) { - return GrPathRendering::createGlyphs(typeface, NULL, stroke); - } - - SkTArray 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()); diff --git a/src/gpu/gl/GrGLPathRendering.h b/src/gpu/gl/GrGLPathRendering.h index aa6747098b..20fd4967b7 100644 --- a/src/gpu/gl/GrGLPathRendering.h +++ b/src/gpu/gl/GrGLPathRendering.h @@ -36,9 +36,6 @@ public: GrPath* createPath(const SkPath&, const GrStrokeInfo&) override; virtual GrPathRange* createPathRange(GrPathRange::PathGenerator*, const GrStrokeInfo&) override; - virtual GrPathRange* createGlyphs(const SkTypeface*, - const SkDescriptor*, - const GrStrokeInfo&) override; /* Called when the 3D context state is unknown. */ void resetContext(); @@ -75,7 +72,6 @@ private: struct Caps { bool stencilThenCoverSupport : 1; bool fragmentInputGenSupport : 1; - bool glyphLoadingSupport : 1; }; const Caps& caps() const { return fCaps; } -- cgit v1.2.3