修复频谱图bug

This commit is contained in:
2026-08-13 00:51:03 +08:00
parent 05263cd506
commit 75bb281d4e
4 changed files with 47 additions and 5 deletions
@@ -86,6 +86,28 @@ TEST(Renderive_Core2, EveryCurveInterpolationModeHasDistinctSamplingSemantics) {
EXPECT_LE(clipped.front().x, 0.0);
EXPECT_GE(clipped.back().x, 100.0);
}
TEST(Renderive_Core2, PainterScopedClipRestoresPreviousClip) {
detail::Blend2D_Color_Cache cache;
{
detail::Painter painter(cache, {8, 2});
{
const auto clip = painter.scoped_clip({0.0, 0.0, 4.0, 2.0});
painter.rect({0.0, 0.0, 8.0, 2.0}, Pen{.style = Line_Style::None},
Brush{Color::red(), Brush_Style::Solid});
}
{
const auto clip = painter.scoped_clip({4.0, 0.0, 4.0, 2.0});
painter.rect({0.0, 0.0, 8.0, 2.0}, Pen{.style = Line_Style::None},
Brush{Color::green(), Brush_Style::Solid});
}
}
const Image_View view = cache.view();
ASSERT_EQ(view.width, 8);
ASSERT_EQ(view.height, 2);
const auto* row = reinterpret_cast<const Pixel*>(view.data);
EXPECT_EQ(row[1], pack_rgba(255, 0, 0));
EXPECT_EQ(row[6], pack_rgba(0, 255, 0));
}
TEST(Renderive_Core2, BicubicHeatmapUsesRealCubicResampling) {
const std::array<Pixel, 16> source{
pack_rgba(255, 0, 0), pack_rgba(0, 0, 0), pack_rgba(255, 255, 255), pack_rgba(0, 0, 255),