| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 offset->fX = bounds.left(); | 348 offset->fX = bounds.left(); |
| 349 offset->fY = bounds.top(); | 349 offset->fY = bounds.top(); |
| 350 bounds.offset(-srcOffset); | 350 bounds.offset(-srcOffset); |
| 351 SkMatrix matrix(ctx.ctm()); | 351 SkMatrix matrix(ctx.ctm()); |
| 352 matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.to
p())); | 352 matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.to
p())); |
| 353 GrPaint paint; | 353 GrPaint paint; |
| 354 if (this->asFragmentProcessor(&fp, srcTexture, matrix, bounds)) { | 354 if (this->asFragmentProcessor(&fp, srcTexture, matrix, bounds)) { |
| 355 SkASSERT(fp); | 355 SkASSERT(fp); |
| 356 paint.addColorFragmentProcessor(fp)->unref(); | 356 paint.addColorFragmentProcessor(fp)->unref(); |
| 357 | 357 |
| 358 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext()); | 358 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(dst->asRend
erTarget())); |
| 359 if (drawContext) { | 359 if (drawContext) { |
| 360 drawContext->drawNonAARectToRect(dst->asRenderTarget(), clip, paint,
SkMatrix::I(), | 360 drawContext->drawNonAARectToRect(clip, paint, SkMatrix::I(), dstRect
, srcRect); |
| 361 dstRect, srcRect); | |
| 362 | 361 |
| 363 WrapTexture(dst, bounds.width(), bounds.height(), result); | 362 WrapTexture(dst, bounds.width(), bounds.height(), result); |
| 364 return true; | 363 return true; |
| 365 } | 364 } |
| 366 } | 365 } |
| 367 #endif | 366 #endif |
| 368 return false; | 367 return false; |
| 369 } | 368 } |
| 370 | 369 |
| 371 bool SkImageFilter::applyCropRect(const Context& ctx, const SkBitmap& src, | 370 bool SkImageFilter::applyCropRect(const Context& ctx, const SkBitmap& src, |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 } | 598 } |
| 600 return dev; | 599 return dev; |
| 601 } | 600 } |
| 602 | 601 |
| 603 bool SkImageFilter::DeviceProxy::filterImage(const SkImageFilter* filter, const
SkBitmap& src, | 602 bool SkImageFilter::DeviceProxy::filterImage(const SkImageFilter* filter, const
SkBitmap& src, |
| 604 const SkImageFilter::Context& ctx, | 603 const SkImageFilter::Context& ctx, |
| 605 SkBitmap* result, SkIPoint* offset) { | 604 SkBitmap* result, SkIPoint* offset) { |
| 606 return fDevice->filterImage(filter, src, ctx, result, offset); | 605 return fDevice->filterImage(filter, src, ctx, result, offset); |
| 607 } | 606 } |
| 608 | 607 |
| OLD | NEW |