[Qt-embedded-interest] Graphics Driver
Tom Cooksey
thomas.cooksey at nokia.com
Fri Jul 10 08:34:59 CEST 2009
> Qt list,
> Ok, so after a lot of experimenting I have come to a point
> where I need some more guidance, maybe not answers but at least
> some pointers to get going again. Using the suggestions from Tom
> Cooksay I tried to write my own driver (which was emailed out
> several days ago yet had no replies) so then I tried to modify the
> dbscreen driver supplied with Qt. I managed to figure out that it
> relies on the QScreen::connect call given by every application
> rather than re-implementing it. After some investigation into
> QScreenLinuxFb, I am pretty sure that the mapping is occurring in
> the connect function. So I have a few questions:
>
>
> * Does the mapping occur in QScreen::connect?
> * How do I set the screen address pointer?
> * Does this use QImage::data?
> * How do I implement uchar * QImage::bits();?
>
> I would really enjoy ANY help or suggestions or anything. Just
> getting to a point where I know there is at least some base plug-in
> that can be recognized by the Qt application (I use analogclock as
> a test application). Even if you don’t know if your suggestion
> will help it may steer me in the correct direction so I look
> forward to hearing from anyone who has anything to add!
In ::connect(), you need to set the pointer to your "fake"
framebuffer. The pointer is a protected member of QScreen, I think
called "data", but can't remember exactly.
E.g.
MyScreen::MyScreen(int d)
: QScreen(d)
{
}
bool MyScreen::connect()
{
m_screenFd = open("/dev/fb0"...);
w = 640;
h = 480;
d = 16;
m_image = new QImage(w, h, QImage::Format_RGB16);
data = m_image->bits();
}
void MyScreen::blit(const QImage &img,
const QPoint &topLeft,
const QRegion ®ion)
{
QScreen::blit(img, topLeft, region);
write(m_screenFd, m_image.bits(), m_image.size());
}
void MyScreen::solidFill(const QColor &color, const QRegion ®ion)
{
QScreen::solidFill(color, region);
write(m_screenFd, m_image.bits(), m_image.size());
}
More information about the Qt-embedded-interest
mailing list