Apply the layer's image filter to the hoisted image
Exposing SkSurface_Gpu makes me sad and I would welcome alternatives.
This change is desireable since it greatly decreases the render target swaps.
Review URL: https://codereview.chromium.org/792923002
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 8487094..e58375b 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -10,30 +10,10 @@
#include "SkImage_Base.h"
#include "SkCanvas.h"
#include "SkGpuDevice.h"
+#include "SkSurface_Gpu.h"
#if SK_SUPPORT_GPU
-class SkSurface_Gpu : public SkSurface_Base {
-public:
- SK_DECLARE_INST_COUNT(SkSurface_Gpu)
-
- SkSurface_Gpu(GrRenderTarget*, const SkSurfaceProps*, bool doClear);
- virtual ~SkSurface_Gpu();
-
- virtual SkCanvas* onNewCanvas() SK_OVERRIDE;
- virtual SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE;
- virtual SkImage* onNewImageSnapshot() SK_OVERRIDE;
- virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y,
- const SkPaint*) SK_OVERRIDE;
- virtual void onCopyOnWrite(ContentChangeMode) SK_OVERRIDE;
- virtual void onDiscard() SK_OVERRIDE;
-
-private:
- SkGpuDevice* fDevice;
-
- typedef SkSurface_Base INHERITED;
-};
-
///////////////////////////////////////////////////////////////////////////////
SkSurface_Gpu::SkSurface_Gpu(GrRenderTarget* renderTarget, const SkSurfaceProps* props,
diff --git a/src/image/SkSurface_Gpu.h b/src/image/SkSurface_Gpu.h
new file mode 100644
index 0000000..a02eb3e
--- /dev/null
+++ b/src/image/SkSurface_Gpu.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkSurface_Gpu_DEFINED
+#define SkSurface_Gpu_DEFINED
+
+#include "SkSurface_Base.h"
+
+#if SK_SUPPORT_GPU
+
+class SkGpuDevice;
+
+class SkSurface_Gpu : public SkSurface_Base {
+public:
+ SK_DECLARE_INST_COUNT(SkSurface_Gpu)
+
+ SkSurface_Gpu(GrRenderTarget*, const SkSurfaceProps*, bool doClear);
+ virtual ~SkSurface_Gpu();
+
+ virtual SkCanvas* onNewCanvas() SK_OVERRIDE;
+ virtual SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE;
+ virtual SkImage* onNewImageSnapshot() SK_OVERRIDE;
+ virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y,
+ const SkPaint*) SK_OVERRIDE;
+ virtual void onCopyOnWrite(ContentChangeMode) SK_OVERRIDE;
+ virtual void onDiscard() SK_OVERRIDE;
+
+ SkGpuDevice* getDevice() { return fDevice; }
+
+private:
+ SkGpuDevice* fDevice;
+
+ typedef SkSurface_Base INHERITED;
+};
+
+#endif // SK_SUPPORT_GPU
+
+#endif // SkSurface_Gpu_DEFINED