diff options
author | GasInfinity <sami31275@gmail.com> | 2021-06-26 08:59:54 +0000 |
---|---|---|
committer | GasInfinity <sami31275@gmail.com> | 2021-06-26 08:59:54 +0000 |
commit | edce9d964f3e3d32a815ed7fb038c7339ed70f80 (patch) | |
tree | dd33128a52327e21427bcfd473ec4bd579cd01fa | |
parent | af3d2155d68ff64cf7fea1ff3155c27310478c88 (diff) |
Added CPZ_WALLPAPER_REPEAT
If the Context is smaller than the screen, it will repeat that Context until the entire screen is filled
-rw-r--r-- | Boot/Core/Compositor.HC | 20 |
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)); |