aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-12-04 07:52:57 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-04 14:00:14 +0000
commit8458a2807b4a7220c9849f8032dc611438818641 (patch)
tree0df3c0e936ac88c986f413fc1873fd754b4c1de2 /src
parent0c56d47b7e288eacb5dae3560f478b0d8a4896a3 (diff)
Add unit test for SkDeferredDisplayLists
Change-Id: I015094145cb0af6cfe368c570a5d5280c11c8f28 Reviewed-on: https://skia-review.googlesource.com/78660 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkDeferredDisplayListRecorder.cpp3
-rw-r--r--src/image/SkSurface.cpp2
-rw-r--r--src/image/SkSurface_Base.h2
-rw-r--r--src/image/SkSurface_Gpu.cpp10
-rw-r--r--src/image/SkSurface_Gpu.h2
5 files changed, 10 insertions, 9 deletions
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<SkDeferredDisplayList> 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<SkSurface*>(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<SkImage> 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(); }