This time [x] Disable HTML in this post
Change in file:
src/gui/embedded/qscreenlinuxfb_qws.cpp
Replace in function:
Code:
void QLinuxFbScreen::setPixelFormat(struct fb_var_screeninfo info)...
the code in state 16:
Code:
case 16: {
//const fb_bitfield rgb565[4] = {{11, 5, 0}, {5, 6, 0},
// {0, 5, 0}, {0, 0, 0}};
//if (memcmp(rgba, rgb565, 3 * sizeof(fb_bitfield)) == 0)
const fb_bitfield bgr555[4] = {{0, 5, 0}, {5, 5, 0},
{10, 5, 0}, {0, 0, 0}};
if (memcmp(rgba, bgr555, 3 * sizeof(fb_bitfield)) == 0)
format = QImage::Format_RGB16;
break;
}
Change in file:
src/gui/embedded/qscreen_qws.cppDirectly after
Code:
// #define QT_USE_MEMCPY_DUFF
Add:
Code:
#define QWS_ORDER_BGR 1
Replace template:
Code:
solidFill_template
with:
Code:
template <typename DST, typename SRC> // BGR patch: SRC added
static void solidFill_template(QScreen *screen, const QColor &color,
const QRegion ®ion)
{
DST *dest = reinterpret_cast<DST*>(screen->base());
const DST c = qt_colorConvert<DST, SRC>(color.rgba(), 0);
const int stride = screen->linestep();
const QVector<QRect> rects = region.rects();
for (int i = 0; i < rects.size(); ++i) {
const QRect r = rects.at(i);
qt_rectfill(dest, c, r.x(), r.y(), r.width(), r.height(), stride);
}
}
Change in function
Code:
qt_solidFill_setup
in state 16:
Code:
case 16:
#if QWS_ORDER_BGR == 0
screen->d_ptr->solidFill = solidFill_template<quint16, quint32>;
#else // BGR
screen->d_ptr->solidFill = solidFill_template<quint16, quint16>;
#endif
break;
Change in function:
Code:
blit_16
State:
Code:
case QImage::Format_RGB16:
#if QWS_ORDER_BGR == 0
blit_template<quint16, quint16>(screen, image, topLeft, region);
#else // BGR
blit_template<quint16, quint16>(screen, image, topLeft, region);
#endif
return;
Change in file
src/gui/painting/qdrawhelper_p.hAfter function
Code:
template <>
inline quint16 qt_colorConvert(quint32 color, quint16 dummy) {...}
add new function:
Code:
// original Qtopia:
// RGB 565
// RRRR RGGG GGGB BBBB
//
// BGR display needs:
// BGR 555
// aBBB BBGG GGGR RRRR
template <>
inline quint16 qt_colorConvert(quint16 color, quint16 dummy) // input is RGB565
{
Q_UNUSED(dummy);
const int r = color >> 11; // shift red part (6green + 5blue bits)
const int g = color >> 1; // shift green part (green will be 5 bits instead of 6)
const int b = color << 10; // shift blue part (5red + 5green bits)
return (b & 0x7C00) | (g & 0x03e0)| (r & 0x001f); // mask the colors, output is BGR555
}