[Digikam-devel] [Bug 137236] disable autozoom when picture fits in window
Gilles Caulier
caulier.gilles at gmail.com
Tue Mar 20 08:26:44 GMT 2007
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=137236
caulier.gilles gmail com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From caulier.gilles gmail com 2007-03-20 09:26 -------
SVN commit 644497 by cgilles:
digikam from trunk : with small image, autozoom button will adapt image size to canvas size.
BUG: 137236
M +9 -17 canvas.cpp
--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp #644496:644497
@ -351,20 +351,13 @
void Canvas::updateAutoZoom()
{
- double srcWidth, srcHeight, dstWidth, dstHeight;
+ double srcWidth = d->im->origWidth();
+ double srcHeight = d->im->origHeight();
+ double dstWidth = contentsRect().width();
+ double dstHeight = contentsRect().height();
- srcWidth = d->im->origWidth();
- srcHeight = d->im->origHeight();
- dstWidth = contentsRect().width();
- dstHeight = contentsRect().height();
+ d->zoom = QMIN(dstWidth/srcWidth, dstHeight/srcHeight);
- if (dstWidth > srcWidth &&
- dstHeight > srcHeight)
- d->zoom = 1.0;
- else
- d->zoom = QMIN(dstWidth/srcWidth,
- dstHeight/srcHeight);
-
d->im->zoom(d->zoom);
emit signalZoomChanged(d->zoom);
@ -401,8 +394,8 @
int centery = contentsRect().height()/2;
int xoffset = int(centerx - wZ/2);
int yoffset = int(centery - hZ/2);
- xoffset = QMAX(xoffset, 0);
- yoffset = QMAX(yoffset, 0);
+ xoffset = QMAX(xoffset, 0);
+ yoffset = QMAX(yoffset, 0);
d->pixmapRect = QRect(xoffset, yoffset, wZ, hZ);
}
@ -572,13 +565,12 @
p.setBrush(NoBrush);
QRect r(d->rubber->normalize());
- r = QRect(contentsToViewport(QPoint(r.x(),r.y())), r.size());
+ r = QRect(contentsToViewport(QPoint(r.x(), r.y())), r.size());
QPoint pnt(r.x(), r.y());
style().drawPrimitive(QStyle::PE_FocusRect, &p,
- QRect( pnt.x(), pnt.y(),
- r.width(), r.height() ),
+ QRect(pnt.x(), pnt.y(), r.width(), r.height()),
colorGroup(), QStyle::Style_Default,
QStyleOption(colorGroup().base()));
p.end();
More information about the Digikam-devel
mailing list