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

Side by Side Diff: src/core/SkImageFilter.cpp

Issue 377503004: Make GrDrawState and GrPaint take GrEffect* instead of GrEffectRef*. (Closed) Base URL: https://skia.googlesource.com/skia.git@no_ref
Patch Set: Update YUV effect to reflect these changes. Created 6 years, 5 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
« no previous file with comments | « src/core/SkColorFilter.cpp ('k') | src/core/SkLocalMatrixShader.h » ('j') | 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 2012 The Android Open Source Project 2 * Copyright 2012 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 "SkImageFilter.h" 8 #include "SkImageFilter.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 GrContext::AutoRenderTarget art(context, dst.texture()->asRenderTarget()); 197 GrContext::AutoRenderTarget art(context, dst.texture()->asRenderTarget());
198 GrContext::AutoClip acs(context, dstRect); 198 GrContext::AutoClip acs(context, dstRect);
199 GrEffectRef* effect; 199 GrEffectRef* effect;
200 offset->fX = bounds.left(); 200 offset->fX = bounds.left();
201 offset->fY = bounds.top(); 201 offset->fY = bounds.top();
202 bounds.offset(-srcOffset); 202 bounds.offset(-srcOffset);
203 SkMatrix matrix(ctx.ctm()); 203 SkMatrix matrix(ctx.ctm());
204 matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.to p())); 204 matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.to p()));
205 this->asNewEffect(&effect, srcTexture, matrix, bounds); 205 this->asNewEffect(&effect, srcTexture, matrix, bounds);
206 SkASSERT(effect); 206 SkASSERT(effect);
207 SkAutoUnref effectRef(effect);
208 GrPaint paint; 207 GrPaint paint;
209 paint.addColorEffect(effect); 208 paint.addColorEffect(effect)->unref();
210 context->drawRectToRect(paint, dstRect, srcRect); 209 context->drawRectToRect(paint, dstRect, srcRect);
211 210
212 SkAutoTUnref<GrTexture> resultTex(dst.detach()); 211 SkAutoTUnref<GrTexture> resultTex(dst.detach());
213 WrapTexture(resultTex, bounds.width(), bounds.height(), result); 212 WrapTexture(resultTex, bounds.width(), bounds.height(), result);
214 return true; 213 return true;
215 #else 214 #else
216 return false; 215 return false;
217 #endif 216 #endif
218 } 217 }
219 218
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 bounds.join(rect); 291 bounds.join(rect);
293 } 292 }
294 } 293 }
295 294
296 // don't modify dst until now, so we don't accidentally change it in the 295 // don't modify dst until now, so we don't accidentally change it in the
297 // loop, but then return false on the next filter. 296 // loop, but then return false on the next filter.
298 *dst = bounds; 297 *dst = bounds;
299 return true; 298 return true;
300 } 299 }
301 300
302 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&, cons t SkIRect&) const { 301 bool SkImageFilter::asNewEffect(GrEffect**, GrTexture*, const SkMatrix&, const S kIRect&) const {
303 return false; 302 return false;
304 } 303 }
305 304
306 bool SkImageFilter::asColorFilter(SkColorFilter**) const { 305 bool SkImageFilter::asColorFilter(SkColorFilter**) const {
307 return false; 306 return false;
308 } 307 }
309 308
310 void SkImageFilter::SetExternalCache(Cache* cache) { 309 void SkImageFilter::SetExternalCache(Cache* cache) {
311 SkRefCnt_SafeAssign(gExternalCache, cache); 310 SkRefCnt_SafeAssign(gExternalCache, cache);
312 } 311 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 432
434 CacheImpl::~CacheImpl() { 433 CacheImpl::~CacheImpl() {
435 SkTDynamicHash<Value, Key>::Iter iter(&fData); 434 SkTDynamicHash<Value, Key>::Iter iter(&fData);
436 435
437 while (!iter.done()) { 436 while (!iter.done()) {
438 Value* v = &*iter; 437 Value* v = &*iter;
439 ++iter; 438 ++iter;
440 delete v; 439 delete v;
441 } 440 }
442 } 441 }
OLDNEW
« no previous file with comments | « src/core/SkColorFilter.cpp ('k') | src/core/SkLocalMatrixShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698