From 19eaf2dbe785a06b76f11c2066c302f0aa89d5d2 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Mon, 19 Mar 2018 16:06:44 -0400 Subject: Revert "Revert "New read pixels implementation that is simpler but does all conversions on CPU."" This reverts commit be5947c2f38a79b7c709accfb1047d8fd06a0227. Bug: skia: Change-Id: I06dc15b31042d7827511d0ac2a7f4262c3f09622 Reviewed-on: https://skia-review.googlesource.com/115079 Reviewed-by: Mike Klein Commit-Queue: Brian Salomon --- tests/PackedConfigsTextureTest.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'tests/PackedConfigsTextureTest.cpp') diff --git a/tests/PackedConfigsTextureTest.cpp b/tests/PackedConfigsTextureTest.cpp index b1fbc77977..5f18ef3d57 100644 --- a/tests/PackedConfigsTextureTest.cpp +++ b/tests/PackedConfigsTextureTest.cpp @@ -97,7 +97,7 @@ static void check_565(skiatest::Reporter* reporter, } static void run_test(skiatest::Reporter* reporter, GrContext* context, int arraySize, - GrColorType colorType) { + SkColorType colorType) { SkTDArray controlPixelData; // We will read back into an 8888 buffer since 565/4444 read backs aren't supported SkTDArray readBuffer; @@ -113,19 +113,24 @@ static void run_test(skiatest::Reporter* reporter, GrContext* context, int array kRGBA_8888_SkColorType, kOpaque_SkAlphaType); for (auto origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) { - auto proxy = sk_gpu_test::MakeTextureProxyFromData(context, false, DEV_W, DEV_H, colorType, + auto proxy = sk_gpu_test::MakeTextureProxyFromData(context, false, DEV_W, DEV_H, + SkColorTypeToGrColorType(colorType), origin, controlPixelData.begin(), 0); SkASSERT(proxy); sk_sp sContext = context->contextPriv().makeWrappedSurfaceContext( std::move(proxy)); - SkAssertResult(sContext->readPixels(dstInfo, readBuffer.begin(), 0, 0, 0)); + if (!sContext->readPixels(dstInfo, readBuffer.begin(), 0, 0, 0)) { + // We only require this to succeed if the format is renderable. + REPORTER_ASSERT(reporter, !context->colorTypeSupportedAsSurface(colorType)); + return; + } - if (GrColorType::kABGR_4444 == colorType) { + if (kARGB_4444_SkColorType == colorType) { check_4444(reporter, controlPixelData, readBuffer); } else { - SkASSERT(GrColorType::kRGB_565 == colorType); + SkASSERT(kRGB_565_SkColorType == colorType); check_565(reporter, controlPixelData, readBuffer); } } @@ -134,11 +139,11 @@ static void run_test(skiatest::Reporter* reporter, GrContext* context, int array static const int CONTROL_ARRAY_SIZE = DEV_W * DEV_H; DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RGBA4444TextureTest, reporter, ctxInfo) { - run_test(reporter, ctxInfo.grContext(), CONTROL_ARRAY_SIZE, GrColorType::kABGR_4444); + run_test(reporter, ctxInfo.grContext(), CONTROL_ARRAY_SIZE, kARGB_4444_SkColorType); } DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RGB565TextureTest, reporter, ctxInfo) { - run_test(reporter, ctxInfo.grContext(), CONTROL_ARRAY_SIZE, GrColorType::kRGB_565); + run_test(reporter, ctxInfo.grContext(), CONTROL_ARRAY_SIZE, kRGB_565_SkColorType); } #endif -- cgit v1.2.3