MCPcopy Create free account
hub / github.com/devkitPro/libctru / gfxSetScreenFormat

Function gfxSetScreenFormat

libctru/source/gfx.c:45–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void gfxSetScreenFormat(gfxScreen_t screen, GSPGPU_FramebufferFormat format)
46{
47 u32 reqSize = GSP_SCREEN_WIDTH * gspGetBytesPerPixel(format);
48 u8** framebuffers;
49 u32* maxSize;
50
51 if (screen == GFX_TOP)
52 {
53 reqSize *= GSP_SCREEN_HEIGHT_TOP_2X;
54 framebuffers = gfxTopFramebuffers;
55 maxSize = &gfxTopFramebufferMaxSize;
56 }
57 else // GFX_BOTTOM
58 {
59 reqSize *= GSP_SCREEN_HEIGHT_BOTTOM;
60 framebuffers = gfxBottomFramebuffers;
61 maxSize = &gfxBottomFramebufferMaxSize;
62 }
63
64 if (*maxSize < reqSize)
65 {
66 if (framebuffers[0]) screenFree(framebuffers[0]);
67 if (framebuffers[1]) screenFree(framebuffers[1]);
68 framebuffers[0] = (u8*)screenAlloc(reqSize);
69 framebuffers[1] = (u8*)screenAlloc(reqSize);
70 *maxSize = reqSize;
71 }
72
73 gfxFramebufferFormats[screen] = format;
74}
75
76GSPGPU_FramebufferFormat gfxGetScreenFormat(gfxScreen_t screen)
77{

Callers 2

gfxInitFunction · 0.85
consoleInitFunction · 0.85

Calls 1

gspGetBytesPerPixelFunction · 0.85

Tested by

no test coverage detected