Skip to content

Commit 0478f1d

Browse files
committed
Core (LV::Video): Calculate pixel row pointer directly when validating.
1 parent 146633a commit 0478f1d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

libvisual/libvisual/lv_video.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ namespace LV {
330330
// Validate parent-child relations.
331331

332332
if (m_impl->parent) {
333-
auto parent_impl = m_impl->parent->m_impl.get ();
333+
auto const parent_impl = m_impl->parent->m_impl.get ();
334334
if (!parent_impl->extents.contains (m_impl->extents)) {
335335
visual_log (VISUAL_LOG_ERROR, "Sub-video is not fully contained by parent.");
336336
return false;
@@ -348,15 +348,13 @@ namespace LV {
348348

349349
// Validate pixel row table
350350

351-
auto pixel_row_ptr = static_cast<uint8_t const*> (get_pixels ());
352-
353351
for (int y = 0; y < m_impl->height; y++) {
352+
auto const pixel_row_ptr = static_cast<uint8_t const*> (get_pixels ()) + y * m_impl->pitch;
353+
354354
if (m_impl->pixel_rows[y] != pixel_row_ptr) {
355355
visual_log (VISUAL_LOG_ERROR, "Pixel row pointer table is wrong at y=%d.", y);
356356
return false;
357357
}
358-
359-
pixel_row_ptr += m_impl->pitch;
360358
}
361359
}
362360

0 commit comments

Comments
 (0)