diff options
author | Brian Salomon <bsalomon@google.com> | 2018-03-07 13:01:25 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-07 18:22:40 +0000 |
commit | 58389b90cd387533021c109eb28da40c08e0ead5 (patch) | |
tree | 7744ee9c23c74c61aa00a3cc01eff74cedb8f541 /tests/TestUtils.cpp | |
parent | ab6fd7ef91aeca8a3fbbc6c6670cb89a5a7b6d53 (diff) |
Initial texture data is never flipped when uploaded.
The first bytes of the data always refer to the pixel accessed by texture coord (0, 0).
Change-Id: I708702d90f35b3bc896a48c3c3fd6a0be73f505a
Reviewed-on: https://skia-review.googlesource.com/112261
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests/TestUtils.cpp')
-rw-r--r-- | tests/TestUtils.cpp | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/tests/TestUtils.cpp b/tests/TestUtils.cpp index 7878233698..1b146c2cca 100644 --- a/tests/TestUtils.cpp +++ b/tests/TestUtils.cpp @@ -11,8 +11,10 @@ #include "GrProxyProvider.h" #include "GrSurfaceContext.h" +#include "GrSurfaceContextPriv.h" #include "GrSurfaceProxy.h" #include "GrTextureProxy.h" +#include "ProxyUtils.h" void test_read_pixels(skiatest::Reporter* reporter, GrSurfaceContext* srcContext, uint32_t expectedPixelValues[], @@ -103,22 +105,14 @@ void test_copy_to_surface(skiatest::Reporter* reporter, GrProxyProvider* proxyPr } } - GrSurfaceDesc copySrcDesc; - copySrcDesc.fWidth = dstContext->width(); - copySrcDesc.fHeight = dstContext->height(); - copySrcDesc.fConfig = kRGBA_8888_GrPixelConfig; - - for (auto flags : { kNone_GrSurfaceFlags, kRenderTarget_GrSurfaceFlag }) { - copySrcDesc.fFlags = flags; - auto origin = (kNone_GrSurfaceFlags == flags) ? kTopLeft_GrSurfaceOrigin - : kBottomLeft_GrSurfaceOrigin; - - sk_sp<GrTextureProxy> src = proxyProvider->createTextureProxy( - copySrcDesc, origin, SkBudgeted::kYes, pixels.get(), 0); - - dstContext->copy(src.get()); - - test_read_pixels(reporter, dstContext, pixels.get(), testName); + for (auto isRT : {false, true}) { + for (auto origin : {kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) { + auto src = sk_gpu_test::MakeTextureProxyFromData( + dstContext->surfPriv().getContext(), isRT, dstContext->width(), + dstContext->height(), GrColorType::kRGBA_8888, origin, pixels.get(), 0); + dstContext->copy(src.get()); + test_read_pixels(reporter, dstContext, pixels.get(), testName); + } } } |