X-Git-Url: https://git.decadent.org.uk/gitweb/?p=videolink.git;a=blobdiff_plain;f=pixbufs.cpp;h=2cef5d3eebd1d0f1f5129465065b3f4a7a1e14c5;hp=d6936de31abcfeb918af1358e9c8091d913cc6ad;hb=HEAD;hpb=c5f98ff303d670f72a5d491a5f4e1989d2043219 diff --git a/pixbufs.cpp b/pixbufs.cpp index d6936de..2cef5d3 100644 --- a/pixbufs.cpp +++ b/pixbufs.cpp @@ -1,4 +1,4 @@ -// Copyright 2005 Ben Hutchings . +// Copyright 2005-6 Ben Hutchings . // See the file "COPYING" for licence details. #include "pixbufs.hpp" @@ -14,9 +14,9 @@ // (or RGBA, but the alpha component will be ignored) and copy the // differing pixels from the new one to a third RGBA Pixbuf at the // specified offset with full opacity. -// The width and height of the old and new Pixbufs must be equal -// and match the specified dimensions. The width and height of -// the third Pixbuf must be large enough to store a rectangle of +// The width and height of the new Pixbufs must be equal and match +// the specified dimensions. The width and height of the old and +// third Pixbuf must be large enough to store a rectangle of // those dimensions at the specified offset. void diff_rgb_pixbufs(Glib::RefPtr old_buf, Glib::RefPtr new_buf, @@ -31,8 +31,8 @@ void diff_rgb_pixbufs(Glib::RefPtr old_buf, int old_bpr = old_buf->get_rowstride(); int old_bpp = old_buf->get_n_channels(); assert(old_bpp >= 3); - assert(old_buf->get_width() == width); - assert(old_buf->get_height() == height); + assert(old_buf->get_width() >= offset_x + width); + assert(old_buf->get_height() >= offset_y + height); int new_bpr = new_buf->get_rowstride(); int new_bpp = new_buf->get_n_channels(); assert(new_bpp >= 3); @@ -44,7 +44,9 @@ void diff_rgb_pixbufs(Glib::RefPtr old_buf, assert(diff_buf->get_width() >= offset_x + width); assert(diff_buf->get_height() >= offset_y + height); - const guint8 * old_p = old_buf->get_pixels(); + const guint8 * old_p = (old_buf->get_pixels() + + old_bpr * offset_y + + old_bpp * offset_x); const guint8 * new_p = new_buf->get_pixels(); guint8 * diff_p = (diff_buf->get_pixels() + diff_bpr * offset_y