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

Unified Diff: src/core/SkSpecialImage.cpp

Issue 1772933002: Switch SkImageSource image filter over to new onFilterImage interface (Closed) Base URL: https://skia.googlesource.com/skia.git@if-follow-on
Patch Set: update to ToT again Created 4 years, 9 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/core/SkSpecialImage.h ('k') | src/effects/SkImageSource.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkSpecialImage.cpp
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index a81e384eedbfd6b71cdceb00fa05139a7b99d42d..f5f88329c4a3bf86e5f21b252279ffdb53108918 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -138,11 +138,25 @@ public:
GrTexture* onPeekTexture() const override { return as_IB(fImage.get())->peekTexture(); }
bool getBitmapDeprecated(SkBitmap* result) const override {
- return false;
+#if SK_SUPPORT_GPU
+ if (GrTexture* texture = as_IB(fImage.get())->peekTexture()) {
+ const SkImageInfo info = GrMakeInfoFromTexture(texture,
+ fImage->width(), fImage->height(),
+ fImage->isOpaque());
+ if (!result->setInfo(info)) {
+ return false;
+ }
+
+ result->setPixelRef(new SkGrPixelRef(info, texture))->unref();
+ return true;
+ }
+#endif
+
+ return as_IB(fImage.get())->asBitmapForImageFilters(result);
}
bool testingOnlyOnGetROPixels(SkBitmap* result) const override {
- return false;
+ return fImage->asLegacyBitmap(result, SkImage::kRO_LegacyBitmapMode);
}
SkSpecialSurface* onNewSurface(const SkImageInfo& info) const override {
@@ -178,9 +192,11 @@ static bool rect_fits(const SkIRect& rect, int width, int height) {
}
#endif
-SkSpecialImage* SkSpecialImage::NewFromImage(const SkIRect& subset, const SkImage* image) {
+SkSpecialImage* SkSpecialImage::NewFromImage(SkImageFilter::Proxy* proxy,
+ const SkIRect& subset,
+ const SkImage* image) {
SkASSERT(rect_fits(subset, image->width(), image->height()));
- return new SkSpecialImage_Image(nullptr, subset, image);
+ return new SkSpecialImage_Image(proxy, subset, image);
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/core/SkSpecialImage.h ('k') | src/effects/SkImageSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698