diff options
author | Brian Salomon <bsalomon@google.com> | 2018-03-19 16:06:44 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-19 21:17:15 +0000 |
commit | 19eaf2dbe785a06b76f11c2066c302f0aa89d5d2 (patch) | |
tree | 9bf1bcf8fe794da174ba19b1c5cfed84f0f274e5 /tests/PackedConfigsTextureTest.cpp | |
parent | 56dc04bdc160b71a1e77fdb9e30fde4e860077ae (diff) |
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 <mtklein@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests/PackedConfigsTextureTest.cpp')
-rw-r--r-- | tests/PackedConfigsTextureTest.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
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<uint16_t> controlPixelData; // We will read back into an 8888 buffer since 565/4444 read backs aren't supported SkTDArray<GrColor> 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<GrSurfaceContext> 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 |