删除plot_core

This commit is contained in:
2026-08-13 00:35:00 +08:00
parent 15c3d21f2d
commit 05263cd506
67 changed files with 4154 additions and 1336 deletions
+21 -12
View File
@@ -1,6 +1,6 @@
#include "Renderable.h"
#include <renderive/scene/base/Scene_Base.hpp>
#include "../plot/Plot_Core.h"
#include "../render/Blend2D_Cache.h"
#include <algorithm>
@@ -24,11 +24,23 @@ void Renderable_Observer::observe_state(Renderable_Observer_Event event,
observation_.publish_count = publish_count;
}
Renderable::Renderable(Plot_Core& plot, bool cache_enabled)
: ::Renderable_Base(plot.kernel_scene(), {.cache_enabled = cache_enabled}), plot_(plot) {}
Renderable::Renderable(::Scene_Base& scene, bool cache_enabled)
: ::Renderable_Base(scene, {.cache_enabled = cache_enabled}) {}
Renderable::~Renderable() = default;
void attach_renderable_child(::Scene_Base& scene, const std::shared_ptr<Renderable>& renderable, const std::shared_ptr<Renderable>& parent) {
scene.attach_renderable(renderable);
try {
scene.set_display_parent(*renderable, parent.get());
scene.set_dependency_parent(*renderable, parent.get());
} catch (...) {
scene.detach_renderable(*renderable);
throw;
}
scene.notify_model_dirty();
}
Renderable_Cache_Mode Renderable::get_cache_mode() const noexcept {
return configuration().cache_enabled
? Renderable_Cache_Mode::Local_Pixel
@@ -36,7 +48,8 @@ Renderable_Cache_Mode Renderable::get_cache_mode() const noexcept {
}
void Renderable::set_cache_mode(Renderable_Cache_Mode mode) {
plot_.set_renderable_cache(*this, mode);
scene().set_renderable_configuration(*this, {.cache_enabled = mode == Renderable_Cache_Mode::Local_Pixel});
scene().notify_model_dirty();
}
std::string Renderable::object_name() const {
@@ -109,7 +122,7 @@ Renderable_Graph_Builder::Task Renderable::add_paint_task(
auto* cache = dynamic_cast<detail::Blend2D_Color_Cache*>(context.color_cache);
if (!cache)
return;
detail::Painter painter(*cache, viewport_size());
detail::Painter painter(*cache, {context.viewport.width, context.viewport.height});
if (painter)
function(painter, context);
});
@@ -117,21 +130,17 @@ Renderable_Graph_Builder::Task Renderable::add_paint_task(
void Renderable::changed() noexcept {
invalidate_prepare();
plot_.notify_model_dirty();
scene().notify_model_dirty();
}
void Renderable::paint_changed() noexcept {
invalidate_paint();
plot_.notify_model_dirty();
scene().notify_model_dirty();
}
void Renderable::render_graph_changed() noexcept {
rebuild_render_graph();
plot_.notify_model_dirty();
}
Size Renderable::viewport_size() const noexcept {
return plot_.viewport_size();
scene().notify_model_dirty();
}
} // namespace renderive