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

Unified Diff: include/core/SkImageFilter.h

Issue 1893993002: Revert of Remove deprecated paths from image filter infrastructure. (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 | « include/core/SkDevice.h ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImageFilter.h
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index 554f9f83355f46269fcd8e691a630d7c1ee96de0..dcd25bf91bf492f3b9c2937c7c778410be6153b0 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -116,6 +116,12 @@
virtual SkBaseDevice* createDevice(int width, int height,
TileUsage usage = kNever_TileUsage) = 0;
+
+ // Returns true if the proxy handled the filter itself. If this returns
+ // false then the filter's code will be called.
+ virtual bool filterImage(const SkImageFilter*, const SkBitmap& src,
+ const SkImageFilter::Context&,
+ SkBitmap* result, SkIPoint* offset) = 0;
};
class DeviceProxy : public Proxy {
@@ -124,6 +130,11 @@
SkBaseDevice* createDevice(int width, int height,
TileUsage usage = kNever_TileUsage) override;
+
+ // Returns true if the proxy handled the filter itself. If this returns
+ // false then the filter's code will be called.
+ bool filterImage(const SkImageFilter*, const SkBitmap& src, const SkImageFilter::Context&,
+ SkBitmap* result, SkIPoint* offset) override;
private:
SkBaseDevice* fDevice;
@@ -164,6 +175,31 @@
SkIRect filterBounds(const SkIRect& src, const SkMatrix& ctm,
MapDirection = kReverse_MapDirection) const;
+ /**
+ * Returns true if the filter can be processed on the GPU. This is most
+ * often used for multi-pass effects, where intermediate results must be
+ * rendered to textures. For single-pass effects, use asFragmentProcessor().
+ * The default implementation returns asFragmentProcessor(NULL, NULL, SkMatrix::I(),
+ * SkIRect()).
+ */
+ virtual bool canFilterImageGPU() const { return false; }
+
+ /**
+ * Process this image filter on the GPU. This is most often used for
+ * multi-pass effects, where intermediate results must be rendered to
+ * textures. For single-pass effects, use asFragmentProcessor(). src is the
+ * source image for processing, as a texture-backed bitmap. result is
+ * the destination bitmap, which should contain a texture-backed pixelref
+ * on success. offset is the amount to translate the resulting image
+ * relative to the src when it is drawn. The default implementation does
+ * single-pass processing using asFragmentProcessor().
+ */
+ virtual bool filterImageGPUDeprecated(Proxy*, const SkBitmap&, const Context&,
+ SkBitmap*, SkIPoint*) const {
+ SkASSERT(false);
+ return false;
+ }
+
#if SK_SUPPORT_GPU
static sk_sp<SkSpecialImage> DrawWithFP(GrContext* context,
sk_sp<GrFragmentProcessor> fp,
@@ -261,6 +297,18 @@
SkSpecialImage* src,
const Context&,
SkIPoint* offset) const;
+
+#if SK_SUPPORT_GPU
+ // Helper function which invokes GPU filter processing on the
+ // input at the specified "index". If the input is null, it leaves
+ // "result" and "offset" untouched, and returns true. If the input
+ // has a GPU implementation, it will be invoked directly.
+ // Otherwise, the filter will be processed in software and
+ // uploaded to the GPU.
+ bool filterInputGPUDeprecated(int index, SkImageFilter::Proxy* proxy,
+ const SkBitmap& src, const Context&,
+ SkBitmap* result, SkIPoint* offset) const;
+#endif
SK_TO_STRING_PUREVIRT()
SK_DEFINE_FLATTENABLE_TYPE(SkImageFilter)
@@ -392,6 +440,9 @@
* which are not capable of processing a smaller source bitmap into a
* larger destination.
*/
+ bool applyCropRectDeprecated(const Context&, Proxy* proxy, const SkBitmap& src,
+ SkIPoint* srcOffset, SkIRect* bounds, SkBitmap* result) const;
+
sk_sp<SkSpecialImage> applyCropRect(const Context&, SkSpecialImage* src, SkIPoint* srcOffset,
SkIRect* bounds) const;
« no previous file with comments | « include/core/SkDevice.h ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698