From 4f331eb9f7b9616c3b8db20b3081766f13dc6cfe Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Tue, 19 Jun 2018 23:04:04 +0200 Subject: [PATCH] gfx: Add function to query framebuffer pitch. --- nx/include/switch/display/gfx.h | 3 +++ nx/source/display/gfx.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/nx/include/switch/display/gfx.h b/nx/include/switch/display/gfx.h index 060d48a5..ad0aeeb8 100644 --- a/nx/include/switch/display/gfx.h +++ b/nx/include/switch/display/gfx.h @@ -85,6 +85,9 @@ void gfxGetFramebufferResolution(u32* width, u32* height); /// Use this to get the actual byte-size of the framebuffer for use with memset/etc. size_t gfxGetFramebufferSize(void); +/// Use this to get the actual byte-pitch of the framebuffer for use with memset/etc. +u32 gfxGetFramebufferPitch(void); + /// Sets the \ref GfxMode. void gfxSetMode(GfxMode mode); diff --git a/nx/source/display/gfx.c b/nx/source/display/gfx.c index 633d9c7a..ade25ce3 100644 --- a/nx/source/display/gfx.c +++ b/nx/source/display/gfx.c @@ -530,6 +530,10 @@ size_t gfxGetFramebufferSize(void) { return g_gfx_singleframebuf_size; } +u32 gfxGetFramebufferPitch(void) { + return g_gfx_framebuf_aligned_width*4; +} + void gfxSetMode(GfxMode mode) { g_gfxMode = mode; }