Donner SVG main
0.8.0 ยท 382bd0190.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
RuntimeBitmapUpload.h File Reference
#include <cstddef>
#include <cstdint>
#include <memory>
#include <span>
#include "donner/base/Vector2.h"
#include "donner/svg/renderer/RendererInterface.h"
Include dependency graph for RuntimeBitmapUpload.h:

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.
namespace  donner::svg
 Donner SVG library, which can load, manipulate and render SVG files.

Functions

std::shared_ptr< svg::RendererGeodeTextureSnapshot > donner::editor::UploadRuntimeBitmap (const std::shared_ptr< geode::GeodeDevice > &device, std::span< const uint8_t > pixels, Vector2i dimensions, std::size_t rowBytes, svg::AlphaType alphaType, Vector2i allocationDimensions)
 Uploads RGBA bitmap pixels through the caller's thread-owned runtime context.

Function Documentation

◆ UploadRuntimeBitmap()

std::shared_ptr< svg::RendererGeodeTextureSnapshot > donner::editor::UploadRuntimeBitmap ( const std::shared_ptr< geode::GeodeDevice > & device,
std::span< const uint8_t > pixels,
Vector2i dimensions,
std::size_t rowBytes,
svg::AlphaType alphaType,
Vector2i allocationDimensions )

Uploads RGBA bitmap pixels through the caller's thread-owned runtime context.

Validates storage and obtains runtime allocation admission before creating bounded staging chunks. A larger allocation repeats the final payload column and row once, then clears the unused backing. The pixel span is consumed synchronously and is never retained.

Parameters
deviceLogical runtime owner used only from the calling thread during this operation.
pixelsBorrowed source storage, valid until this function returns.
dimensionsPayload dimensions in pixels.
rowBytesSource byte stride, including any row padding.
alphaTypeAlpha interpretation retained by the snapshot.
allocationDimensionsBacking extent, at least as large as the payload.
Returns
Uploaded snapshot, or null on invalid input or runtime failure. Each call allocates its own texture, so a failed write cannot disturb an allocation the caller already presents.