| OLD | NEW |
| 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 Loading... |
| 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); |
| 207 GrPaint paint; | 208 GrPaint paint; |
| 208 paint.addColorEffect(effect)->unref(); | 209 paint.addColorEffect(effect); |
| 209 context->drawRectToRect(paint, dstRect, srcRect); | 210 context->drawRectToRect(paint, dstRect, srcRect); |
| 210 | 211 |
| 211 SkAutoTUnref<GrTexture> resultTex(dst.detach()); | 212 SkAutoTUnref<GrTexture> resultTex(dst.detach()); |
| 212 WrapTexture(resultTex, bounds.width(), bounds.height(), result); | 213 WrapTexture(resultTex, bounds.width(), bounds.height(), result); |
| 213 return true; | 214 return true; |
| 214 #else | 215 #else |
| 215 return false; | 216 return false; |
| 216 #endif | 217 #endif |
| 217 } | 218 } |
| 218 | 219 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 bounds.join(rect); | 292 bounds.join(rect); |
| 292 } | 293 } |
| 293 } | 294 } |
| 294 | 295 |
| 295 // don't modify dst until now, so we don't accidentally change it in the | 296 // don't modify dst until now, so we don't accidentally change it in the |
| 296 // loop, but then return false on the next filter. | 297 // loop, but then return false on the next filter. |
| 297 *dst = bounds; | 298 *dst = bounds; |
| 298 return true; | 299 return true; |
| 299 } | 300 } |
| 300 | 301 |
| 301 bool SkImageFilter::asNewEffect(GrEffect**, GrTexture*, const SkMatrix&, const S
kIRect&) const { | 302 bool SkImageFilter::asNewEffect(GrEffectRef**, GrTexture*, const SkMatrix&, cons
t SkIRect&) const { |
| 302 return false; | 303 return false; |
| 303 } | 304 } |
| 304 | 305 |
| 305 bool SkImageFilter::asColorFilter(SkColorFilter**) const { | 306 bool SkImageFilter::asColorFilter(SkColorFilter**) const { |
| 306 return false; | 307 return false; |
| 307 } | 308 } |
| 308 | 309 |
| 309 void SkImageFilter::SetExternalCache(Cache* cache) { | 310 void SkImageFilter::SetExternalCache(Cache* cache) { |
| 310 SkRefCnt_SafeAssign(gExternalCache, cache); | 311 SkRefCnt_SafeAssign(gExternalCache, cache); |
| 311 } | 312 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 | 433 |
| 433 CacheImpl::~CacheImpl() { | 434 CacheImpl::~CacheImpl() { |
| 434 SkTDynamicHash<Value, Key>::Iter iter(&fData); | 435 SkTDynamicHash<Value, Key>::Iter iter(&fData); |
| 435 | 436 |
| 436 while (!iter.done()) { | 437 while (!iter.done()) { |
| 437 Value* v = &*iter; | 438 Value* v = &*iter; |
| 438 ++iter; | 439 ++iter; |
| 439 delete v; | 440 delete v; |
| 440 } | 441 } |
| 441 } | 442 } |
| OLD | NEW |