From: joncruz Date: Sun, 9 Apr 2006 08:15:46 +0000 (+0000) Subject: Fixed problem when swatches were larger than provided area X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2af58f480cb8b6c3c80e28f6d22b0dc99c0d0fa9;p=inkscape.git Fixed problem when swatches were larger than provided area --- diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index f48cc1ca0..bcb4d0282 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -208,8 +208,8 @@ void PreviewHolder::calcGridSize( const Gtk::Widget* thing, int itemCount, int& Gtk::Requisition req2; const_cast(thing)->size_request(req2); - int h2 = req.height / req2.height; - int w2 = req.width / req2.width; + int h2 = ((req2.height > 0) && (req.height > req2.height)) ? (req.height / req2.height) : 1; + int w2 = ((req2.width > 0) && (req.width > req2.width)) ? (req.width / req2.width) : 1; width = (itemCount + (h2 - 1)) / h2; if ( width < w2 ) { width = w2;