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/CopySurfaceTest.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/CopySurfaceTest.cpp')
-rw-r--r-- | tests/CopySurfaceTest.cpp | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/tests/CopySurfaceTest.cpp b/tests/CopySurfaceTest.cpp index b37325896c..9574208564 100644 --- a/tests/CopySurfaceTest.cpp +++ b/tests/CopySurfaceTest.cpp @@ -12,26 +12,17 @@ #if SK_SUPPORT_GPU #include "GrContext.h" #include "GrContextPriv.h" -#include "GrProxyProvider.h" -#include "GrResourceProvider.h" -#include "GrSurfaceContext.h" -#include "GrSurfaceProxy.h" #include "GrTextureProxy.h" +#include "ProxyUtils.h" #include "SkUtils.h" DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); - GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); static const int kW = 10; static const int kH = 10; static const size_t kRowBytes = sizeof(uint32_t) * kW; - GrSurfaceDesc baseDesc; - baseDesc.fConfig = kRGBA_8888_GrPixelConfig; - baseDesc.fWidth = kW; - baseDesc.fHeight = kH; - SkAutoTMalloc<uint32_t> srcPixels(kW * kH); for (int i = 0; i < kW * kH; ++i) { srcPixels.get()[i] = i; @@ -65,19 +56,16 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) { for (auto sOrigin : {kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin}) { for (auto dOrigin : {kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin}) { - for (auto sFlags: {kRenderTarget_GrSurfaceFlag, kNone_GrSurfaceFlags}) { - for (auto dFlags: {kRenderTarget_GrSurfaceFlag, kNone_GrSurfaceFlags}) { + for (auto sRT : {true, false}) { + for (auto dRT : {true, false}) { for (auto srcRect : kSrcRects) { for (auto dstPoint : kDstPoints) { - GrSurfaceDesc srcDesc = baseDesc; - srcDesc.fFlags = sFlags; - GrSurfaceDesc dstDesc = baseDesc; - dstDesc.fFlags = dFlags; - - sk_sp<GrTextureProxy> src = proxyProvider->createTextureProxy( - srcDesc, sOrigin, SkBudgeted::kNo, srcPixels.get(), kRowBytes); - sk_sp<GrTextureProxy> dst = proxyProvider->createTextureProxy( - dstDesc, dOrigin, SkBudgeted::kNo, dstPixels.get(), kRowBytes); + auto src = sk_gpu_test::MakeTextureProxyFromData( + context, sRT, kW, kH, ii.colorType(), sOrigin, srcPixels.get(), + kRowBytes); + auto dst = sk_gpu_test::MakeTextureProxyFromData( + context, dRT, kW, kH, ii.colorType(), dOrigin, dstPixels.get(), + kRowBytes); if (!src || !dst) { ERRORF(reporter, "Could not create surfaces for copy surface test."); |