From e3670dfda6799aa92ed30c770dd9c811f4d74b54 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Fri, 14 Oct 2016 16:35:52 +0000 Subject: Fix inconsistent interpretation of ld() in image handling (STR #3308). Documentation has been fixed and clarified, and ld() handling is now consistent in Fl_(RGB_)Image, their subclasses and fl_draw_image() and similar functions. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12029 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- fluid/Fluid_Image.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'fluid') diff --git a/fluid/Fluid_Image.cxx b/fluid/Fluid_Image.cxx index bbaa423e0..653d45abc 100644 --- a/fluid/Fluid_Image.cxx +++ b/fluid/Fluid_Image.cxx @@ -3,7 +3,7 @@ // // Pixmap (and other images) label support for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2015 by Bill Spitzak and others. +// Copyright 1998-2016 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -123,7 +123,8 @@ void Fluid_Image::write_static() { image_header_written = write_number; } write_c("static const unsigned char %s[] =\n", idata_name); - write_cdata(img->data()[0], (img->w() * img->d() + img->ld()) * img->h()); + const int extra_data = img->ld() ? (img->ld()-img->w()*img->d()) : 0; + write_cdata(img->data()[0], (img->w() * img->d() + extra_data) * img->h()); write_c(";\n"); write_initializer("Fl_RGB_Image", "%s, %d, %d, %d, %d", idata_name, img->w(), img->h(), img->d(), img->ld()); } -- cgit v1.2.3