diff options
author | culler <culler> | 2018-11-07 21:17:25 (GMT) |
---|---|---|
committer | culler <culler> | 2018-11-07 21:17:25 (GMT) |
commit | 6a78e0b7fc7c69f35442f490812e5265db8e8470 (patch) | |
tree | 86af0c57abcf76c8e38e1e180055bed0a93187e8 /macosx/tkMacOSXImage.c | |
parent | 52bdce0ef2fe1a7ad9884d739ccab438740b4db1 (diff) | |
download | tk-6a78e0b7fc7c69f35442f490812e5265db8e8470.zip tk-6a78e0b7fc7c69f35442f490812e5265db8e8470.tar.gz tk-6a78e0b7fc7c69f35442f490812e5265db8e8470.tar.bz2 |
Fix two image bugs. BitmapImageReps may have bytesPerRow > 4*width. Do not copy
from a window to a bitmap if the contentView does not have a valid graphics context.
Diffstat (limited to 'macosx/tkMacOSXImage.c')
-rw-r--r-- | macosx/tkMacOSXImage.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c index 096faac..861b7ab 100644 --- a/macosx/tkMacOSXImage.c +++ b/macosx/tkMacOSXImage.c @@ -206,7 +206,7 @@ XGetImage( (bitmap_fmt != 0 && bitmap_fmt != 1) || [bitmap_rep samplesPerPixel] != 4 || [bitmap_rep isPlanar] != 0 || - bytes_per_row != 4 * scaled_width || + bytes_per_row < 4 * scaled_width || size != bytes_per_row*scaled_height ) { TkMacOSXDbgMsg("XGetImage: Unrecognized bitmap format"); CFRelease(bitmap_rep); @@ -237,8 +237,8 @@ XGetImage( */ struct pixel_fmt pixel = bitmap_fmt == 0 ? bgra : abgr; - for (row=0, n=0; row<scaled_height; row++, n+=bytes_per_row) { - for (m=n; m<n+bytes_per_row; m+=4) { + for (row = 0, n = 0; row < scaled_height; row++, n += bytes_per_row) { + for (m = n; m < n + 4*scaled_width; m += 4) { R = *(bitmap + m + pixel.r); G = *(bitmap + m + pixel.g); B = *(bitmap + m + pixel.b); |