From: bsalomon Date: Thu, 23 Jul 2015 18:45:02 +0000 (-0700) Subject: Fix ImageNewSurface test on S4. X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~1600 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=494aa593c59d3f426036f87ef1fab1ea158c469f;p=platform%2Fupstream%2FlibSkiaSharp.git Fix ImageNewSurface test on S4. This still leaves the SkImage_NewFromTexture broken. Review URL: https://codereview.chromium.org/1253513004 --- diff --git a/src/gpu/GrTextureProvider.cpp b/src/gpu/GrTextureProvider.cpp index cfa6994..cf93209 100644 --- a/src/gpu/GrTextureProvider.cpp +++ b/src/gpu/GrTextureProvider.cpp @@ -73,10 +73,10 @@ GrTexture* GrTextureProvider::internalRefScratchTexture(const GrSurfaceDesc& inD if (fGpu->caps()->reuseScratchTextures() || (desc->fFlags & kRenderTarget_GrSurfaceFlag)) { if (!(kExact_ScratchTextureFlag & flags)) { // bin by pow2 with a reasonable min - static const int MIN_SIZE = 16; + const int minSize = SkTMin(16, fGpu->caps()->minTextureSize()); GrSurfaceDesc* wdesc = desc.writable(); - wdesc->fWidth = SkTMax(MIN_SIZE, GrNextPow2(desc->fWidth)); - wdesc->fHeight = SkTMax(MIN_SIZE, GrNextPow2(desc->fHeight)); + wdesc->fWidth = SkTMax(minSize, GrNextPow2(desc->fWidth)); + wdesc->fHeight = SkTMax(minSize, GrNextPow2(desc->fHeight)); } GrScratchKey key; diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index e8dc788..101bb21 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -1686,6 +1686,12 @@ static bool read_pixels_pays_for_y_flip(GrRenderTarget* renderTarget, const GrGL return false; } + // If the read is really small or smaller than the min texture size, don't force a draw. + int minSize = SkTMax(32, caps.minTextureSize()); + if (width < minSize || height < minSize) { + return false; + } + // if GL can do the flip then we'll never pay for it. if (caps.packFlipYSupport()) { return false; @@ -1726,7 +1732,9 @@ bool GrGLGpu::getReadPixelsInfo(GrSurface* srcSurface, int width, int height, si tempDrawInfo->fTempSurfaceDesc.fHeight = height; tempDrawInfo->fTempSurfaceDesc.fSampleCnt = 0; tempDrawInfo->fTempSurfaceDesc.fOrigin = kTopLeft_GrSurfaceOrigin; // no CPU y-flip for TL. - tempDrawInfo->fUseExactScratch = SkToBool(GR_GL_FULL_READPIXELS_FASTER_THAN_PARTIAL); + tempDrawInfo->fUseExactScratch = SkToBool(GR_GL_FULL_READPIXELS_FASTER_THAN_PARTIAL) && + width >= this->caps()->minTextureSize() && + height >= this->caps()->minTextureSize(); // Start off assuming that any temp draw should be to the readConfig, then check if that will // be inefficient.