(Rob Lahaye): fix clipping when using the basic image loader.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3998 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-04-15 16:56:28 +00:00
parent 02962ba61a
commit 36c21f7712
2 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,6 @@
2002-04-16 Rob Lahaye <lahaye@users.sourceforge.net>
* GraphicsImageXPM.C: fix clipping for boundingbox y-coordinates
2002-04-08 Angus Leeming <a.leeming@ic.ac.uk>
* GraphicsCacheItem.C (findTargetFormat): fix bug waiting to bite:

View File

@ -244,11 +244,17 @@ void GImageXPM::clip(GParams const & params)
return;
dimension * new_data = image_.initialisedData(new_width, new_height);
dimension const * old_data = image_.data();
dimension * it = new_data;
dimension const * start_row = old_data;
for (size_t row = params.bb.yb; row < params.bb.yt; ++row) {
// The image is stored in memory from upper-left to lower-right,
// so we loop from yt to yb.
dimension const * old_data = image_.data();
dimension const * start_row = old_data +
image_.width() * (image_.height() - params.bb.yt);
// the Bounding Box dimensions are never less than zero, so we can use
// "unsigned int row" here
for (dimension row = params.bb.yb; row < params.bb.yt; ++row) {
dimension const * begin = start_row + params.bb.xl;
dimension const * end = start_row + params.bb.xr;
it = std::copy(begin, end, it);