所有权指针明确

This commit is contained in:
2026-08-28 13:33:17 +08:00
parent 0bc281b6b9
commit e07d16ea74
70 changed files with 1387 additions and 960 deletions
+2 -2
View File
@@ -48,7 +48,7 @@ TEST(framebuffer_view, writes_only_the_requested_external_image_region) {
ASSERT_EQ(view.height, 6);
for (int y = 0; y < view.height; ++y) {
const auto* row = reinterpret_cast<const Pixel*>(
view.data + static_cast<std::ptrdiff_t>(y) * view.stride);
view.data.data() + static_cast<std::ptrdiff_t>(y) * view.stride);
for (int x = 0; x < view.width; ++x) {
const bool inside = x >= 2 && x < 5 && y >= 1 && y < 3;
EXPECT_EQ(row[x] != 0, inside) << "pixel " << x << ',' << y;
@@ -75,7 +75,7 @@ TEST(framebuffer_view, overlapping_views_share_the_same_authoritative_pixels) {
const Image_View view = framebuffer.view();
const auto pixel = [&](int x, int y) {
const auto* row = reinterpret_cast<const Pixel*>(
view.data + static_cast<std::ptrdiff_t>(y) * view.stride);
view.data.data() + static_cast<std::ptrdiff_t>(y) * view.stride);
return row[x];
};
EXPECT_NE(pixel(2, 2), 0u);