Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: src/effects/SkXfermodeImageFilter.cpp

Issue 16305016: Fix leak of effect in SkXfermodeImageFilter::filterImageGPU() (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 The Android Open Source Project 2 * Copyright 2013 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkXfermodeImageFilter.h" 8 #include "SkXfermodeImageFilter.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (!SkXfermode::AsNewEffectOrCoeff(fMode, context, &xferEffect, &sm, &dm, b ackgroundTex)) { 95 if (!SkXfermode::AsNewEffectOrCoeff(fMode, context, &xferEffect, &sm, &dm, b ackgroundTex)) {
96 return false; 96 return false;
97 } 97 }
98 98
99 GrPaint paint; 99 GrPaint paint;
100 SkRect srcRect; 100 SkRect srcRect;
101 src.getBounds(&srcRect); 101 src.getBounds(&srcRect);
102 if (NULL != xferEffect) { 102 if (NULL != xferEffect) {
103 paint.colorStage(0)->setEffect( 103 paint.colorStage(0)->setEffect(
104 GrSimpleTextureEffect::Create(foregroundTex, GrEffect::MakeDivByText ureWHMatrix(foregroundTex)))->unref(); 104 GrSimpleTextureEffect::Create(foregroundTex, GrEffect::MakeDivByText ureWHMatrix(foregroundTex)))->unref();
105 paint.colorStage(1)->setEffect(xferEffect); 105 paint.colorStage(1)->setEffect(xferEffect)->unref();
106 context->drawRect(paint, srcRect); 106 context->drawRect(paint, srcRect);
107 } else { 107 } else {
108 paint.colorStage(0)->setEffect( 108 paint.colorStage(0)->setEffect(
109 GrSimpleTextureEffect::Create(backgroundTex, GrEffect::MakeDivByText ureWHMatrix(backgroundTex)))->unref(); 109 GrSimpleTextureEffect::Create(backgroundTex, GrEffect::MakeDivByText ureWHMatrix(backgroundTex)))->unref();
110 context->drawRect(paint, srcRect); 110 context->drawRect(paint, srcRect);
111 paint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblend(dm)); 111 paint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblend(dm));
112 paint.colorStage(0)->setEffect( 112 paint.colorStage(0)->setEffect(
113 GrSimpleTextureEffect::Create(foregroundTex, GrEffect::MakeDivByText ureWHMatrix(foregroundTex)))->unref(); 113 GrSimpleTextureEffect::Create(foregroundTex, GrEffect::MakeDivByText ureWHMatrix(foregroundTex)))->unref();
114 context->drawRect(paint, srcRect); 114 context->drawRect(paint, srcRect);
115 } 115 }
116 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul t); 116 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul t);
117 } 117 }
118 118
119 #endif 119 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698