diff options
author | Greg Daniel <egdaniel@google.com> | 2017-12-18 14:48:15 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-18 21:17:46 +0000 |
commit | f5d8758f29390fd5c135df12bc8a5e196854eda2 (patch) | |
tree | a7de0b54b030dda4549bc9feb0a0e2ff65ded7d6 /include/gpu | |
parent | 4fafedd33add9948db1147c60d681ed9340984fd (diff) |
Add new SkImage factory to create from GrBackendTexture with SkColorType
Bug: skia:
Change-Id: I46bdc54b6d9cdacc8f5a06644aa6b110837879f0
Reviewed-on: https://skia-review.googlesource.com/84342
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include/gpu')
-rw-r--r-- | include/gpu/GrBackendSurface.h | 6 | ||||
-rw-r--r-- | include/gpu/GrCaps.h | 10 |
2 files changed, 16 insertions, 0 deletions
diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h index 1eab3577b1..9f77155e39 100644 --- a/include/gpu/GrBackendSurface.h +++ b/include/gpu/GrBackendSurface.h @@ -84,8 +84,11 @@ public: private: // Friending for access to the GrPixelConfig friend class SkSurface; + friend class GrCaps; friend class GrGpu; + friend class GrGLCaps; friend class GrGLGpu; + friend class GrVkCaps; friend class GrVkGpu; GrPixelConfig config() const { return fConfig; } @@ -146,8 +149,11 @@ public: private: // Friending for access to the GrPixelConfig friend class SkSurface; + friend class GrCaps; friend class GrGpu; + friend class GrGLCaps; friend class GrGLGpu; + friend class GrVkCaps; friend class GrVkGpu; GrPixelConfig config() const { return fConfig; } diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h index 6cdc0e3ff6..59e0528a23 100644 --- a/include/gpu/GrCaps.h +++ b/include/gpu/GrCaps.h @@ -11,9 +11,11 @@ #include "../private/GrTypesPriv.h" #include "GrBlend.h" #include "GrShaderCaps.h" +#include "SkImageInfo.h" #include "SkRefCnt.h" #include "SkString.h" +class GrBackendTexture; struct GrContextOptions; class GrRenderTargetProxy; class SkJSONWriter; @@ -170,6 +172,13 @@ public: virtual bool initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc, bool* rectsMustMatch, bool* disallowSubrect) const = 0; + /** + * Returns true if the GrBackendTexutre can we used with the supplied SkColorType. If it is + * compatible, the GrPixelConfig on the GrBackendTexture will be set to a config that matches + * the backend format and requested SkColorType. + */ + bool validateBackendTexture(GrBackendTexture* tex, SkColorType ct) const; + protected: /** Subclasses must call this at the end of their constructors in order to apply caps overrides requested by the client. Note that overrides will only reduce the caps never @@ -229,6 +238,7 @@ protected: int fMaxClipAnalyticFPs; private: + virtual bool onValidateBackendTexture(GrBackendTexture* tex, SkColorType ct) const = 0; virtual void onApplyOptionsOverrides(const GrContextOptions&) {} virtual void onDumpJSON(SkJSONWriter*) const {} |