Fix Gpu texture creation bug

When creating a resizedTexture on a device that doesn't support non power of 2 tile (Tegras),
we were creating the new stretched texture but were not actually saving the result

BUG=skia:2561
R=bsalomon@google.com, robertphillips@google.com, jvanverth@google.com

Author: egdaniel@google.com

Review URL: https://codereview.chromium.org/284303005

git-svn-id: http://skia.googlecode.com/svn/trunk@14765 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-05-16 17:22:51 +00:00
parent 684b3d0e3c
commit b0ce4b6fc8

View File

@ -268,13 +268,13 @@ GrStencilBuffer* GrContext::findStencilBuffer(int width, int height,
return static_cast<GrStencilBuffer*>(resource);
}
static void stretchImage(void* dst,
int dstW,
int dstH,
void* src,
int srcW,
int srcH,
size_t bpp) {
static void stretch_image(void* dst,
int dstW,
int dstH,
void* src,
int srcW,
int srcH,
size_t bpp) {
SkFixed dx = (srcW << 16) / dstW;
SkFixed dy = (srcH << 16) / dstH;
@ -364,13 +364,12 @@ GrTexture* GrContext::createResizedTexture(const GrTextureDesc& desc,
rtDesc.fHeight = GrNextPow2(desc.fHeight);
size_t bpp = GrBytesPerPixel(desc.fConfig);
SkAutoSMalloc<128*128*4> stretchedPixels(bpp * rtDesc.fWidth * rtDesc.fHeight);
stretchImage(stretchedPixels.get(), rtDesc.fWidth, rtDesc.fHeight,
srcData, desc.fWidth, desc.fHeight, bpp);
stretch_image(stretchedPixels.get(), rtDesc.fWidth, rtDesc.fHeight,
srcData, desc.fWidth, desc.fHeight, bpp);
size_t stretchedRowBytes = rtDesc.fWidth * bpp;
SkDEBUGCODE(GrTexture* texture = )fGpu->createTexture(rtDesc, stretchedPixels.get(),
stretchedRowBytes);
texture = fGpu->createTexture(rtDesc, stretchedPixels.get(), stretchedRowBytes);
SkASSERT(NULL != texture);
}