aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Murphy <alec@noreply.localhost>2021-06-28 20:56:05 +0000
committerAlec Murphy <alec@noreply.localhost>2021-06-28 20:56:05 +0000
commitada7ba92593a533c4ee0b67876a86ebb012a8606 (patch)
treedd33128a52327e21427bcfd473ec4bd579cd01fa
parent87aabe3b1adf37e95e715312eab4f531cba7ece9 (diff)
parent11d03afe4d45e60f3694689f02f42759bb4b6307 (diff)
Merge pull request 'Core/Compositor: Added CPZ_WALLPAPER_REPEAT' (#10) from GasInfinity/erythros:master into master
Reviewed-on: https://git.checksum.fail/alec/erythros/pulls/10
-rw-r--r--Boot/Core/Compositor.HC20
1 files changed, 18 insertions, 2 deletions
diff --git a/Boot/Core/Compositor.HC b/Boot/Core/Compositor.HC
index b1eee45..d8080e5 100644
--- a/Boot/Core/Compositor.HC
+++ b/Boot/Core/Compositor.HC
@@ -16,6 +16,7 @@
#define CPZ_WALLPAPER_CENTERED 0x0
#define CPZ_WALLPAPER_AUTORESIZE 0x1
+#define CPZ_WALLPAPER_REPEAT 0x2
class @compositor_menubar {
Window *win;
@@ -185,10 +186,25 @@ U0 @compositor_set_wallpaper(Context2D *ctx, U32 mode, U32 background) { // Sets
tmp = NewContext2D(Display.Width(), Display.Height());
Fill2D(tmp, background);
CopyRect2D(tmp,
- (Display.Width() / 2) - (ctx->width / 2),
- (Display.Height() / 2) - (ctx->height / 2),
+ (Display.Width() / 2) - (ctx->width / 2),
+ (Display.Height() / 2) - (ctx->height / 2),
ctx);
break;
+ case CPZ_WALLPAPER_REPEAT:
+ tmp = NewContext2D(Display.Width(), Display.Height());
+ I64 x = 0;
+ I64 y = 0;
+ while(TRUE) {
+ CopyRect2D(tmp, x, y, ctx);
+ x += ctx->width;
+ if(x >= Display.Width()) {
+ x = 0;
+ y += ctx->height;
+ if(y >= Display.Height())
+ break;
+ }
+ }
+ break;
case CPZ_WALLPAPER_AUTORESIZE:
default:
tmp = Scale2D(tmp, Display.Width() / ToF64(ctx->width), Display.Height() / ToF64(ctx->height));