aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/gpu/GrBackendSurface.h16
-rw-r--r--src/gpu/vk/GrVkGpu.cpp9
2 files changed, 19 insertions, 6 deletions
diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h
index bf1e52c959..c9d326bc36 100644
--- a/include/gpu/GrBackendSurface.h
+++ b/include/gpu/GrBackendSurface.h
@@ -51,7 +51,6 @@ public:
int width() const { return fWidth; }
int height() const { return fHeight; }
- GrPixelConfig config() const { return fConfig; }
bool hasMipMaps() const { return GrMipMapped::kYes == fMipMapped; }
GrBackend backend() const {return fBackend; }
@@ -73,6 +72,13 @@ public:
bool isValid() const { return fConfig != kUnknown_GrPixelConfig; }
private:
+ // Friending for access to the GrPixelConfig
+ friend class SkSurface;
+ friend class GrGpu;
+ friend class GrGLGpu;
+ friend class GrVkGpu;
+ GrPixelConfig config() const { return fConfig; }
+
int fWidth; //<! width in pixels
int fHeight; //<! height in pixels
GrPixelConfig fConfig;
@@ -109,7 +115,6 @@ public:
int height() const { return fHeight; }
int sampleCnt() const { return fSampleCnt; }
int stencilBits() const { return fStencilBits; }
- GrPixelConfig config() const { return fConfig; }
GrBackend backend() const {return fBackend; }
// If the backend API is GL, this returns a pointer to the GrGLFramebufferInfo struct. Otherwise
@@ -123,6 +128,13 @@ public:
#endif
private:
+ // Friending for access to the GrPixelConfig
+ friend class SkSurface;
+ friend class GrGpu;
+ friend class GrGLGpu;
+ friend class GrVkGpu;
+ GrPixelConfig config() const { return fConfig; }
+
int fWidth; //<! width in pixels
int fHeight; //<! height in pixels
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 198a00ed8e..a87c344d9a 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -888,7 +888,8 @@ bool GrVkGpu::updateBuffer(GrVkBuffer* buffer, const void* src,
////////////////////////////////////////////////////////////////////////////////
-static bool check_backend_texture(const GrBackendTexture& backendTex) {
+static bool check_backend_texture(const GrBackendTexture& backendTex,
+ GrPixelConfig config) {
const GrVkImageInfo* info = backendTex.getVkImageInfo();
if (!info) {
return false;
@@ -898,13 +899,13 @@ static bool check_backend_texture(const GrBackendTexture& backendTex) {
return false;
}
- SkASSERT(backendTex.config() == GrVkFormatToPixelConfig(info->fFormat));
+ SkASSERT(config == GrVkFormatToPixelConfig(info->fFormat));
return true;
}
sk_sp<GrTexture> GrVkGpu::onWrapBackendTexture(const GrBackendTexture& backendTex,
GrWrapOwnership ownership) {
- if (!check_backend_texture(backendTex)) {
+ if (!check_backend_texture(backendTex, backendTex.config())) {
return nullptr;
}
@@ -922,7 +923,7 @@ sk_sp<GrTexture> GrVkGpu::onWrapBackendTexture(const GrBackendTexture& backendTe
sk_sp<GrTexture> GrVkGpu::onWrapRenderableBackendTexture(const GrBackendTexture& backendTex,
int sampleCnt,
GrWrapOwnership ownership) {
- if (!check_backend_texture(backendTex)) {
+ if (!check_backend_texture(backendTex, backendTex.config())) {
return nullptr;
}