Implement support for origin-TopLeft render targets. Note that the default behaviour remains the same: textures default to origin-TopLeft, render targets default to origin-BottomLeft, and backend textures default to origin-BottomLeft. However, the caller can override the default by setting fOrigin in GrTextureDesc, GrBackendTextureDesc or GrBackendRenderTargetDesc.
Review URL: https://codereview.appspot.com/7230049
git-svn-id: http://skia.googlecode.com/svn/trunk@7594 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index 41ecccf..df51a19 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -303,7 +303,7 @@
SkIRect::MakeLTRB(3 * DEV_W / 4, -10, DEV_W + 10, DEV_H + 10),
};
- for (int dtype = 0; dtype < 2; ++dtype) {
+ for (int dtype = 0; dtype < 3; ++dtype) {
int glCtxTypeCnt = 1;
#if SK_SUPPORT_GPU
if (0 != dtype) {
@@ -325,7 +325,16 @@
if (NULL == context) {
continue;
}
- device.reset(new SkGpuDevice(context, SkBitmap::kARGB_8888_Config, DEV_W, DEV_H));
+ GrTextureDesc desc;
+ desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit;
+ desc.fWidth = DEV_W;
+ desc.fHeight = DEV_H;
+ desc.fConfig = kSkia8888_PM_GrPixelConfig;
+ desc.fOrigin = 1 == dtype ? kBottomLeft_GrSurfaceOrigin
+ : kTopLeft_GrSurfaceOrigin;
+ GrAutoScratchTexture ast(context, desc, GrContext::kExact_ScratchTexMatch);
+ SkAutoTUnref<GrTexture> tex(ast.detach());
+ device.reset(new SkGpuDevice(context, tex));
#else
continue;
#endif