[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/filters/libkowmf
From:       Inge Wallin <inge () lysator ! liu ! se>
Date:       2010-02-07 12:01:09
Message-ID: 1265544069.201256.9663.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1086451 by ingwa:

* Use more descriptive names
* Use qreal instead of double
* Establish copyright


 M  +18 -15    kowmfpaint.cc  
 M  +3 -2      kowmfpaint.h  


--- trunk/koffice/filters/libkowmf/kowmfpaint.cc #1086450:1086451
@@ -1,5 +1,6 @@
 /* This file is part of the KDE libraries
  * Copyright (c) 2003 thierry lorthiois (lorthioist@wanadoo.fr)
+ *               2009-2010 Inge Wallin <inge@lysator.liu.se>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -104,6 +105,7 @@
 
 bool KoWmfPaint::end()
 {
+    // FIXME: Remove
     if (mRelativeCoord) {
         QRect rec = boundingRect();
 
@@ -253,10 +255,11 @@
 // - change the origin or the scale in the middle of the drawing
 // - negative width or height
 // and relative/absolute coordinate
-void KoWmfPaint::setWindowOrg(int left, int top)
+
+void KoWmfPaint::setWindowOrg(int orgX, int orgY) // Love that parameter name...
 {
 #if DEBUG_WMFPAINT
-    kDebug(31000) << left << " " << top;
+    kDebug(31000) << orgX << " " << orgY;
 #endif
     //return;
     if (mRelativeCoord) {
@@ -266,36 +269,36 @@
         // translation : Don't use setWindow()
         mInternalWorldMatrix.translate(-dx, -dy);
         mPainter->translate(-dx, -dy);
-        mInternalWorldMatrix.translate(-left, -top);
-        mPainter->translate(-left, -top);
+        mInternalWorldMatrix.translate(-orgX, -orgY);
+        mPainter->translate(-orgX, -orgY);
     } else {
         QRect rec = mPainter->window();
-        mPainter->setWindow(left, top, rec.width(), rec.height());
+        mPainter->setWindow(orgX, orgY, rec.width(), rec.height());
     }
 }
 
 
-void KoWmfPaint::setWindowExt(int w, int h)
+void KoWmfPaint::setWindowExt(int width, int height)
 {
 #if DEBUG_WMFPAINT
-    kDebug(31000) << w << " " << h;
+    kDebug(31000) << width << " " << height;
 #endif
     //return;
     if (mRelativeCoord) {
         QRect r = mPainter->window();
-        double dx = mInternalWorldMatrix.dx();
-        double dy = mInternalWorldMatrix.dy();
-        double sx = mInternalWorldMatrix.m11();
-        double sy = mInternalWorldMatrix.m22();
+        qreal dx = mInternalWorldMatrix.dx();
+        qreal dy = mInternalWorldMatrix.dy();
+        qreal sx = mInternalWorldMatrix.m11();
+        qreal sy = mInternalWorldMatrix.m22();
 
-        // scale : don't use setWindow()
+        // Use explicit scaling instead of setWindow()
         mInternalWorldMatrix.translate(-dx, -dy);
         mPainter->translate(-dx, -dy);
         mInternalWorldMatrix.scale(1 / sx, 1 / sy);
         mPainter->scale(1 / sx, 1 / sy);
 
-        sx = (double)r.width() / (double)w;
-        sy = (double)r.height() / (double)h;
+        sx = (qreal)r.width()  / (qreal)width;
+        sy = (qreal)r.height() / (qreal)height;
 
         mInternalWorldMatrix.scale(sx, sy);
         mPainter->scale(sx, sy);
@@ -303,7 +306,7 @@
         mPainter->translate(dx, dy);
     } else {
         QRect rec = mPainter->window();
-        mPainter->setWindow(rec.left(), rec.top(), w, h);
+        mPainter->setWindow(rec.left(), rec.top(), width, height);
     }
 }
 
--- trunk/koffice/filters/libkowmf/kowmfpaint.h #1086450:1086451
@@ -1,5 +1,6 @@
 /* This file is part of the KDE libraries
  * Copyright (c) 2003 thierry lorthiois (lorthioist@wanadoo.fr)
+ *               2009-2010 Inge Wallin <inge@lysator.liu.se>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -25,7 +26,7 @@
 
 class QPolygon;
 
-#define DEBUG_WMFPAINT 0
+#define DEBUG_WMFPAINT 1
 
 
 /**
@@ -90,7 +91,7 @@
      * others wmf files doesn't call setWindow* at all
      * negative width and height are possible
      */
-    void  setWindowOrg(int left, int top);
+    void  setWindowOrg(int orgX, int orgY);
     void  setWindowExt(int width, int height);
 
     // Clipping
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic