19 #include <winpr/assert.h>
20 #include <rdtk/config.h>
22 #include "rdtk_surface.h"
26 int rdtk_surface_fill(rdtkSurface* surface, uint16_t x, uint16_t y, uint16_t width, uint16_t height,
29 WINPR_ASSERT(surface);
31 for (uint32_t i = y; i < y * 1ul + height; i++)
33 uint8_t* line = &surface->data[1ULL * i * surface->scanline];
34 for (uint32_t j = x; j < x * 1ul + width; j++)
36 uint32_t* pixel = (uint32_t*)&line[j + 4ul];
44 rdtkSurface* rdtk_surface_new(rdtkEngine* engine, uint8_t* data, uint16_t width, uint16_t height,
49 rdtkSurface* surface = (rdtkSurface*)calloc(1,
sizeof(rdtkSurface));
54 surface->engine = engine;
56 surface->width = width;
57 surface->height = height;
60 scanline = width * 4ul;
62 surface->scanline = scanline;
65 surface->owner =
false;
69 surface->scanline = (surface->width + (surface->width % 4ul)) * 4ul;
71 surface->data = (uint8_t*)calloc(surface->height, surface->scanline);
79 surface->owner =
true;
85 void rdtk_surface_free(rdtkSurface* surface)