Skip to content

Commit

Permalink
Imported transform enums from Android and updated g_gfxQueueBufferDat…
Browse files Browse the repository at this point in the history
…a.transform for this.
  • Loading branch information
yellows8 committed Feb 12, 2018
1 parent 1d7556f commit 4b2a32a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
40 changes: 39 additions & 1 deletion nx/include/switch/gfx/buffer_producer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion nx/source/gfx/gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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},

Expand Down

0 comments on commit 4b2a32a

Please sign in to comment.