Browse Source

DebugTools: suggest member slicing instead of a cast.

pull/674/head
Vladimír Vondruš 1 year ago
parent
commit
98dfd3412e
  1. 2
      doc/snippets/DebugTools-gl.cpp
  2. 4
      src/Magnum/DebugTools/CompareImage.h

2
doc/snippets/DebugTools-gl.cpp

@ -216,7 +216,7 @@ ImageView2D expected{PixelFormat::RGB8Unorm, {}};
/* [CompareImage-pixels-rgb] */
Image2D image = fb.read(fb.viewport(), {PixelFormat::RGBA8Unorm});
CORRADE_COMPARE_AS(Containers::arrayCast<Color3ub>(image.pixels<Color4ub>()),
CORRADE_COMPARE_AS(image.pixels<Color4ub>().slice(&Color4ub::rgb),
"expected.png", DebugTools::CompareImageToFile);
/* [CompareImage-pixels-rgb] */
}

4
src/Magnum/DebugTools/CompareImage.h

@ -322,8 +322,8 @@ data flipped upside down:
For a different scenario, imagine you're comparing data read from a framebuffer
to a ground truth image. On many systems, internal framebuffer storage has to
be four-component; however your if your ground truth image is just
three-component you can cast the pixel data to just a three-component type:
be four-component; however your if your ground truth image is three-component
you can slice the pixel data to just the RGB channels:
@snippet DebugTools-gl.cpp CompareImage-pixels-rgb

Loading…
Cancel
Save