aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGasInfinity <sami31275@gmail.com>2021-06-26 23:54:34 +0000
committerGasInfinity <sami31275@gmail.com>2021-06-26 23:54:34 +0000
commit8e27b880a6cf2a31c2f1ca677d2ee126f759b17c (patch)
treedd33128a52327e21427bcfd473ec4bd579cd01fa
parentaf3d2155d68ff64cf7fea1ff3155c27310478c88 (diff)
parentedce9d964f3e3d32a815ed7fb038c7339ed70f80 (diff)
Merge pull request 'Added CPZ_WALLPAPER_REPEAT' (#3) from gasinfinity-cpz-wall-repeat into master
Reviewed-on: https://git.checksum.fail/GasInfinity/erythros/pulls/3
-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));