四个方向 分块渲染

This commit is contained in:
2026-08-12 09:01:25 +08:00
parent b34c0d31b1
commit 9331b4cbf6
24 changed files with 788 additions and 108 deletions
+18
View File
@@ -222,6 +222,24 @@ Painter::~Painter() {
context_.end();
}
void Painter::clip(RectF value) {
value = value.normalized();
if (!active_ || value.empty())
return;
context_.clip_to_rect(BLRect(value.x, value.y, value.width, value.height));
}
void Painter::composite(const Blend2D_Color_Cache& source) {
if (!active_ || source.image_.is_empty())
return;
const Size source_size = source.size();
context_.blit_image(BLRect(0.0, 0.0,
static_cast<double>(source_size.width),
static_cast<double>(source_size.height)),
source.image_,
BLRectI(0, 0, source_size.width, source_size.height));
}
BLRgba Painter::rgba(Color color) noexcept {
constexpr double scale = 1.0 / 255.0;
return BLRgba(color.r * scale, color.g * scale, color.b * scale, color.a * scale);