From 4b2a32af59530b969ae4a1144ded8cde2e397fbb Mon Sep 17 00:00:00 2001 From: yellows8 Date: Mon, 12 Feb 2018 11:56:29 -0500 Subject: [PATCH] Imported transform enums from Android and updated g_gfxQueueBufferData.transform for this. --- nx/include/switch/gfx/buffer_producer.h | 40 ++++++++++++++++++++++++- nx/source/gfx/gfx.c | 2 +- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/nx/include/switch/gfx/buffer_producer.h b/nx/include/switch/gfx/buffer_producer.h index 8ade36b3..1d6e30bb 100644 --- a/nx/include/switch/gfx/buffer_producer.h +++ b/nx/include/switch/gfx/buffer_producer.h @@ -18,7 +18,7 @@ typedef struct { s32 isAutoTimestamp; bufferProducerRect crop; s32 scalingMode; - u32 transform; + u32 transform;//See the NATIVE_WINDOW_TRANSFORM_* enums. u32 stickyTransform; u32 unk[2]; bufferProducerFence fence; @@ -104,6 +104,44 @@ enum { //... }; +//From Android hardware.h. + +/** + * Transformation definitions + * + * IMPORTANT NOTE: + * HAL_TRANSFORM_ROT_90 is applied CLOCKWISE and AFTER HAL_TRANSFORM_FLIP_{H|V}. + * + */ + +enum { + /* flip source image horizontally (around the vertical axis) */ + HAL_TRANSFORM_FLIP_H = 0x01, + /* flip source image vertically (around the horizontal axis)*/ + HAL_TRANSFORM_FLIP_V = 0x02, + /* rotate source image 90 degrees clockwise */ + HAL_TRANSFORM_ROT_90 = 0x04, + /* rotate source image 180 degrees */ + HAL_TRANSFORM_ROT_180 = 0x03, + /* rotate source image 270 degrees clockwise */ + HAL_TRANSFORM_ROT_270 = 0x07, +}; + +//From Android window.h. +/* parameter for NATIVE_WINDOW_SET_BUFFERS_TRANSFORM */ +enum { + /* flip source image horizontally */ + NATIVE_WINDOW_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H, + /* flip source image vertically */ + NATIVE_WINDOW_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V, + /* rotate source image 90 degrees clock-wise */ + NATIVE_WINDOW_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90, + /* rotate source image 180 degrees */ + NATIVE_WINDOW_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180, + /* rotate source image 270 degrees clock-wise */ + NATIVE_WINDOW_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270, +}; + Result bufferProducerInitialize(Binder *session); void bufferProducerExit(void); diff --git a/nx/source/gfx/gfx.c b/nx/source/gfx/gfx.c index cc157573..45420b8b 100644 --- a/nx/source/gfx/gfx.c +++ b/nx/source/gfx/gfx.c @@ -57,7 +57,7 @@ static bufferProducerQueueBufferInput g_gfxQueueBufferData = { .isAutoTimestamp = 0x1, .crop = {0x0, 0x0, 0x0, 0x0}, //Official apps which use multiple resolutions configure this for the currently used resolution, depending on the current appletOperationMode. .scalingMode = 0x0, - .transform = 0x2, + .transform = NATIVE_WINDOW_TRANSFORM_FLIP_V, .stickyTransform = 0x0, .unk = {0x0, 0x1},