Hello.
My problem arise when I try to rotate (using a QMatrix), a Pixmap. I\'ve tried both the bitblt function and the QPainter::drawPixmap method (with a QPainter instantiated from my widget).
So, the problem is that the pixmap, when rotated, is always missing some of its parts (on the screen). I dumped the pixmaps to a file, and they looks good. So, it seems related with the drawing routine.
It seems also related with the AtiCore acceleration routines integrated in the libqte shipped with my Sharp SL C760. I\'ve tried the same examples with:
1.-libOpie. It works fine (but slow).
2.-Using the -qws flag on my program. It works fine. But I\'ve seen that, in this way, none of the AtiCore routines are called (I put gdb breakpoints on AtiCore* and no call to them was detected).
I\'m attaching here my (little) program, to see if you can find any mistake on it. Do you know any active support from Sharp? Is there any mailing list where I could post this problem, and expect Sharp/Qt people to look it?
The program needs to be launched with an argument. It must be a file path with a supported image file into it.
The program generates 4 rotated QPixmaps from the original QImage loaded from the file. Them, it tryes to paint it on screen as fast as possible using a QTimer.
You need to generate a Makefile with the tmake utility.
Thanks.
MyWidget.h
====================================
#include <qpixmap.h>
#include <qimage.h>
#include <qwidget.h>
#include <qwmatrix.h>
class MyWidget_t: public QWidget {
Q_OBJECT;
public:
MyWidget_t ( const char *fNameIn,
QWidget* parent = 0,
const char* name = 0);
int framecount () const { return m_framecount; }
bool closed () const { return m_closed; }
public slots:
void blit ();
protected:
virtual void closeEvent (QCloseEvent*);
private:
const char *fName;
bool m_closed;
int m_framecount;
QImage m_solidimg;
QPixmap m_solidpix[4];
};
===================================
main.cc
===================================
#include <stdio.h>
#include <unistd.h>
#include <iostream>
#include <time.h>
#include <qpe/qpeapplication.h>
#include <qpainter.h>
#include <qtimer.h>
#include \"MyWidget.h\"
using namespace std;
MyWidget_t::MyWidget_t( const char *fNameIn,
QWidget* parent,
const char* name):
QWidget (parent, name),
m_closed (false),
m_framecount (0)
{
fName = fNameIn;
QWMatrix m;
m_solidimg.load( fName );
m_solidpix[0].convertFromImage (m_solidimg);
m.rotate(90);
m_solidpix[1] = m_solidpix[0].xForm( m );
m.rotate(90);
m_solidpix[2] = m_solidpix[0].xForm( m );
m.rotate(90);
m_solidpix[3] = m_solidpix[0].xForm( m );
QTimer *t = new QTimer (this);
connect (t, SIGNAL (timeout ()),
SLOT (blit ()));
t->start (0, FALSE);
}
void
MyWidget_t::closeEvent (QCloseEvent* e)
{
e->accept ();
m_closed = (1==1);
}
void
MyWidget_t::blit ()
{
QPainter p( this );
//Clean up the widget in blue
p.fillRect( 0, 0,
size().width(),
size().height(),
backgroundColor() );
p.drawPixmap (0, 0, m_solidpix[ m_framecount % 4 ] );
m_framecount++;
}
int
main (int argc, char* argv[])
{
QPEApplication a (argc, argv);
// QPixmap::setDefaultOptimization( QPixmap::BestOptim );
MyWidget_t mainWin( argv[1] );
mainWin.show();
a.setMainWidget (&mainWin);
time_t t1;
time (&t1);
int retval = a.exec ();
time_t t2;
time (&t2);
double fps = mainWin.framecount () / double (t2 - t1);
cerr << fps << \" fpsn\";
return retval;
}
=======================================
blit.pro
=======================================
TEMPLATE = app
CONFIG += qtopia warn_on debug
HEADERS = MyWidget.h
SOURCES = main.cc
TARGET = blitter
DESTDIR = bin
INCLUDEPATH += $(QTDIR)/include
DEPENDPATH += $(QTDIR)/include
LIBS += -lqpe
VERSION = 0.0.1
========================================