experimental scaling for pixmaps, requires more work (surface is likely not an accel...
authorFelix Domke <tmbinc@elitedvb.net>
Wed, 3 Jun 2009 12:56:04 +0000 (14:56 +0200)
committerFelix Domke <tmbinc@elitedvb.net>
Wed, 3 Jun 2009 12:59:34 +0000 (14:59 +0200)
lib/gui/epixmap.cpp
lib/gui/epixmap.h

index 84fec32..f20c1a9 100644 (file)
@@ -3,7 +3,7 @@
 #include <lib/gui/ewidgetdesktop.h>
 
 ePixmap::ePixmap(eWidget *parent)
 #include <lib/gui/ewidgetdesktop.h>
 
 ePixmap::ePixmap(eWidget *parent)
-       :eWidget(parent), m_alphatest(false)
+       :eWidget(parent), m_alphatest(false), m_scale(false)
 {
 }
 
 {
 }
 
@@ -13,6 +13,15 @@ void ePixmap::setAlphatest(int alphatest)
        setTransparent(alphatest);
 }
 
        setTransparent(alphatest);
 }
 
+void ePixmap::setScale(int scale)
+{
+       if (m_scale != scale)
+       {
+               m_scale = scale;
+               invalidate();
+       }
+}
+
 void ePixmap::setPixmap(gPixmap *pixmap)
 {
        m_pixmap = pixmap;
 void ePixmap::setPixmap(gPixmap *pixmap)
 {
        m_pixmap = pixmap;
@@ -76,7 +85,10 @@ int ePixmap::event(int event, void *data, void *data2)
                                flags = gPainter::BT_ALPHATEST;
                        else if (m_alphatest == 2)
                                flags = gPainter::BT_ALPHABLEND;
                                flags = gPainter::BT_ALPHATEST;
                        else if (m_alphatest == 2)
                                flags = gPainter::BT_ALPHABLEND;
-                       painter.blit(m_pixmap, ePoint(0, 0), eRect(), flags);
+                       if (m_scale)
+                               painter.blitScale(m_pixmap, eRect(ePoint(0, 0), size()), eRect(), flags);
+                       else
+                               painter.blit(m_pixmap, ePoint(0, 0), eRect(), flags);
                }
 
                return 0;
                }
 
                return 0;
index 1c4a97c..6280fb3 100644 (file)
@@ -6,6 +6,7 @@
 class ePixmap: public eWidget
 {
        int m_alphatest;
 class ePixmap: public eWidget
 {
        int m_alphatest;
+       int m_scale;
 public:
        ePixmap(eWidget *parent);
 
 public:
        ePixmap(eWidget *parent);
 
@@ -13,6 +14,7 @@ public:
        void setPixmap(ePtr<gPixmap> &pixmap);
        void setPixmapFromFile(const char *filename);
        void setAlphatest(int alphatest); /* 1 for alphatest, 2 for alphablend */
        void setPixmap(ePtr<gPixmap> &pixmap);
        void setPixmapFromFile(const char *filename);
        void setAlphatest(int alphatest); /* 1 for alphatest, 2 for alphablend */
+       void setScale(int scale);
 protected:
        ePtr<gPixmap> m_pixmap;
        int event(int event, void *data=0, void *data2=0);
 protected:
        ePtr<gPixmap> m_pixmap;
        int event(int event, void *data=0, void *data2=0);