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/tools/gpu/ProxyUtils.h b/tools/gpu/ProxyUtils.h
new file mode 100644
index 0000000..6dfcd71
--- /dev/null
+++ b/tools/gpu/ProxyUtils.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef ProxyUtils_DEFINED
+#define ProxyUtils_DEFINED
+
+#include "GrTextureProxy.h"
+#include "GrTypesPriv.h"
+
+namespace sk_gpu_test {
+
+/** Makes a texture proxy containing the passed in color data. */
+sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, bool isRT, int width, int height,
+ GrColorType, GrSRGBEncoded, GrSurfaceOrigin,
+ const void* data, size_t rowBytes);
+
+/** Version that assumes GrSRGBEncoded::kNo. */
+inline sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, bool isRT, int width,
+ int height, GrColorType ct,
+ GrSurfaceOrigin origin, const void* data,
+ size_t rowBytes) {
+ return MakeTextureProxyFromData(context, isRT, width, height, ct, GrSRGBEncoded::kNo, origin,
+ data, rowBytes);
+}
+
+/** Version that takes SkColorType rather than GrColorType and assumes GrSRGBEncoded::kNo. */
+inline sk_sp<GrTextureProxy> MakeTextureProxyFromData(GrContext* context, bool isRT, int width,
+ int height, SkColorType ct,
+ GrSurfaceOrigin origin, const void* data,
+ size_t rowBytes) {
+ return MakeTextureProxyFromData(context, isRT, width, height, SkColorTypeToGrColorType(ct),
+ origin, data, rowBytes);
+}
+
+} // namespace sk_gpu_test
+
+#endif