Add asserts to detect bugs adding cels w/pixel format != sprite's pixel format

This commit is contained in:
David Capello 2015-07-27 12:40:02 -03:00
parent 5a5579973c
commit 8f891a4e25
2 changed files with 14 additions and 0 deletions

View File

@ -156,7 +156,11 @@ Cel* LayerImage::getLastCel() const
void LayerImage::addCel(Cel* cel)
{
ASSERT(cel);
ASSERT(cel->data() && "The cel doesn't contain CelData");
ASSERT(cel->image());
ASSERT(sprite());
ASSERT(cel->image()->pixelFormat() == sprite()->pixelFormat());
CelIterator it = getCelBegin();
CelIterator end = getCelEnd();

View File

@ -134,6 +134,11 @@ static void compose_scaled_image_scale_up(
gfx::Clip area,
int opacity, BlendMode blend_mode, Zoom zoom)
{
ASSERT(dst);
ASSERT(src);
ASSERT(DstTraits::pixel_format == dst->pixelFormat());
ASSERT(SrcTraits::pixel_format == src->pixelFormat());
BlenderHelper<DstTraits, SrcTraits> blender(src, pal, blend_mode);
int px_x, px_y;
@ -261,6 +266,11 @@ static void compose_scaled_image_scale_down(
gfx::Clip area,
int opacity, BlendMode blend_mode, Zoom zoom)
{
ASSERT(dst);
ASSERT(src);
ASSERT(DstTraits::pixel_format == dst->pixelFormat());
ASSERT(SrcTraits::pixel_format == src->pixelFormat());
BlenderHelper<DstTraits, SrcTraits> blender(src, pal, blend_mode);
int unbox_w = zoom.remove(1);
int unbox_h = zoom.remove(1);