aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-12-04 12:52:46 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-04 18:37:29 +0000
commit7ffbcf909d365eb22c5e22b776aeac7b7472fbf3 (patch)
treea71ca068a01ca87ea417f341adf4dee40c811d58 /src
parentbee6cacc54357e0af1de67d527fe51eb3602c2d6 (diff)
Add unit test for SkDeferredDisplayLists (take 2)
Change-Id: I76a4c77d5b9418cb7fe677bd55ba32a2e336924d Reviewed-on: https://skia-review.googlesource.com/79820 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/gpu/mock/GrMockCaps.h1
-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
6 files changed, 11 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/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h
index c4b9449a05..47a5002f96 100644
--- a/src/gpu/mock/GrMockCaps.h
+++ b/src/gpu/mock/GrMockCaps.h
@@ -28,6 +28,7 @@ public:
fShaderCaps->fIntegerSupport = options.fIntegerSupport;
fShaderCaps->fFlatInterpolationSupport = options.fFlatInterpolationSupport;
fShaderCaps->fMaxVertexSamplers = options.fMaxVertexSamplers;
+ fShaderCaps->fMaxFragmentSamplers = options.fMaxFragmentSamplers;
fShaderCaps->fShaderDerivativeSupport = options.fShaderDerivativeSupport;
this->applyOptionsOverrides(contextOptions);
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(); }