summaryrefslogtreecommitdiff
path: root/src/Fl_Bitmap.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-04-13 09:30:31 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-04-13 09:30:31 +0200
commite25758582e49c1887fcde4c16da761428fe6f5fa (patch)
tree438ec4e1c265131e5c71d4cbf2e339caf7b3b9c2 /src/Fl_Bitmap.cxx
parentbfae813c4e15ec0a45a7b2cdecf32c3aac2776eb (diff)
Fix for issue #427 - continued.
Diffstat (limited to 'src/Fl_Bitmap.cxx')
-rw-r--r--src/Fl_Bitmap.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Fl_Bitmap.cxx b/src/Fl_Bitmap.cxx
index 4767c7815..f760ac979 100644
--- a/src/Fl_Bitmap.cxx
+++ b/src/Fl_Bitmap.cxx
@@ -60,13 +60,12 @@ Fl_Image *Fl_Bitmap::copy(int W, int H) {
uchar *new_array; // New array for image data
// Optimize the simple copy where the width and height are the same...
- if (W == w() && H == h()) {
- new_array = new uchar [data_h() * ((data_w() + 7) / 8)];
- memcpy(new_array, array, data_h() * ((data_w() + 7) / 8));
+ if (W == data_w() && H == data_h()) {
+ new_array = new uchar [H * ((W + 7) / 8)];
+ memcpy(new_array, array, H * ((W + 7) / 8));
- new_image = new Fl_Bitmap(new_array, data_w(), data_h());
+ new_image = new Fl_Bitmap(new_array, W, H);
new_image->alloc_array = 1;
- new_image->scale(w(), h(), 0, 1);
return new_image;
}
if (W <= 0 || H <= 0) return 0;