diff --git a/src/netxs/desktopio/application.hpp b/src/netxs/desktopio/application.hpp index f85f21ea93..81cee664e0 100644 --- a/src/netxs/desktopio/application.hpp +++ b/src/netxs/desktopio/application.hpp @@ -22,7 +22,7 @@ namespace netxs::app namespace netxs::app::shared { - static const auto version = "v2026.05.28"; + static const auto version = "v2026.05.29"; static const auto repository = "https://github.com/directvt/vtm"; static const auto usr_config = "~/.config/vtm/settings.xml"s; static const auto sys_config = "/etc/vtm/settings.xml"s; diff --git a/src/netxs/desktopio/directvt.hpp b/src/netxs/desktopio/directvt.hpp index 8cb6e2dd14..fcfd20c026 100644 --- a/src/netxs/desktopio/directvt.hpp +++ b/src/netxs/desktopio/directvt.hpp @@ -2074,7 +2074,8 @@ namespace netxs::directvt } } // s11n: Receive image metadata. - void receive_img(s11n::xs::img_list& lock) + template + void receive_img(s11n::xs::img_list& lock, P proc = {}) { auto images = cell::images(); auto is_remote = !!s11n::nat[0]; @@ -2086,12 +2087,13 @@ namespace netxs::directvt { if (auto image_ptr = images.map[local_index]) { + proc(local_index); auto& image = *image_ptr; if constexpr (debugmode) log("%%New image metadata:", prompt::s11n); auto layers_updated = image.receive_image_attributes(new_image.global_attributes); if (layers_updated) { - translate_layers(images, image, is_remote); + s11n::translate_layers(images, image, is_remote); } } } diff --git a/src/netxs/desktopio/gui.hpp b/src/netxs/desktopio/gui.hpp index 3c0b33f031..f618470674 100644 --- a/src/netxs/desktopio/gui.hpp +++ b/src/netxs/desktopio/gui.hpp @@ -2638,6 +2638,8 @@ namespace netxs::gui auto document_area = bitmap.scaled_fragment_area.shift(offset); // Raster inside the document fragment. netxs::xform_render(canvas, canvas_clip, raster, document_area, xform, fx); } + // Image Test. + //rect ph; auto render_layer(auto& canvas, rect placeholder, argb fgc, imagens::image& image, qiew sub_id, imagens::image::bitmap_t& bitmap, imagens::image::gb_attrs_t& gb_attrs, twod image_WH, bool inv) { if (bitmap.fragment.type == sprite::undef && image.document.size()) @@ -2674,6 +2676,20 @@ namespace netxs::gui auto offset = placeholder.coor + bitmap.xy + fragment_area_coor; draw_image(canvas, bitmap, offset, fgc, inv, image_xform); } + // Image Test. + //if (bitmap.fragment.area) + //{ + // netxs::onrect(canvas, rect{ ph.coor + dot_22 + ph.size / dot_33, ph.size / dot_33 }, [](auto& p){ p = argb{ tint::purecyan }; }); + //} + //else + //{ + // auto clr = image.dom[0] && image.document.size() && bitmap.fragment.type == sprite::undef ? tint::puremagenta + // : !image.document.size() ? tint::pureyellow + // : bitmap.fragment.type != sprite::undef ? tint::purered + // : !image.dom[0] ? tint::purewhite + // : tint::bluedk; + // netxs::onrect(canvas, rect{ ph.coor + dot_22 + ph.size / dot_33, ph.size / dot_33 }, [&](auto& p){ p = argb{ clr }; }); + //} } void render_layers(gui::bits& canvas, rect placeholder, argb fgc, imagens::image& image, qiew sub_id, imagens::image::bitmap_t& bitmap, imagens::image::gb_attrs_t& gb_attrs, twod image_WH, twod wh, bool inv) { @@ -2702,6 +2718,8 @@ namespace netxs::gui { if (auto image_cr = c.get_image_cr(); image_cr.x != 0 && image_cr.y != 0) { + // Image Test. + //ph = placeholder; auto image_index = c.get_image_index(); auto wh = c.get_image_WH(); auto images = cell::images(); // Lock. @@ -2713,6 +2731,11 @@ namespace netxs::gui auto& image = *image_ptr; render_layers(canvas, placeholder, fgc, image, image.sub_id, image.bitmap, image.gb_attrs, image_WH, wh, inv); } + // Image Test. + //else + //{ + // netxs::onrect(canvas, rect{ ph.coor + dot_22, ph.size / dot_33 }, [](auto& p){ p = argb{ tint::puremagenta }; }); + //} } } void draw_shadows(auto& canvas, rect placeholder, cell const& c) diff --git a/src/netxs/desktopio/intmath.hpp b/src/netxs/desktopio/intmath.hpp index ba2d7457b7..55d3329a6d 100644 --- a/src/netxs/desktopio/intmath.hpp +++ b/src/netxs/desktopio/intmath.hpp @@ -120,7 +120,7 @@ namespace netxs #if defined(DEBUG) = true; #else - = faux; + = faux; // SSH could crash if true. #endif [[maybe_unused]] static auto _k0 = 0; // LCtrl+Wheel. diff --git a/src/netxs/desktopio/terminal.hpp b/src/netxs/desktopio/terminal.hpp index 6eaa1f736b..3e582a7b0e 100644 --- a/src/netxs/desktopio/terminal.hpp +++ b/src/netxs/desktopio/terminal.hpp @@ -11070,6 +11070,7 @@ namespace netxs::ui dtvt& owner; // link: Terminal object reference. flag waits; // link: Owner is waiting for the correct bitmap size. + std::bitset<65536> touched_images; // link: Affected image indexes. void direct(s11n::xs::bitmap_dtvt lock, view& data) { @@ -11086,7 +11087,17 @@ namespace netxs::ui } void handle(s11n::xs::img_list lock) { - s11n::receive_img(lock); + //todo unify: make the same for GUI (dirty regions) + s11n::receive_img(lock, [&](ui16 updated_image_index){ touched_images.set(updated_image_index); }); // Update in order to forward to FE. + owner.update_touched_images(touched_images); // Update in order to forward to FE. + for (auto& new_image : lock.thing) // Clear the index of touched images. + { + auto remote_index = new_image.index; + if (auto local_index = s11n::nat[remote_index]) + { + touched_images.reset(local_index); + } + } owner.base::enqueue([&](auto& /*boss*/) { owner.base::signal(tier::general, e2::data::image::sync); @@ -11125,7 +11136,7 @@ namespace netxs::ui { s11n::translate_layers(images, image, is_remote); } - owner.update_image_bits(image_index); + owner.update_image_bits(image_index); // Update in order to forward to FE. owner.base::enqueue([&, image_index](auto& /*boss*/) // To avoid deadlock under cell::images. { owner.base::signal(tier::general, e2::data::image::update, image_index); @@ -11482,6 +11493,20 @@ namespace netxs::ui auto& grid = bitmap_lock.thing.image; cell::remove_image_bits(grid, removed_image_indexes); } + // dtvt: Update touched images on canvas. + void update_touched_images(std::bitset<65536> const& touched_images) + { + auto bitmap_lock = stream.bitmap_dtvt.freeze(); + auto& grid = bitmap_lock.thing.image; + for (auto& c : grid) + { + auto image_index = c.get_image_index(); + if (touched_images[image_index]) + { + c.inc_image_stamp(1); + } + } + } // dtvt: Update image metadata on canvas. void update_image_bits(ui16 updated_image_index) {