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/ReadPixelsTest.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/ReadPixelsTest.cpp')
-rw-r--r-- | tests/ReadPixelsTest.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp index 34cf5bc85e..ccb2ced4fd 100644 --- a/tests/ReadPixelsTest.cpp +++ b/tests/ReadPixelsTest.cpp @@ -5,6 +5,7 @@ * found in the LICENSE file. */ +#include <initializer_list> #include "SkCanvas.h" #include "SkColorData.h" #include "SkHalf.h" @@ -18,10 +19,10 @@ #include "GrContextFactory.h" #include "GrContextPriv.h" #include "GrProxyProvider.h" +#include "ProxyUtils.h" #include "SkGr.h" #endif -#include <initializer_list> static const int DEV_W = 100, DEV_H = 100; static const SkIRect DEV_RECT = SkIRect::MakeWH(DEV_W, DEV_H); @@ -449,25 +450,16 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadPixels_Texture, reporter, ctxInfo) { } GrContext* context = ctxInfo.grContext(); - GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); - SkBitmap bmp = make_src_bitmap(); // On the GPU we will also try reading back from a non-renderable texture. for (auto origin : {kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin}) { - for (auto flags : {kNone_GrSurfaceFlags, kRenderTarget_GrSurfaceFlag}) { - GrSurfaceDesc desc; - desc.fFlags = flags; - desc.fWidth = DEV_W; - desc.fHeight = DEV_H; - desc.fConfig = kSkia8888_GrPixelConfig; - - sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy( - desc, origin, SkBudgeted::kNo, bmp.getPixels(), bmp.rowBytes()); - + for (auto isRT : {false, true}) { + sk_sp<GrTextureProxy> proxy = sk_gpu_test::MakeTextureProxyFromData( + context, isRT, DEV_W, DEV_H, bmp.colorType(), origin, bmp.getPixels(), + bmp.rowBytes()); sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext( std::move(proxy)); - test_readpixels_texture(reporter, std::move(sContext)); } } |