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>
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index 34cf5bc..ccb2ced 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 @@
}
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));
}
}