diff options
author | Robert Phillips <robertphillips@google.com> | 2018-02-13 17:03:00 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-14 12:42:18 +0000 |
commit | fc711a2b0143aa4f559ef041068af1c04d7dab85 (patch) | |
tree | 3cd87b121b87566b9837112badccd5aa958f75f5 /src/image | |
parent | 6ce969472e2ede1e3d6549579c095a12c2d576ca (diff) |
Add SkCharacterization creation helper to GrContextThreadSafeProxy (take 2)
TBR=bsalomon@google.com
Change-Id: Id96d4fdbb6889065f10a4a7e0c22a03ad9aa5fef
Reviewed-on: https://skia-review.googlesource.com/107000
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/image')
-rw-r--r-- | src/image/SkSurface_Gpu.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index 03780c099e..78dcd59e54 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -174,7 +174,7 @@ bool SkSurface_Gpu::onCharacterize(SkSurfaceCharacterization* data) const { bool mipmapped = rtc->asTextureProxy() ? GrMipMapped::kYes == rtc->asTextureProxy()->mipMapped() : false; - data->set(ctx->threadSafeProxy(), maxResourceCount, maxResourceBytes, + data->set(ctx->threadSafeProxy(), maxResourceBytes, rtc->origin(), rtc->width(), rtc->height(), rtc->colorSpaceInfo().config(), rtc->fsaaType(), rtc->numStencilSamples(), SkSurfaceCharacterization::Textureable(SkToBool(rtc->asTextureProxy())), @@ -188,8 +188,13 @@ bool SkSurface_Gpu::isCompatible(const SkSurfaceCharacterization& data) const { GrRenderTargetContext* rtc = fDevice->accessRenderTargetContext(); GrContext* ctx = fDevice->context(); + if (!data.isValid()) { + return false; + } + // As long as the current state if the context allows for greater or equal resources, // we allow the DDL to be replayed. + // DDL TODO: should we just remove the resource check and ignore the cache limits on playback? int maxResourceCount; size_t maxResourceBytes; ctx->getResourceCacheLimits(&maxResourceCount, &maxResourceBytes); @@ -210,7 +215,6 @@ bool SkSurface_Gpu::isCompatible(const SkSurfaceCharacterization& data) const { } return data.contextInfo() && data.contextInfo()->matches(ctx) && - data.cacheMaxResourceCount() <= maxResourceCount && data.cacheMaxResourceBytes() <= maxResourceBytes && data.origin() == rtc->origin() && data.width() == rtc->width() && data.height() == rtc->height() && data.config() == rtc->colorSpaceInfo().config() && @@ -220,7 +224,7 @@ bool SkSurface_Gpu::isCompatible(const SkSurfaceCharacterization& data) const { } bool SkSurface_Gpu::onDraw(const SkDeferredDisplayList* ddl) { - if (!this->isCompatible(ddl->characterization())) { + if (!ddl || !this->isCompatible(ddl->characterization())) { return false; } |