Add support for GL 565 and 4444 configs to test tools
Change-Id: I395e3387df44cf5370fef6ab73db73228225622f
Reviewed-on: https://skia-review.googlesource.com/23946
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 6c441d9..ad9752d 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1300,15 +1300,17 @@
int samples,
bool diText,
SkColorType colorType,
+ SkAlphaType alphaType,
sk_sp<SkColorSpace> colorSpace,
bool threaded)
- : fContextType(ct)
- , fContextOverrides(overrides)
- , fSampleCount(samples)
- , fUseDIText(diText)
- , fColorType(colorType)
- , fColorSpace(std::move(colorSpace))
- , fThreaded(threaded) {}
+ : fContextType(ct)
+ , fContextOverrides(overrides)
+ , fSampleCount(samples)
+ , fUseDIText(diText)
+ , fColorType(colorType)
+ , fAlphaType(alphaType)
+ , fColorSpace(std::move(colorSpace))
+ , fThreaded(threaded) {}
DEFINE_bool(drawOpClip, false, "Clip each GrDrawOp to its device bounds for testing.");
@@ -1319,9 +1321,8 @@
GrContextFactory factory(grOptions);
const SkISize size = src.size();
- const SkImageInfo info =
- SkImageInfo::Make(size.width(), size.height(), fColorType,
- kPremul_SkAlphaType, fColorSpace);
+ SkImageInfo info =
+ SkImageInfo::Make(size.width(), size.height(), fColorType, fAlphaType, fColorSpace);
#if SK_SUPPORT_GPU
GrContext* context = factory.getContextInfo(fContextType, fContextOverrides).grContext();
const int maxDimension = context->caps()->maxTextureSize();
@@ -1348,6 +1349,12 @@
canvas->getGrContext()->dumpCacheStats(log);
canvas->getGrContext()->dumpGpuStats(log);
}
+ if (info.colorType() == kRGB_565_SkColorType || info.colorType() == kARGB_4444_SkColorType) {
+ // We don't currently support readbacks into these formats on the GPU backend. Convert to
+ // 32 bit.
+ info = SkImageInfo::Make(size.width(), size.height(), kRGBA_8888_SkColorType,
+ kPremul_SkAlphaType, fColorSpace);
+ }
dst->allocPixels(info);
canvas->readPixels(*dst, 0, 0);
if (FLAGS_abandonGpuContext) {