@geastack/engine 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/canvas.cpp +270 -139
- package/css/engine.h +23 -3
- package/image_store.cpp +35 -2
- package/package.json +2 -2
- package/rasterized_font.cpp +42 -2
- package/touch_runtime.cpp +231 -178
- package/ui/canvas_element.cpp +432 -125
- package/ui/canvas_element.h +84 -16
- package/ui/core.cpp +1 -0
- package/ui/debugger_listeners.h +80 -0
- package/ui/debugger_overlay.h +79 -0
- package/ui/debugger_picker.h +105 -0
- package/ui/document.cpp +1 -1
- package/ui/image_node.cpp +33 -1
- package/ui/input.cpp +27 -6
- package/ui/input_render.cpp +6 -8
- package/ui/internal.h +20 -0
- package/ui/layout.cpp +130 -17
- package/ui/layout_snapshot.cpp +1 -0
- package/ui/node.h +4 -0
- package/ui/node_lifecycle.cpp +7 -0
- package/ui/node_model.h +38 -16
- package/ui/render.cpp +259 -26
- package/ui/style.cpp +571 -66
- package/ui/style.h +16 -1
- package/ui/text.cpp +113 -65
- package/ui/tree_events.cpp +55 -13
- package/ui/tree_internal.h +5 -0
- package/ui/tree_nodes.cpp +16 -1
- package/ui/tree_render.cpp +153 -13
- package/ui/tree_style.cpp +25 -3
- package/ui/view.cpp +8 -8
package/ui/tree_render.cpp
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
#include "absolute_leaf_refresh.h"
|
|
3
3
|
#include "dirty_regions.h"
|
|
4
|
+
#include "debugger_overlay.h"
|
|
5
|
+
#include "canvas_element.h"
|
|
4
6
|
#include "display.h"
|
|
5
7
|
#include "display_underlay.h"
|
|
6
8
|
#include "document.h"
|
|
@@ -1669,6 +1671,7 @@ namespace gea::embedded::ui
|
|
|
1669
1671
|
state.canvases.forEach([](CanvasSurfaceState &surface)
|
|
1670
1672
|
{
|
|
1671
1673
|
if (auto *canvas = surface.canvas()) canvas->resetDirty(); });
|
|
1674
|
+
CanvasRenderingContext2D::clearRetainedCanvasDamage();
|
|
1672
1675
|
GEA_REFRESH_PERF(refreshPerfStatsMutable().treePanReplayCalls++);
|
|
1673
1676
|
if (directRegions > 0)
|
|
1674
1677
|
GEA_REFRESH_PERF(refreshPerfStatsMutable().treeDirectReplayCalls++);
|
|
@@ -1694,10 +1697,32 @@ namespace gea::embedded::ui
|
|
|
1694
1697
|
}
|
|
1695
1698
|
#endif
|
|
1696
1699
|
|
|
1700
|
+
bool gSnapshotRasterActive = false;
|
|
1701
|
+
|
|
1697
1702
|
bool renderRetainedSnapshotRgb565(std::uint16_t *dst, int width, int height)
|
|
1698
1703
|
{
|
|
1699
1704
|
if (!dst || width <= 0 || height <= 0)
|
|
1700
1705
|
return false;
|
|
1706
|
+
struct SnapshotRasterScope
|
|
1707
|
+
{
|
|
1708
|
+
bool previous = gSnapshotRasterActive;
|
|
1709
|
+
bool rebound = false;
|
|
1710
|
+
#if GEA_EMBEDDED_DISPLAY_BANDED_UI
|
|
1711
|
+
bool previousBanded = gBandedRasterActive;
|
|
1712
|
+
#endif
|
|
1713
|
+
|
|
1714
|
+
SnapshotRasterScope() { gSnapshotRasterActive = true; }
|
|
1715
|
+
|
|
1716
|
+
~SnapshotRasterScope()
|
|
1717
|
+
{
|
|
1718
|
+
if (rebound)
|
|
1719
|
+
gea::platform::display::Display::rebindCanvasToFramebuffer();
|
|
1720
|
+
gSnapshotRasterActive = previous;
|
|
1721
|
+
#if GEA_EMBEDDED_DISPLAY_BANDED_UI
|
|
1722
|
+
gBandedRasterActive = previousBanded;
|
|
1723
|
+
#endif
|
|
1724
|
+
}
|
|
1725
|
+
} scope;
|
|
1701
1726
|
#if GEA_EMBEDDED_DISPLAY_BANDED_UI
|
|
1702
1727
|
// A banded frame lives only on the panel: render it again the way the
|
|
1703
1728
|
// bands did — black base, the underlay, then the whole display list.
|
|
@@ -1710,6 +1735,7 @@ namespace gea::embedded::ui
|
|
|
1710
1735
|
PixT *base = reinterpret_cast<PixT *>(dst);
|
|
1711
1736
|
std::fill_n(base, static_cast<std::size_t>(width) * static_cast<std::size_t>(height),
|
|
1712
1737
|
gea::framework::graphics::pixel::fromRgb565(0x0000));
|
|
1738
|
+
scope.rebound = true;
|
|
1713
1739
|
bandCanvas->bindPixels(base, width, height, width);
|
|
1714
1740
|
gea::platform::display::Display::resetClip();
|
|
1715
1741
|
gea::platform::display::Display::setAlpha(255);
|
|
@@ -1718,7 +1744,6 @@ namespace gea::embedded::ui
|
|
|
1718
1744
|
bandedReplayRegion(0, 0, width - 1, height - 1, /*direct=*/false);
|
|
1719
1745
|
gBandedRasterActive = false;
|
|
1720
1746
|
gea::platform::display::Display::popClip();
|
|
1721
|
-
gea::platform::display::Display::rebindCanvasToFramebuffer();
|
|
1722
1747
|
const int pixels = width * height;
|
|
1723
1748
|
for (int i = 0; i < pixels; i++)
|
|
1724
1749
|
dst[i] = gea::framework::graphics::pixel::toRgb565(base[i]);
|
|
@@ -1732,6 +1757,9 @@ namespace gea::embedded::ui
|
|
|
1732
1757
|
return false;
|
|
1733
1758
|
using PixT = gea::framework::graphics::pixel::native_t;
|
|
1734
1759
|
PixT *base = reinterpret_cast<PixT *>(dst);
|
|
1760
|
+
std::fill_n(base, static_cast<std::size_t>(width) * static_cast<std::size_t>(height),
|
|
1761
|
+
gea::framework::graphics::pixel::fromRgb565(0x0000));
|
|
1762
|
+
scope.rebound = true;
|
|
1735
1763
|
canvas->bindPixels(base, width, height, width);
|
|
1736
1764
|
gea::platform::display::Display::resetClip();
|
|
1737
1765
|
gea::platform::display::Display::setAlpha(255);
|
|
@@ -1743,12 +1771,19 @@ namespace gea::embedded::ui
|
|
|
1743
1771
|
// (rows recorded beyond the scroll viewport printed above it in every
|
|
1744
1772
|
// snapshot, reading as a phantom on-screen ghost during debugging).
|
|
1745
1773
|
{
|
|
1746
|
-
|
|
1747
|
-
|
|
1774
|
+
#if defined(GEA_NATIVE_DEBUGGER) && GEA_NATIVE_DEBUGGER
|
|
1775
|
+
// Highlights append commands outside node paint ranges. Their forced
|
|
1776
|
+
// full record includes ancestor clips, so replay that complete stream.
|
|
1777
|
+
if (debuggerOverlay.slot >= 0)
|
|
1778
|
+
DisplayList::instance().replay();
|
|
1779
|
+
else
|
|
1780
|
+
#endif
|
|
1781
|
+
{
|
|
1782
|
+
const DisplayReplayRegion region{0, 0, width - 1, height - 1, -1};
|
|
1783
|
+
DisplayList::instance().replayDirectDirtyRegions(®ion, 1);
|
|
1784
|
+
}
|
|
1748
1785
|
}
|
|
1749
1786
|
gea::platform::display::Display::popClip();
|
|
1750
|
-
// Restore the shared canvas onto the real framebuffer before the frame task resumes.
|
|
1751
|
-
gea::platform::display::Display::rebindCanvasToFramebuffer();
|
|
1752
1787
|
const int pixels = width * height;
|
|
1753
1788
|
for (int i = 0; i < pixels; i++)
|
|
1754
1789
|
dst[i] = gea::framework::graphics::pixel::toRgb565(base[i]);
|
|
@@ -1856,6 +1891,7 @@ namespace gea::embedded::ui
|
|
|
1856
1891
|
state.canvases.forEach([](CanvasSurfaceState &surface)
|
|
1857
1892
|
{
|
|
1858
1893
|
if (auto *canvas = surface.canvas()) canvas->resetDirty(); });
|
|
1894
|
+
CanvasRenderingContext2D::clearRetainedCanvasDamage();
|
|
1859
1895
|
LayoutSnapshot::capture();
|
|
1860
1896
|
}
|
|
1861
1897
|
|
|
@@ -2042,6 +2078,9 @@ namespace gea::embedded::ui
|
|
|
2042
2078
|
auto &state = treeState();
|
|
2043
2079
|
if (root < 0 || root >= state.nodeCount)
|
|
2044
2080
|
return;
|
|
2081
|
+
#if defined(GEA_NATIVE_DEBUGGER) && GEA_NATIVE_DEBUGGER
|
|
2082
|
+
debuggerOverlay.prepare();
|
|
2083
|
+
#endif
|
|
2045
2084
|
const bool viewportChanged = gLayoutViewportRoot != root ||
|
|
2046
2085
|
gLayoutViewportWidth != width || gLayoutViewportHeight != height;
|
|
2047
2086
|
if (viewportChanged) {
|
|
@@ -2064,7 +2103,7 @@ namespace gea::embedded::ui
|
|
|
2064
2103
|
// that must take the framebuffer path after banded ones first repaints the
|
|
2065
2104
|
// whole viewport into it: a structural rebuild does exactly that.
|
|
2066
2105
|
const bool banded = bandedUiEligible();
|
|
2067
|
-
const bool framebufferReadable = !banded && !gBandedFramebufferStaleFlag;
|
|
2106
|
+
const bool framebufferReadable = !GEA_EMBEDDED_DISPLAY_FUSE_REPLAY_FLUSH && !banded && !gBandedFramebufferStaleFlag;
|
|
2068
2107
|
if (!banded && gBandedFramebufferStaleFlag)
|
|
2069
2108
|
{
|
|
2070
2109
|
state.displayListDirty = true;
|
|
@@ -2075,7 +2114,7 @@ namespace gea::embedded::ui
|
|
|
2075
2114
|
}
|
|
2076
2115
|
#else
|
|
2077
2116
|
constexpr bool banded = false;
|
|
2078
|
-
constexpr bool framebufferReadable =
|
|
2117
|
+
constexpr bool framebufferReadable = !GEA_EMBEDDED_DISPLAY_FUSE_REPLAY_FLUSH;
|
|
2079
2118
|
#endif
|
|
2080
2119
|
const bool textClipDependencies = DisplayList::instance().hasTextClippedBackgrounds();
|
|
2081
2120
|
if (textClipDependencies) {
|
|
@@ -2094,6 +2133,27 @@ namespace gea::embedded::ui
|
|
|
2094
2133
|
if (framebufferReadable && !textClipDependencies && state.pendingScrollIntoViewNode < 0 && RootScrollOnlyRefresh::refresh(root, width, height))
|
|
2095
2134
|
return;
|
|
2096
2135
|
|
|
2136
|
+
bool scrollFallbackRepaint = false;
|
|
2137
|
+
#if GEA_CSS_SCROLLING
|
|
2138
|
+
// A rejected scroll blit still moves every descendant's geometry during
|
|
2139
|
+
// layout. The reflow guard deliberately leaves those descendants clean
|
|
2140
|
+
// when their movement equals the ancestor scroll delta, so their retained
|
|
2141
|
+
// commands cannot be left unchanged on this fallback path. Re-record the
|
|
2142
|
+
// existing tree and repaint its underlay: a transparent scroller has no
|
|
2143
|
+
// background command capable of erasing the previous content. Fused flush
|
|
2144
|
+
// also cannot blit its stale PSRAM framebuffer; it draws directly into DMA.
|
|
2145
|
+
for (int i = 0; i < state.nodeCount; ++i) {
|
|
2146
|
+
const Node &node = state.nodes[i];
|
|
2147
|
+
if (node.render.scroll_dirty &&
|
|
2148
|
+
(node.layout.scroll_x != node.layout.previous_scroll_x ||
|
|
2149
|
+
node.layout.scroll_y != node.layout.previous_scroll_y)) {
|
|
2150
|
+
markDisplayListContentDirty();
|
|
2151
|
+
scrollFallbackRepaint = true;
|
|
2152
|
+
break;
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
#endif
|
|
2156
|
+
|
|
2097
2157
|
// This frame is NOT a pure scroll, so the software scroll register's
|
|
2098
2158
|
// circular row rotation (engaged by Display::scrollRect during the fast
|
|
2099
2159
|
// path above) must not survive into it: content drawn now would mix
|
|
@@ -2561,6 +2621,10 @@ namespace gea::embedded::ui
|
|
|
2561
2621
|
GEA_REFRESH_PERF(perf.treeRecordedNodes += state.nodeCount);
|
|
2562
2622
|
GEA_REFRESH_PERF(perf.treeRecordedCommands += DisplayList::instance().commandCount());
|
|
2563
2623
|
}
|
|
2624
|
+
#if defined(GEA_NATIVE_DEBUGGER) && GEA_NATIVE_DEBUGGER
|
|
2625
|
+
if (displayListFullRecord)
|
|
2626
|
+
debuggerOverlay.record(root, width, height);
|
|
2627
|
+
#endif
|
|
2564
2628
|
if (displayListFullRecord)
|
|
2565
2629
|
GEA_REFRESH_PERF(perf.treeFullRecords++);
|
|
2566
2630
|
if (reprojected)
|
|
@@ -2583,6 +2647,12 @@ namespace gea::embedded::ui
|
|
|
2583
2647
|
int flush_rect_count = 0;
|
|
2584
2648
|
bool preserveFlushOnlyRecolorRegions = false;
|
|
2585
2649
|
const std::int64_t dirtyCollectStartUs = refreshPerfNowUs();
|
|
2650
|
+
// A fresh content-only recording is just as replayable as retained
|
|
2651
|
+
// commands. Re-evaluate the compositing guard after recording rather
|
|
2652
|
+
// than forcing unrelated static content into the general path merely
|
|
2653
|
+
// because an empty image range needed its first command.
|
|
2654
|
+
if (displayListFullRecord && !display_list_was_structural)
|
|
2655
|
+
direct_replay = DisplayList::instance().canReplayDirectDirtyRegions(width, height);
|
|
2586
2656
|
if (framebuffer_was_dirty)
|
|
2587
2657
|
direct_replay = 0;
|
|
2588
2658
|
const int transformedShapeCount = transformedLeafDirtyShapeCount();
|
|
@@ -2625,9 +2695,67 @@ namespace gea::embedded::ui
|
|
|
2625
2695
|
int canvas_x0 = 0, canvas_y0 = 0, canvas_x1 = -1, canvas_y1 = -1;
|
|
2626
2696
|
const auto *canvas_surface = n->type == NodeType::Canvas ? state.canvases.find(i) : nullptr;
|
|
2627
2697
|
const auto *canvas = canvas_surface ? canvas_surface->canvas() : nullptr;
|
|
2628
|
-
const bool
|
|
2629
|
-
|
|
2630
|
-
|
|
2698
|
+
const bool bitmap_canvas_dirty =
|
|
2699
|
+
canvas_surface && canvas && canvas->dirty(&canvas_x0, &canvas_y0, &canvas_x1, &canvas_y1);
|
|
2700
|
+
int retained_x0, retained_y0, retained_x1, retained_y1;
|
|
2701
|
+
const bool retained_canvas_dirty =
|
|
2702
|
+
n->type == NodeType::Canvas && CanvasRenderingContext2D::retainedCanvasDamage(
|
|
2703
|
+
i, retained_x0, retained_y0, retained_x1, retained_y1);
|
|
2704
|
+
bool canvas_dirty = bitmap_canvas_dirty || retained_canvas_dirty;
|
|
2705
|
+
|
|
2706
|
+
// Drawing into an unchanged owned bitmap cannot spill beyond its pixels.
|
|
2707
|
+
// CSS antialiasing guards belong to style/geometry changes, not this damage.
|
|
2708
|
+
bool exactCanvasPixelDamage =
|
|
2709
|
+
canvas_dirty &&
|
|
2710
|
+
(retained_canvas_dirty || (canvas_surface && !canvas_surface->displayBacked())) &&
|
|
2711
|
+
n->render.canvas_pixels_only_dirty && !n->render.layout_dirty && !n->render.transform_dirty &&
|
|
2712
|
+
n->first_child < 0 && n->layout.x == n->layout.previous_x &&
|
|
2713
|
+
n->layout.y == n->layout.previous_y && n->layout.width == n->layout.previous_width &&
|
|
2714
|
+
n->layout.height == n->layout.previous_height &&
|
|
2715
|
+
(retained_canvas_dirty ||
|
|
2716
|
+
(canvas && canvas->width() == n->layout.width && canvas->height() == n->layout.height)) &&
|
|
2717
|
+
!ViewRenderer::anyTransformActive();
|
|
2718
|
+
int canvasAncestorSteps = 0;
|
|
2719
|
+
for (int ancestor = i; exactCanvasPixelDamage && ancestor >= 0;
|
|
2720
|
+
ancestor = state.nodes[ancestor].parent)
|
|
2721
|
+
{
|
|
2722
|
+
if (ancestor >= state.nodeCount || ++canvasAncestorSteps > state.nodeCount)
|
|
2723
|
+
{
|
|
2724
|
+
exactCanvasPixelDamage = false;
|
|
2725
|
+
break;
|
|
2726
|
+
}
|
|
2727
|
+
const auto &owner = state.nodes[ancestor];
|
|
2728
|
+
const auto &style = owner.computedStyle();
|
|
2729
|
+
exactCanvasPixelDamage = !hasAnyBorder(style) && style.mask_right_fade_width == 0 &&
|
|
2730
|
+
(GEA_CSS_FILTERS ? rstyle(style).filter_blur_radius : 0) <= 0 &&
|
|
2731
|
+
owner.render.previous_filter_blur_radius <= 0 &&
|
|
2732
|
+
(GEA_CSS_BOX_SHADOW ? rstyle(style).box_shadow_alpha : 0) == 0;
|
|
2733
|
+
}
|
|
2734
|
+
|
|
2735
|
+
if (retained_canvas_dirty && exactCanvasPixelDamage)
|
|
2736
|
+
{
|
|
2737
|
+
if (bitmap_canvas_dirty)
|
|
2738
|
+
{
|
|
2739
|
+
canvas_x0 = std::min(canvas_x0, retained_x0);
|
|
2740
|
+
canvas_y0 = std::min(canvas_y0, retained_y0);
|
|
2741
|
+
canvas_x1 = std::max(canvas_x1, retained_x1);
|
|
2742
|
+
canvas_y1 = std::max(canvas_y1, retained_y1);
|
|
2743
|
+
}
|
|
2744
|
+
else
|
|
2745
|
+
{
|
|
2746
|
+
canvas_x0 = retained_x0;
|
|
2747
|
+
canvas_y0 = retained_y0;
|
|
2748
|
+
canvas_x1 = retained_x1;
|
|
2749
|
+
canvas_y1 = retained_y1;
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2752
|
+
if (canvas_dirty && !exactCanvasPixelDamage)
|
|
2753
|
+
{
|
|
2754
|
+
// A style/geometry invalidation is not a content-only repaint. Both
|
|
2755
|
+
// bitmap and retained hints must yield to full previous/current boxes;
|
|
2756
|
+
// otherwise a moved canvas leaves its old fringe behind.
|
|
2757
|
+
canvas_dirty = false;
|
|
2758
|
+
}
|
|
2631
2759
|
|
|
2632
2760
|
// Glyph-incremental text dirty: setText found that only a middle run of glyphs
|
|
2633
2761
|
// changed within an unchanged box. Flush just that run across the node's height
|
|
@@ -2897,13 +3025,15 @@ namespace gea::embedded::ui
|
|
|
2897
3025
|
// replaying overlapping siblings, such as overlay labels, in the
|
|
2898
3026
|
// original draw order.
|
|
2899
3027
|
const DirtyRegions::Rect dirtyRect =
|
|
2900
|
-
|
|
3028
|
+
exactCanvasPixelDamage ? DirtyRegions::Rect{dr_x0, dr_y0, dr_x1, dr_y1, i}
|
|
3029
|
+
: dirtyRectWithRasterGuard(*n, DirtyRegions::Rect{dr_x0, dr_y0, dr_x1, dr_y1, i});
|
|
2901
3030
|
addDirtyRegion(rects, &rect_count, dirtyRect, width, height);
|
|
2902
3031
|
if (!unifiedRectPath)
|
|
2903
3032
|
addDirtyRegion(flush_rects, &flush_rect_count, dirtyRect, width, height);
|
|
2904
3033
|
}
|
|
2905
|
-
if (display_list_was_dirty && display_list_was_structural && width > 0 && height > 0)
|
|
3034
|
+
if (((display_list_was_dirty && display_list_was_structural) || scrollFallbackRepaint) && width > 0 && height > 0)
|
|
2906
3035
|
{
|
|
3036
|
+
// A scroll fallback must erase old content through its root underlay.
|
|
2907
3037
|
// A STRUCTURAL command-list rebuild can change draw order, alpha scopes,
|
|
2908
3038
|
// or which commands exist. Repaint the viewport once so the framebuffer
|
|
2909
3039
|
// matches the rebuilt scene instead of relying on stale incremental
|
|
@@ -3034,8 +3164,14 @@ namespace gea::embedded::ui
|
|
|
3034
3164
|
}
|
|
3035
3165
|
#endif
|
|
3036
3166
|
const bool hasFlushOnlyRecolorRegions = preserveFlushOnlyRecolorRegions && flush_rect_count > 0;
|
|
3167
|
+
DisplayReplayRegion simpleTransferRegions[DirtyRegions::kMaxRects];
|
|
3168
|
+
for (int i = 0; i < flush_rect_count; ++i)
|
|
3169
|
+
{
|
|
3170
|
+
const auto &r = flush_rects[i];
|
|
3171
|
+
simpleTransferRegions[i] = DisplayReplayRegion{r.x0, r.y0, r.x1, r.y1, -1};
|
|
3172
|
+
}
|
|
3037
3173
|
const bool simpleDirtyReplayAvailable =
|
|
3038
|
-
direct_replay && unifiedRectPath && DisplayList::instance().canReplaySimpleDirtyRegions(width, height);
|
|
3174
|
+
direct_replay && unifiedRectPath && DisplayList::instance().canReplaySimpleDirtyRegions(width, height, simpleTransferRegions, flush_rect_count);
|
|
3039
3175
|
const bool simpleUnifiedReplay = simpleDirtyReplayAvailable && rect_count > 0 && !hasFlushOnlyRecolorRegions;
|
|
3040
3176
|
const bool interleavedUnifiedFlush =
|
|
3041
3177
|
direct_replay && unifiedRectPath && rect_count > 0 && !simpleDirtyReplayAvailable && !hasFlushOnlyRecolorRegions;
|
|
@@ -3368,6 +3504,7 @@ namespace gea::embedded::ui
|
|
|
3368
3504
|
state.canvases.forEach([](CanvasSurfaceState &surface)
|
|
3369
3505
|
{
|
|
3370
3506
|
if (auto *canvas = surface.canvas()) canvas->resetDirty(); });
|
|
3507
|
+
CanvasRenderingContext2D::clearRetainedCanvasDamage();
|
|
3371
3508
|
#if !defined(GEA_EMBEDDED_DIRECT_CANVAS_CONTEXT) || !GEA_EMBEDDED_DIRECT_CANVAS_CONTEXT
|
|
3372
3509
|
// displayCanvas is only declared when the direct-canvas context is off (see the
|
|
3373
3510
|
// guard at its declaration above); with direct canvas it is always null, so the
|
|
@@ -3397,6 +3534,9 @@ namespace gea::embedded::ui
|
|
|
3397
3534
|
if (timestamp_ms < 0)
|
|
3398
3535
|
timestamp_ms = 0;
|
|
3399
3536
|
state.lastFrameMs = timestamp_ms;
|
|
3537
|
+
#if defined(GEA_NATIVE_DEBUGGER) && GEA_NATIVE_DEBUGGER
|
|
3538
|
+
debuggerOverlay.prepare();
|
|
3539
|
+
#endif
|
|
3400
3540
|
|
|
3401
3541
|
if (state.inputTickRequired)
|
|
3402
3542
|
tickInput(timestamp_ms);
|
package/ui/tree_style.cpp
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
#include "display_invalidation.h"
|
|
3
|
+
#include <image.h>
|
|
3
4
|
#include "internal.h"
|
|
4
5
|
#include "node_lifecycle.h"
|
|
5
6
|
#include "refresh_perf.h"
|
|
@@ -1052,7 +1053,15 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
1052
1053
|
}
|
|
1053
1054
|
#endif
|
|
1054
1055
|
#if GEA_UI_IMAGE_NODES
|
|
1055
|
-
case Property::ImageId:
|
|
1056
|
+
case Property::ImageId:
|
|
1057
|
+
if (n->image_id != value) {
|
|
1058
|
+
auto &images = gea::framework::graphics::ImageStore::instance();
|
|
1059
|
+
images.retain(value);
|
|
1060
|
+
images.release(n->image_id);
|
|
1061
|
+
n->image_id = value;
|
|
1062
|
+
changed = 1;
|
|
1063
|
+
}
|
|
1064
|
+
break;
|
|
1056
1065
|
#endif
|
|
1057
1066
|
#if GEA_CSS_IMAGE_FIT
|
|
1058
1067
|
case Property::ImageFit: if (style.image_fit != value) { style.image_fit = value; changed = 1; } break;
|
|
@@ -1155,6 +1164,7 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
1155
1164
|
GEA_REFRESH_PERF(perf.treeSetStylePaintChanged++);
|
|
1156
1165
|
if (state.styleInvalidationSuppressionDepth > 0) return;
|
|
1157
1166
|
if (!nodeParticipatesInMountedTree(state, node)) return;
|
|
1167
|
+
n->render.canvas_pixels_only_dirty = 0;
|
|
1158
1168
|
const bool hadRecolor = n->render.bg_recolor_pending;
|
|
1159
1169
|
const bool canRecolor = !n->render.dirty || hadRecolor;
|
|
1160
1170
|
n->render.text_partial_dirty = 0;
|
|
@@ -1238,7 +1248,13 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
1238
1248
|
// and recreating it during a fade. patchNodeAlpha returns false when
|
|
1239
1249
|
// no scope exists (for example, an initially opaque or culled node),
|
|
1240
1250
|
// so those cases still take the ordinary recording path below.
|
|
1241
|
-
|
|
1251
|
+
const auto *textCommand = n->type == NodeType::Text && n->first_child < 0 &&
|
|
1252
|
+
DisplayList::instance().nodeCommandCount(node) == 1
|
|
1253
|
+
? DisplayList::instance().nodeCommandAt(node, 0) : nullptr;
|
|
1254
|
+
const bool plainText = textCommand && textCommand->type == DisplayCommandType::DrawText &&
|
|
1255
|
+
n->layout.height >= std::max(16, static_cast<int>(style.font_size)) &&
|
|
1256
|
+
n->layout.height >= style.line_height;
|
|
1257
|
+
if ((stayLocal || plainText) &&
|
|
1242
1258
|
DisplayList::instance().patchNodeAlpha(node, static_cast<uint8_t>(style.opacity)))
|
|
1243
1259
|
return;
|
|
1244
1260
|
// Crossing the 255 boundary (scope appears/disappears) or a non-leaf:
|
|
@@ -1264,7 +1280,12 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
1264
1280
|
// full-viewport repaint). Display toggles (visibility/order) and
|
|
1265
1281
|
// filter/box-shadow (pixel spillover past the node box) keep the
|
|
1266
1282
|
// conservative full repaint.
|
|
1267
|
-
|
|
1283
|
+
// Undersized text boxes can paint glyphs outside their layout damage
|
|
1284
|
+
// region. Their opacity fallback must clear that overflow as well.
|
|
1285
|
+
const bool overflowingText = n->type == NodeType::Text &&
|
|
1286
|
+
(n->layout.height < std::max(16, static_cast<int>(style.font_size)) ||
|
|
1287
|
+
n->layout.height < style.line_height);
|
|
1288
|
+
if (prop == Property::Opacity && !overflowingText)
|
|
1268
1289
|
tree.markDisplayListContentDirty();
|
|
1269
1290
|
else
|
|
1270
1291
|
tree.markDisplayListDirty();
|
|
@@ -1315,6 +1336,7 @@ void Tree::resetStyleForClassRecompute(int node)
|
|
|
1315
1336
|
|
|
1316
1337
|
state.nodes[node].resetComputedStyle();
|
|
1317
1338
|
#if GEA_UI_IMAGE_NODES
|
|
1339
|
+
gea::framework::graphics::ImageStore::instance().release(state.nodes[node].image_id);
|
|
1318
1340
|
state.nodes[node].image_id = -1;
|
|
1319
1341
|
#endif
|
|
1320
1342
|
if (state.styleInvalidationSuppressionDepth > 0) return;
|
package/ui/view.cpp
CHANGED
|
@@ -1012,8 +1012,8 @@ public:
|
|
|
1012
1012
|
{
|
|
1013
1013
|
const RareStyle &r = rstyle(node.computedStyle());
|
|
1014
1014
|
e.x = node.layout.x; e.y = node.layout.y; e.w = node.layout.width; e.h = node.layout.height;
|
|
1015
|
-
e.ox = e.x +
|
|
1016
|
-
e.oy = e.y +
|
|
1015
|
+
e.ox = e.x + resolveOriginOffset(r.transform_origin_x, e.w);
|
|
1016
|
+
e.oy = e.y + resolveOriginOffset(r.transform_origin_y, e.h);
|
|
1017
1017
|
if (!hasTransformableBox(node)) {
|
|
1018
1018
|
std::fill(std::begin(e.matrix), std::end(e.matrix), 0.0f);
|
|
1019
1019
|
e.matrix[0] = e.matrix[4] = e.matrix[8] = 1.0f;
|
|
@@ -1043,8 +1043,8 @@ public:
|
|
|
1043
1043
|
return;
|
|
1044
1044
|
}
|
|
1045
1045
|
const float w = node.layout.previous_width, h = node.layout.previous_height;
|
|
1046
|
-
e.pOx = node.layout.previous_x +
|
|
1047
|
-
e.pOy = node.layout.previous_y +
|
|
1046
|
+
e.pOx = node.layout.previous_x + resolveOriginOffset(r.previous_transform_origin_x, w);
|
|
1047
|
+
e.pOy = node.layout.previous_y + resolveOriginOffset(r.previous_transform_origin_y, h);
|
|
1048
1048
|
fillLinear(e.previousMatrix, r.previous_transform_rotate_x, r.previous_transform_rotate_y, r.previous_transform_rotate,
|
|
1049
1049
|
r.previous_transform_scale_x, r.previous_transform_scale_y, r.previous_transform_scale_z);
|
|
1050
1050
|
auto shift = listTranslation({r.previous_transform_translate_x - r.previous_translate_x + w*(r.previous_transform_translate_x_percent-r.previous_translate_x_percent)*kInv1000f,
|
|
@@ -1168,8 +1168,8 @@ public:
|
|
|
1168
1168
|
const auto &parent = state.nodes[id];
|
|
1169
1169
|
const auto &rare = rstyle(parent.computedStyle());
|
|
1170
1170
|
if (hasTransformableBox(parent) && rare.perspective > 0) {
|
|
1171
|
-
const float ox = parent.layout.x + parent.layout.width
|
|
1172
|
-
const float oy = parent.layout.y + parent.layout.height
|
|
1171
|
+
const float ox = parent.layout.x + resolveOriginOffset(rare.perspective_origin_x, parent.layout.width);
|
|
1172
|
+
const float oy = parent.layout.y + resolveOriginOffset(rare.perspective_origin_y, parent.layout.height);
|
|
1173
1173
|
normal.z += (offset + normal.x * ox + normal.y * oy) / rare.perspective;
|
|
1174
1174
|
}
|
|
1175
1175
|
if (!hasTransformableBox(parent) || !preserves3D(parent.computedStyle())) break;
|
|
@@ -1272,8 +1272,8 @@ public:
|
|
|
1272
1272
|
const int originX = usePrevious ? node.render.previous_perspective_origin_x : rs.perspective_origin_x;
|
|
1273
1273
|
const int originY = usePrevious ? node.render.previous_perspective_origin_y : rs.perspective_origin_y;
|
|
1274
1274
|
if (perspective <= 0) return;
|
|
1275
|
-
const float poX = static_cast<float>(x) +
|
|
1276
|
-
const float poY = static_cast<float>(y) +
|
|
1275
|
+
const float poX = static_cast<float>(x) + resolveOriginOffset(originX, w);
|
|
1276
|
+
const float poY = static_cast<float>(y) + resolveOriginOffset(originY, h);
|
|
1277
1277
|
float scale = static_cast<float>(perspective) / (static_cast<float>(perspective) - p.z);
|
|
1278
1278
|
if (!std::isfinite(scale)) scale = 1.0f;
|
|
1279
1279
|
if (scale < 0.05f) scale = 0.05f;
|