Fix Gpu texture creation bug
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 16 May 2014 17:22:51 +0000 (17:22 +0000)
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 16 May 2014 17:22:51 +0000 (17:22 +0000)
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

src/gpu/GrContext.cpp

index 4b37c60a2734020eebaf82461cd2a68aef02990d..baa002a54a5a0c387789e78b1003f4dc4399e955 100644 (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);
     }