Hold on to image-filtered texture in SkGpuDevice
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://chromiumcodereview.appspot.com/19729006
git-svn-id: http://skia.googlecode.com/svn/trunk@10156 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 81b25b8..eaac5ab 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1388,12 +1388,14 @@
SkImageFilter* filter = paint.getImageFilter();
SkIPoint offset = SkIPoint::Make(0, 0);
+ // This bitmap will own the filtered result as a texture.
+ SkBitmap filteredBitmap;
+
if (NULL != filter) {
- SkBitmap filterBitmap;
- if (filter_texture(this, fContext, texture, filter, w, h, &filterBitmap, &offset)) {
- texture = (GrTexture*) filterBitmap.getTexture();
- w = filterBitmap.width();
- h = filterBitmap.height();
+ if (filter_texture(this, fContext, texture, filter, w, h, &filteredBitmap, &offset)) {
+ texture = (GrTexture*) filteredBitmap.getTexture();
+ w = filteredBitmap.width();
+ h = filteredBitmap.height();
}
}
@@ -1468,14 +1470,15 @@
int h = bm.height();
SkImageFilter* filter = paint.getImageFilter();
+ // This bitmap will own the filtered result as a texture.
+ SkBitmap filteredBitmap;
if (NULL != filter) {
- SkBitmap filterBitmap;
SkIPoint offset = SkIPoint::Make(0, 0);
- if (filter_texture(this, fContext, devTex, filter, w, h, &filterBitmap, &offset)) {
- devTex = filterBitmap.getTexture();
- w = filterBitmap.width();
- h = filterBitmap.height();
+ if (filter_texture(this, fContext, devTex, filter, w, h, &filteredBitmap, &offset)) {
+ devTex = filteredBitmap.getTexture();
+ w = filteredBitmap.width();
+ h = filteredBitmap.height();
x += offset.fX;
y += offset.fY;
}