diff options
author | Greg Daniel <egdaniel@google.com> | 2017-10-23 16:05:23 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-23 20:25:59 +0000 |
commit | e252f08982b0c747cd4d34c00ce413ab1005e99a (patch) | |
tree | 1fde0a4ac30cf4dc1fc752ef39fc2a0b905be210 /include | |
parent | 33397f279393a33eff8e32d47fc56be86b86c9bc (diff) |
Add hint to SkSurface::MakeRenderTarget that we will use mips
Additionally this changed triggered a cascade of plumbing GrMipMapped
down throughout Ganesh.
Bug: skia:
Change-Id: I4181f44d9046d66139bb491c7abf86703305aaeb
Reviewed-on: https://skia-review.googlesource.com/63000
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkSurface.h | 7 | ||||
-rw-r--r-- | include/gpu/GrSurface.h | 2 | ||||
-rw-r--r-- | include/private/GrSurfaceProxy.h | 4 | ||||
-rw-r--r-- | include/private/GrTextureProxy.h | 4 |
4 files changed, 10 insertions, 7 deletions
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h index 890532f983..dca38ceea5 100644 --- a/include/core/SkSurface.h +++ b/include/core/SkSurface.h @@ -116,11 +116,14 @@ public: /** * Return a new surface whose contents will be drawn to an offscreen - * render target, allocated by the surface. + * render target, allocated by the surface. The optional shouldCreateWithMips flag is a hint + * that this surface may be snapped to an SkImage which will be used with mip maps so we should + * create the backend gpu RenderTarget with mips to avoid a copy later on. */ static sk_sp<SkSurface> MakeRenderTarget(GrContext*, SkBudgeted, const SkImageInfo&, int sampleCount, GrSurfaceOrigin, - const SkSurfaceProps*); + const SkSurfaceProps*, + bool shouldCreateWithMips = false); static sk_sp<SkSurface> MakeRenderTarget(GrContext* context, SkBudgeted budgeted, const SkImageInfo& info, int sampleCount, diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h index 65ac7ec337..1056bdd224 100644 --- a/include/gpu/GrSurface.h +++ b/include/gpu/GrSurface.h @@ -61,7 +61,7 @@ public: static size_t WorstCaseSize(const GrSurfaceDesc& desc, bool useNextPow2 = false); static size_t ComputeSize(GrPixelConfig config, int width, int height, int colorSamplesPerPixel, - bool hasMIPMaps, bool useNextPow2 = false); + GrMipMapped, bool useNextPow2 = false); protected: // Methods made available via GrSurfacePriv diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h index fcccd36b44..2bbf02a20f 100644 --- a/include/private/GrSurfaceProxy.h +++ b/include/private/GrSurfaceProxy.h @@ -384,11 +384,11 @@ protected: void assign(sk_sp<GrSurface> surface); sk_sp<GrSurface> createSurfaceImpl(GrResourceProvider*, int sampleCnt, bool needsStencil, - GrSurfaceFlags flags, bool isMipMapped, + GrSurfaceFlags flags, GrMipMapped mipMapped, SkDestinationSurfaceColorMode mipColorMode) const; bool instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt, bool needsStencil, - GrSurfaceFlags flags, bool isMipMapped, + GrSurfaceFlags flags, GrMipMapped mipMapped, SkDestinationSurfaceColorMode mipColorMode, const GrUniqueKey*); // For wrapped resources, 'fConfig', 'fWidth', 'fHeight', and 'fOrigin; will always be filled in diff --git a/include/private/GrTextureProxy.h b/include/private/GrTextureProxy.h index e841baeb1f..a761dca0c2 100644 --- a/include/private/GrTextureProxy.h +++ b/include/private/GrTextureProxy.h @@ -37,7 +37,7 @@ public: } } - bool isMipMapped() const { return fIsMipMapped; } + GrMipMapped mipMapped() const { return fMipMapped; } /** * Return the texture proxy's unique key. It will be invalid if the proxy doesn't have one. @@ -85,7 +85,7 @@ protected: sk_sp<GrSurface> createSurface(GrResourceProvider*) const override; private: - bool fIsMipMapped; + GrMipMapped fMipMapped; SkDestinationSurfaceColorMode fMipColorMode; GrUniqueKey fUniqueKey; |