From 8458a2807b4a7220c9849f8032dc611438818641 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Mon, 4 Dec 2017 07:52:57 -0500 Subject: Add unit test for SkDeferredDisplayLists Change-Id: I015094145cb0af6cfe368c570a5d5280c11c8f28 Reviewed-on: https://skia-review.googlesource.com/78660 Reviewed-by: Brian Salomon Commit-Queue: Robert Phillips --- src/core/SkDeferredDisplayListRecorder.cpp | 3 ++- src/image/SkSurface.cpp | 2 +- src/image/SkSurface_Base.h | 2 +- src/image/SkSurface_Gpu.cpp | 10 +++++----- src/image/SkSurface_Gpu.h | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/core/SkDeferredDisplayListRecorder.cpp b/src/core/SkDeferredDisplayListRecorder.cpp index 18e516ab31..f6981e7535 100644 --- a/src/core/SkDeferredDisplayListRecorder.cpp +++ b/src/core/SkDeferredDisplayListRecorder.cpp @@ -43,6 +43,7 @@ std::unique_ptr SkDeferredDisplayListRecorder::detach() { // Placeholder. Ultimately, the SkSurface_Gpu will pass the wrapped opLists to its // renderTargetContext. -void SkDeferredDisplayList::draw(SkSurface* surface) { +bool SkDeferredDisplayList::draw(SkSurface* surface) { surface->getCanvas()->drawImage(fImage.get(), 0, 0); + return true; } diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp index 04e16f6281..9cef76f236 100644 --- a/src/image/SkSurface.cpp +++ b/src/image/SkSurface.cpp @@ -213,7 +213,7 @@ bool SkSurface::characterize(SkSurfaceCharacterization* characterization) const return asSB(const_cast(this))->onCharacterize(characterization); } -void SkSurface::draw(SkDeferredDisplayList* ddl) { +bool SkSurface::draw(SkDeferredDisplayList* ddl) { return asSB(this)->onDraw(ddl); } diff --git a/src/image/SkSurface_Base.h b/src/image/SkSurface_Base.h index e05d371cd8..b71d4c7043 100644 --- a/src/image/SkSurface_Base.h +++ b/src/image/SkSurface_Base.h @@ -95,7 +95,7 @@ public: } virtual bool onCharacterize(SkSurfaceCharacterization*) const { return false; } - virtual void onDraw(SkDeferredDisplayList*) { } + virtual bool onDraw(SkDeferredDisplayList*) { return false; } inline SkCanvas* getCachedCanvas(); inline sk_sp refCachedImage(); diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index 605f229023..dc1f308512 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -165,7 +165,7 @@ bool SkSurface_Gpu::onCharacterize(SkSurfaceCharacterization* data) const { GrContext* ctx = fDevice->context(); data->set(ctx->threadSafeProxy(), rtc->origin(), rtc->width(), rtc->height(), - rtc->colorSpaceInfo().config(), rtc->numColorSamples(), + rtc->colorSpaceInfo().config(), rtc->fsaaType(), rtc->numStencilSamples(), rtc->colorSpaceInfo().refColorSpace(), this->props()); return true; @@ -178,19 +178,19 @@ bool SkSurface_Gpu::isCompatible(const SkSurfaceCharacterization& data) const { return data.contextInfo() && data.contextInfo()->matches(ctx) && data.origin() == rtc->origin() && data.width() == rtc->width() && data.height() == rtc->height() && data.config() == rtc->colorSpaceInfo().config() && - data.sampleCount() == rtc->numColorSamples() && + data.fsaaType() == rtc->fsaaType() && data.stencilCount() == rtc->numStencilSamples() && SkColorSpace::Equals(data.colorSpace(), rtc->colorSpaceInfo().colorSpace()) && data.surfaceProps() == rtc->surfaceProps(); } -void SkSurface_Gpu::onDraw(SkDeferredDisplayList* dl) { +bool SkSurface_Gpu::onDraw(SkDeferredDisplayList* dl) { if (!this->isCompatible(dl->characterization())) { - return; + return false; } // Ultimately need to pass opLists from the DeferredDisplayList on to the // SkGpuDevice's renderTargetContext. - dl->draw(this); + return dl->draw(this); } diff --git a/src/image/SkSurface_Gpu.h b/src/image/SkSurface_Gpu.h index c95966370c..cb21771aa9 100644 --- a/src/image/SkSurface_Gpu.h +++ b/src/image/SkSurface_Gpu.h @@ -31,7 +31,7 @@ public: bool onWait(int numSemaphores, const GrBackendSemaphore* waitSemaphores) override; bool onCharacterize(SkSurfaceCharacterization*) const override; bool isCompatible(const SkSurfaceCharacterization&) const; - void onDraw(SkDeferredDisplayList*) override; + bool onDraw(SkDeferredDisplayList*) override; SkGpuDevice* getDevice() { return fDevice.get(); } -- cgit v1.2.3