aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image/SkSurface_Gpu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/image/SkSurface_Gpu.cpp')
-rw-r--r--src/image/SkSurface_Gpu.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index a5acf4f95a..042fc32a67 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -15,11 +15,13 @@
#include "SkCanvas.h"
#include "SkColorSpace_Base.h"
+#include "SkDeferredDisplayList.h"
#include "SkGpuDevice.h"
#include "SkImage_Base.h"
#include "SkImage_Gpu.h"
#include "SkImagePriv.h"
#include "SkSurface_Base.h"
+#include "SkSurfaceCharacterization.h"
#if SK_SUPPORT_GPU
@@ -158,6 +160,35 @@ bool SkSurface_Gpu::onWait(int numSemaphores, const GrBackendSemaphore* waitSema
return fDevice->wait(numSemaphores, waitSemaphores);
}
+bool SkSurface_Gpu::onCharacterize(SkSurfaceCharacterization* data) const {
+ GrRenderTargetContext* rtc = fDevice->accessRenderTargetContext();
+
+ data->set(rtc->origin(), rtc->width(), rtc->height(),
+ rtc->config(), rtc->numColorSamples());
+ return true;
+}
+
+bool SkSurface_Gpu::isCompatible(const SkSurfaceCharacterization& data) const {
+ GrRenderTargetContext* rtc = fDevice->accessRenderTargetContext();
+
+ return data.origin() == rtc->origin() &&
+ data.width() == rtc->width() &&
+ data.height() == rtc->height() &&
+ data.config() == rtc->config() &&
+ data.sampleCount() == rtc->numColorSamples();
+}
+
+void SkSurface_Gpu::onDraw(SkDeferredDisplayList* dl) {
+ if (!this->isCompatible(dl->characterization())) {
+ return;
+ }
+
+ // Ultimately need to pass opLists from the DeferredDisplayList on to the
+ // SkGpuDevice's renderTargetContext.
+ dl->draw(this);
+}
+
+
///////////////////////////////////////////////////////////////////////////////
bool SkSurface_Gpu::Valid(const SkImageInfo& info) {