From 2b9be8a7e00405626664dc9d21cd59e236b899a8 Mon Sep 17 00:00:00 2001
From: Warwick Allison <warwick.allison@nokia.com>
Date: Tue, 11 Aug 2009 09:01:14 +1000
Subject: Clearer name for two PreserveAspect modes.

---
 doc/src/images/declarative-image_fillMode.gif | Bin 42648 -> 79561 bytes
 examples/declarative/fillmode/fillmode.qml    |   8 ++++----
 src/declarative/fx/qfximage.cpp               |   9 +++++----
 src/declarative/fx/qfximage.h                 |   2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/doc/src/images/declarative-image_fillMode.gif b/doc/src/images/declarative-image_fillMode.gif
index c81b4d7..eb0a9af 100644
Binary files a/doc/src/images/declarative-image_fillMode.gif and b/doc/src/images/declarative-image_fillMode.gif differ
diff --git a/examples/declarative/fillmode/fillmode.qml b/examples/declarative/fillmode/fillmode.qml
index d5d6bb5..f2a87c8 100644
--- a/examples/declarative/fillmode/fillmode.qml
+++ b/examples/declarative/fillmode/fillmode.qml
@@ -10,11 +10,11 @@ Image {
         SetPropertyAction { value: "Stretch" }
         SetPropertyAction { target: Label; property: "text"; value: "Stretch" }
         PauseAnimation { duration: 1000 }
-        SetPropertyAction { value: "PreserveAspect" }
-        SetPropertyAction { target: Label; property: "text"; value: "PreserveAspect" }
+        SetPropertyAction { value: "PreserveAspectFit" }
+        SetPropertyAction { target: Label; property: "text"; value: "PreserveAspectFit" }
         PauseAnimation { duration: 1000 }
-        SetPropertyAction { value: "PreserveAspectFill" }
-        SetPropertyAction { target: Label; property: "text"; value: "PreserveAspectFill" }
+        SetPropertyAction { value: "PreserveAspectCrop" }
+        SetPropertyAction { target: Label; property: "text"; value: "PreserveAspectCrop" }
         PauseAnimation { duration: 1000 }
         SetPropertyAction { value: "Tile" }
         SetPropertyAction { target: Label; property: "text"; value: "Tile" }
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp
index 985ddec..ec3fdab 100644
--- a/src/declarative/fx/qfximage.cpp
+++ b/src/declarative/fx/qfximage.cpp
@@ -176,14 +176,15 @@ void QFxImage::setPixmap(const QPixmap &pix)
 
     \list
     \o Stretch - the image is scaled to fit
-    \o PreserveAspect - the image is scaled uniformly to fit
-    \o PreserveAspectFill - the image is scaled uniformly to fill
+    \o PreserveAspectFit - the image is scaled uniformly to fit without cropping
+    \o PreserveAspectCrop - the image is scaled uniformly to fill, cropping if necessary
     \o Tile - the image is duplicated horizontally and vertically
     \o TileVertically - the image is stretched horizontally and tiled vertically
     \o TileHorizontally - the image is stretched vertically and tiled horizontally
     \endlist
 
     \image declarative-image_fillMode.gif
+    \sa examples/declarative/fillmode
     \sa examples/declarative/aspectratio
 */
 QFxImage::FillMode QFxImage::fillMode() const
@@ -302,7 +303,7 @@ void QFxImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
 
             QTransform scale;
 
-            if (d->fillMode == PreserveAspect) {
+            if (d->fillMode == PreserveAspectFit) {
                 if (widthScale < heightScale) {
                     heightScale = widthScale;
                     scale.translate(0, (height() - heightScale * pix.height()) / 2);
@@ -310,7 +311,7 @@ void QFxImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
                     widthScale = heightScale;
                     scale.translate((width() - widthScale * pix.width()) / 2, 0);
                 }
-            } else if (d->fillMode == PreserveAspectFill) {
+            } else if (d->fillMode == PreserveAspectCrop) {
                 if (widthScale < heightScale) {
                     widthScale = heightScale;
                     scale.translate((width() - widthScale * pix.width()) / 2, 0);
diff --git a/src/declarative/fx/qfximage.h b/src/declarative/fx/qfximage.h
index 91b10ef..c8e21ea 100644
--- a/src/declarative/fx/qfximage.h
+++ b/src/declarative/fx/qfximage.h
@@ -63,7 +63,7 @@ public:
     QFxImage(QFxItem *parent=0);
     ~QFxImage();
 
-    enum FillMode { Stretch, PreserveAspect, PreserveAspectFill, Tile, TileVertically, TileHorizontally };
+    enum FillMode { Stretch, PreserveAspectFit, PreserveAspectCrop, Tile, TileVertically, TileHorizontally };
     FillMode fillMode() const;
     void setFillMode(FillMode);
 
-- 
cgit v0.12