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

Unified Diff: src/effects/SkLightingImageFilter.cpp

Issue 1414843003: Image filters: Replace all use of tryAllocPixels() with createDevice(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix morphology: don't allocate dest or temp until we need them Created 5 years, 2 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 | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkMagnifierImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkLightingImageFilter.cpp
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 199bb4d684f8e3ab842f1f44d22126e8b3f75197..bac83e537dc9ce9c8292743234ea036d56e18ad8 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -8,6 +8,7 @@
#include "SkLightingImageFilter.h"
#include "SkBitmap.h"
#include "SkColorPriv.h"
+#include "SkDevice.h"
#include "SkPoint3.h"
#include "SkReadBuffer.h"
#include "SkTypes.h"
@@ -1190,9 +1191,12 @@ bool SkDiffuseLightingImageFilter::onFilterImage(Proxy* proxy,
return false;
}
- if (!dst->tryAllocPixels(src.info().makeWH(bounds.width(), bounds.height()))) {
+ SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds.height()));
+ if (!device) {
return false;
}
+ *dst = device->accessBitmap(false);
+ SkAutoLockPixels alp_dst(*dst);
SkMatrix matrix(ctx.ctm());
matrix.postTranslate(SkIntToScalar(-srcOffset.x()), SkIntToScalar(-srcOffset.y()));
@@ -1331,9 +1335,12 @@ bool SkSpecularLightingImageFilter::onFilterImage(Proxy* proxy,
return false;
}
- if (!dst->tryAllocPixels(src.info().makeWH(bounds.width(), bounds.height()))) {
+ SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds.height()));
+ if (!device) {
return false;
}
+ *dst = device->accessBitmap(false);
+ SkAutoLockPixels alp_dst(*dst);
SpecularLightingType lightingType(fKS, fShininess);
offset->fX = bounds.left();
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkMagnifierImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698