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

Unified Diff: src/core/SkCanvas.cpp

Issue 1920733003: share code with drawSpriteWithFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 7552626057a2095c75de041774c1225faf681a45..3924260f809468a77d45bd93ae6264ec56af3572 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1450,31 +1450,8 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
SkImageFilter* filter = paint->getImageFilter();
SkIPoint pos = { x - iter.getX(), y - iter.getY() };
if (filter) {
- SkIPoint offset = SkIPoint::Make(0, 0);
const SkBitmap& srcBM = srcDev->accessBitmap(false);
- SkMatrix matrix = *iter.fMatrix;
- matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y()));
- const SkIRect clipBounds = iter.fClip->getBounds().makeOffset(-pos.x(), -pos.y());
- SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache());
- SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
-
- sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(srcBM,
- &dstDev->surfaceProps()));
- if (!srcImg) {
- continue; // something disastrous happened
- }
-
- sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &offset));
- if (resultImg) {
- SkPaint tmpUnfiltered(*paint);
- tmpUnfiltered.setImageFilter(nullptr);
- SkBitmap resultBM;
- if (resultImg->internal_getBM(&resultBM)) {
- // TODO: add drawSprite(SkSpecialImage) to SkDevice? (see skbug.com/5073)
- dstDev->drawSprite(iter, resultBM, pos.x() + offset.x(), pos.y() + offset.y(),
- tmpUnfiltered);
- }
- }
+ dstDev->drawSpriteWithFilter(iter, srcBM, pos.x(), pos.y(), *paint);
} else if (deviceIsBitmapDevice) {
const SkBitmap& src = static_cast<SkBitmapDevice*>(srcDev)->fBitmap;
dstDev->drawSprite(iter, src, pos.x(), pos.y(), *paint);
« 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