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

List:       koffice-devel
Subject:    [patch] bug:71566 potential fix
From:       Brad Hards <bhards () bigpond ! net ! au>
Date:       2004-06-14 9:29:28
Message-ID: 200406141929.31080.bhards () bigpond ! net ! au
[Download RAW message or body]

I've been looking at KPresenter bug 71566:
http://bugs.kde.org/show_bug.cgi?id=71566, which relates to the preview
for Image Effect not being shown with appropriate rotation effects
also applied.

This is a fairly minimal fix, and probably isn't the most efficient, but
given that we are supposed to be moving to 3.3, is this OK to commit?

Brad

Index: imageEffectDia.cc
===================================================================
RCS file: /home/kde/koffice/kpresenter/imageEffectDia.cc,v
retrieving revision 1.5
diff -u -4 -p -r1.5 imageEffectDia.cc
--- imageEffectDia.cc   27 Aug 2003 14:45:38 -0000      1.5
+++ imageEffectDia.cc   14 Jun 2004 09:24:36 -0000
@@ -17,20 +17,24 @@
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
 */

+#include <math.h>
+
 #include <qcombobox.h>
 #include <qlabel.h>
 #include <qspinbox.h>
 #include <qwidgetstack.h>
 #include <qcheckbox.h>
 #include <qimage.h>
+#include <qwmatrix.h>

 #include <kimageeffect.h>
 #include <klocale.h>
 #include <knuminput.h>
 #include <kcolorbutton.h>

+
 #include "imageEffectDia.h"

 ImageEffectDia::ImageEffectDia(QWidget * parent, const char * name):
     KDialogBase(parent, name, true, i18n("Image Effect"), Ok|Cancel, Ok)
@@ -211,11 +215,24 @@ void ImageEffectDia::setPixmap(QPixmap p
     m_pix = pix;
     m_pix.detach();
 }

+void ImageEffectDia::setPixmapAngle(float angle)
+{
+    m_pixmap_angle = angle;
+}
+
 void ImageEffectDia::updatePreview()
 {
-    base->m_previewLabel->setPixmap(m_pix);
+    if (fabs(m_pixmap_angle)  < 1.0 ) {
+        // close enough to upright
+        base->m_previewLabel->setPixmap( m_pix );
+    } else {
+        // need to rotate
+        QWMatrix xform;
+        xform.rotate( m_pixmap_angle );
+        base->m_previewLabel->setPixmap( m_pix.xForm(xform) );
+    }
     base->m_previewLabel->repaint(false);
 }

 void ImageEffectDia::setEffect(ImageEffect eff, QVariant p1, QVariant p2, QVariant \
                p3)
Index: imageEffectDia.h
===================================================================
RCS file: /home/kde/koffice/kpresenter/imageEffectDia.h,v
retrieving revision 1.4
diff -u -4 -p -r1.4 imageEffectDia.h
--- imageEffectDia.h    27 Aug 2003 14:45:38 -0000      1.4
+++ imageEffectDia.h    14 Jun 2004 09:24:36 -0000
@@ -40,8 +40,13 @@ public:
      */
     void setPixmap(QPixmap pix);

     /**
+     * Set the orientation of the preview pixmap
+     */
+    void setPixmapAngle(float angle);
+
+    /**
      * Returns the selected effect
      */
     ImageEffect getEffect() const {return m_effect;}
     /**
@@ -73,8 +78,9 @@ private slots:
 private:
     void updatePreview();
     void setupSignals();
     QPixmap m_pix;
+    float m_pixmap_angle;
     ImageEffect m_effect;
     QVariant m_param1, m_param2, m_param3;
     EffectBrowserBase * base;
 };
Index: kpresenter_view.cc
===================================================================
RCS file: /home/kde/koffice/kpresenter/kpresenter_view.cc,v
retrieving revision 1.1032
diff -u -4 -p -r1.1032 kpresenter_view.cc
--- kpresenter_view.cc  12 Jun 2004 07:12:43 -0000      1.1032
+++ kpresenter_view.cc  14 Jun 2004 09:24:40 -0000
@@ -6940,8 +6940,9 @@ void KPresenterView::imageEffect()

         KPPixmapObject *object=m_canvas->getSelectedImage();

         imageEffectDia->setPixmap(object->getOriginalPixmap());
+       imageEffectDia->setPixmapAngle(object->getAngle());
         imageEffectDia->setEffect(object->getImageEffect(), object->getIEParam1(), \
object->getIEParam2(),  object->getIEParam3());

         m_canvas->setToolEditMode(TEM_MOUSE);
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


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

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