aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-07-23 11:45:02 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-23 11:45:02 -0700
commit494aa593c59d3f426036f87ef1fab1ea158c469f (patch)
treef472a9070cd3b4e8f59debbe630cf8c7bc468840
parenteb86b55fe997e1f2f902d3d5c599bf6894f0f07c (diff)
Fix ImageNewSurface test on S4.
This still leaves the SkImage_NewFromTexture broken. Review URL: https://codereview.chromium.org/1253513004
-rw-r--r--src/gpu/GrTextureProvider.cpp6
-rw-r--r--src/gpu/gl/GrGLGpu.cpp10
2 files changed, 12 insertions, 4 deletions
diff --git a/src/gpu/GrTextureProvider.cpp b/src/gpu/GrTextureProvider.cpp
index cfa6994c4b..cf93209dbc 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 e8dc788415..101bb216f4 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.