From e2072ae00538dae9a295da16a21a8b6dd0fd69d3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 2 Jul 2010 14:59:59 -0600 Subject: [PATCH] Possible fix for setPixel bug on OS X --- src/calibre/gui2/pictureflow/pictureflow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/pictureflow/pictureflow.cpp b/src/calibre/gui2/pictureflow/pictureflow.cpp index d9d8fefef4..64c2c99b6c 100644 --- a/src/calibre/gui2/pictureflow/pictureflow.cpp +++ b/src/calibre/gui2/pictureflow/pictureflow.cpp @@ -84,6 +84,7 @@ typedef unsigned short QRgb565; #define REFLECTION_FACTOR 1.5 #define MAX(x, y) ((x > y) ? x : y) +#define MIN(x, y) ((x < y) ? x : y) #define RGB565_RED_MASK 0xF800 #define RGB565_GREEN_MASK 0x07E0 @@ -800,7 +801,7 @@ QRect PictureFlowPrivate::renderCenterSlide(const SlideInfo &slide) { QRect rect(buffer.width()/2 - sw/2, 0, sw, h-1); int left = rect.left(); - for(int x = 0; x < sh-1; x++) + for(int x = 0; x < MIN(h-1, sh-1); x++) for(int y = 0; y < sw; y++) buffer.setPixel(left + y, 1+x, src->pixel(x, y));