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
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 4b37c60..baa002a 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -268,13 +268,13 @@
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 @@
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);
}