Update SkSurface MakeFromBackend* factories to take an SkColorType.
Bug: skia:
Change-Id: Ib1b03b1181ec937843eac2e8d8cb03ebe53e32c1
Reviewed-on: https://skia-review.googlesource.com/86760
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/tests/BlendTest.cpp b/tests/BlendTest.cpp
index 52f41dc..bf985aa 100644
--- a/tests/BlendTest.cpp
+++ b/tests/BlendTest.cpp
@@ -84,8 +84,8 @@
#if SK_SUPPORT_GPU
namespace {
static sk_sp<SkSurface> create_gpu_surface_backend_texture_as_render_target(
- GrContext* context, int sampleCnt, int width, int height, GrPixelConfig config,
- GrSurfaceOrigin origin,
+ GrContext* context, int sampleCnt, int width, int height, SkColorType colorType,
+ GrPixelConfig config, GrSurfaceOrigin origin,
sk_sp<GrTexture>* backingSurface) {
GrSurfaceDesc backingDesc;
backingDesc.fFlags = kRenderTarget_GrSurfaceFlag;
@@ -104,7 +104,7 @@
sk_sp<SkSurface> surface =
SkSurface::MakeFromBackendTextureAsRenderTarget(context, backendTex, origin,
- sampleCnt, nullptr, nullptr);
+ sampleCnt, colorType, nullptr, nullptr);
return surface;
}
@@ -158,7 +158,7 @@
sk_sp<GrTexture> backingSurface;
// BGRA forces a framebuffer blit on ES2.
sk_sp<SkSurface> surface = create_gpu_surface_backend_texture_as_render_target(
- context, sampleCnt, kWidth, kHeight, kConfig, origin, &backingSurface);
+ context, sampleCnt, kWidth, kHeight, kColorType, kConfig, origin, &backingSurface);
if (!surface && sampleCnt > 0) {
// Some platforms don't support MSAA.
diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp
index 91fba5f..0ff0d2c 100644
--- a/tests/GrMipMappedTest.cpp
+++ b/tests/GrMipMappedTest.cpp
@@ -53,6 +53,7 @@
backendTex,
kTopLeft_GrSurfaceOrigin,
0,
+ kRGBA_8888_SkColorType,
nullptr,
nullptr);
@@ -221,6 +222,7 @@
backendTex,
kTopLeft_GrSurfaceOrigin,
0,
+ kRGBA_8888_SkColorType,
nullptr,
nullptr);
} else {
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 4b58664..0864e32 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -598,6 +598,7 @@
sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTexture(context, *outTexture,
kTopLeft_GrSurfaceOrigin, sampleCnt,
+ kRGBA_8888_SkColorType,
nullptr, nullptr);
if (!surface) {
context->getGpu()->deleteTestingOnlyBackendTexture(outTexture);
@@ -621,7 +622,8 @@
}
sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTextureAsRenderTarget(
- context, *outTexture, kTopLeft_GrSurfaceOrigin, sampleCnt, nullptr, nullptr);
+ context, *outTexture, kTopLeft_GrSurfaceOrigin, sampleCnt, kRGBA_8888_SkColorType,
+ nullptr, nullptr);
if (!surface) {
context->getGpu()->deleteTestingOnlyBackendTexture(outTexture);
@@ -894,6 +896,7 @@
return SkSurface::MakeFromBackendTexture(context, backendTex,
kTopLeft_GrSurfaceOrigin, 0,
+ info.colorType(),
sk_ref_sp(info.colorSpace()), nullptr);
};
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index bfa0d4d..f909190 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -430,8 +430,14 @@
for (int sampleCnt : {0, 4}) {
GrBackendTexture backendTex = context->getGpu()->createTestingOnlyBackendTexture(
nullptr, DEV_W, DEV_H, kSkia8888_GrPixelConfig, true, GrMipMapped::kNo);
+ SkColorType colorType;
+ if (kRGBA_8888_GrPixelConfig == kSkia8888_GrPixelConfig) {
+ colorType = kRGBA_8888_SkColorType;
+ } else {
+ colorType = kBGRA_8888_SkColorType;
+ }
sk_sp<SkSurface> surface(SkSurface::MakeFromBackendTextureAsRenderTarget(
- context, backendTex, origin, sampleCnt, nullptr, nullptr));
+ context, backendTex, origin, sampleCnt, colorType, nullptr, nullptr));
if (!surface) {
context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
continue;