aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2019-05-11 01:46:38 +0200
committerArisotura <thetotalworm@gmail.com>2019-05-11 01:46:38 +0200
commit858c0eecb91f8f15e8347b9fbad806961d0d8534 (patch)
tree7472132db20cde5480f620fe10f6c4b7abe73071 /src
parent44e1593e1f82a3ecc627925353a2ae608d36d62d (diff)
scale screen gap
also moar optimization...
Diffstat (limited to 'src')
-rw-r--r--src/GPU2D.cpp12
-rw-r--r--src/libui_sdl/main.cpp13
2 files changed, 14 insertions, 11 deletions
diff --git a/src/GPU2D.cpp b/src/GPU2D.cpp
index fc36557..505468d 100644
--- a/src/GPU2D.cpp
+++ b/src/GPU2D.cpp
@@ -773,16 +773,16 @@ void GPU2D::DrawScanline(u32 line)
// convert to 32-bit BGRA
// note: 32-bit RGBA would be more straightforward, but
// BGRA seems to be more compatible (Direct2D soft, cairo...)
- for (int i = 0; i < LineStride; i++)
+ for (int i = 0; i < LineStride; i+=2)
{
- u32 c = dst[i];
+ u64 c = *(u64*)&dst[i];
- u32 r = c << 18;
- u32 g = (c << 2) & 0xFC00;
- u32 b = (c >> 14) & 0xFC;
+ u64 r = (c << 18) & 0xFC000000FC0000;
+ u64 g = (c << 2) & 0xFC000000FC00;
+ u64 b = (c >> 14) & 0xFC000000FC;
c = r | g | b;
- dst[i] = c | ((c & 0x00C0C0C0) >> 6) | 0xFF000000;
+ *(u64*)&dst[i] = c | ((c & 0x00C0C0C000C0C0C0) >> 6) | 0xFF000000FF000000;
}
}
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp
index f77f836..b3fce3f 100644
--- a/src/libui_sdl/main.cpp
+++ b/src/libui_sdl/main.cpp
@@ -812,7 +812,7 @@ void SetupScreenRects(int width, int height)
else
sizemode = ScreenSizing;
- int screenW, screenH;
+ int screenW, screenH, gap;
if (sideways)
{
screenW = 192;
@@ -824,8 +824,11 @@ void SetupScreenRects(int width, int height)
screenH = 192;
}
+ gap = ScreenGap;
+
screenW *= ScreenScale;
screenH *= ScreenScale;
+ gap *= ScreenScale;
uiRect *topscreen, *bottomscreen;
if (ScreenRotation == 1 || ScreenRotation == 2)
@@ -846,7 +849,7 @@ void SetupScreenRects(int width, int height)
int heightreq;
int startX = 0;
- width -= ScreenGap;
+ width -= gap;
if (sizemode == 0) // even
{
@@ -884,7 +887,7 @@ void SetupScreenRects(int width, int height)
topscreen->X = startX;
topscreen->Y = ((height - heightreq) / 2) + (heightreq - topscreen->Height);
- bottomscreen->X = topscreen->X + topscreen->Width + ScreenGap;
+ bottomscreen->X = topscreen->X + topscreen->Width + gap;
if (sizemode == 1)
{
@@ -905,7 +908,7 @@ void SetupScreenRects(int width, int height)
int widthreq;
int startY = 0;
- height -= ScreenGap;
+ height -= gap;
if (sizemode == 0) // even
{
@@ -943,7 +946,7 @@ void SetupScreenRects(int width, int height)
topscreen->Y = startY;
topscreen->X = (width - topscreen->Width) / 2;
- bottomscreen->Y = topscreen->Y + topscreen->Height + ScreenGap;
+ bottomscreen->Y = topscreen->Y + topscreen->Height + gap;
if (sizemode == 1)
{