This commit is contained in:
Jorijn van der Graaf 2025-05-03 06:51:33 +02:00
commit 98b775e33e
21 changed files with 361 additions and 5541 deletions

View file

@ -23,7 +23,6 @@ module;
#include <time.h>
#include <unistd.h>
#include <print>
#include "cat.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@ -41,13 +40,13 @@ import Crafter.Event;
using namespace Crafter;
void ScaleBitmapR8G8B8(Pixel* dst, const Pixel* src, std::uint32_t srcWidth, std::uint32_t srcHeight, std::uint32_t dstWidth, std::uint32_t dstHeight) {
void ScaleBitmapR8G8B8(Pixel_RU8_GU8_BU8_AU8* dst, const Pixel_RU8_GU8_BU8_AU8* src, std::uint32_t srcWidth, std::uint32_t srcHeight, std::uint32_t dstWidth, std::uint32_t dstHeight) {
for (std::uint32_t y = 0; y < dstHeight; y++) {
std::uint32_t srcY = y * srcHeight / dstHeight;
for (std::uint32_t x = 0; x < dstWidth; x++) {
std::uint32_t srcX = x * srcWidth / dstWidth;
const Pixel* srcPixel = src + (srcY * srcWidth + srcX);
Pixel* dstPixel = dst + (y * dstWidth + x);
const Pixel_RU8_GU8_BU8_AU8* srcPixel = src + (srcY * srcWidth + srcX);
Pixel_RU8_GU8_BU8_AU8* dstPixel = dst + (y * dstWidth + x);
dstPixel[0] = srcPixel[0];
}
}
@ -85,7 +84,7 @@ void WindowWaylandWayland::Start() {
}
realX = (element->anchorX*width)-(element->anchorOffsetX*elementWidth);
realY = (element->anchorY*height)-(element->anchorOffsetY*elementHeight);
std::vector<Pixel> scaled(elementWidth*elementHeight);
std::vector<Pixel_RU8_GU8_BU8_AU8> scaled(elementWidth*elementHeight);
ScaleBitmapR8G8B8(scaled.data(), element->buffer.data(), element->bufferWidth, element->bufferHeight, elementWidth, elementHeight);
for(std::int32_t x = realX; x-realX < elementWidth; x++) {
for(std::int32_t y = realY; y-realY < elementHeight; y++) {