42 #include "qplatformdefs.h" 54 #include <private/qdrawhelper_p.h> 55 #include <private/qpaintengine_raster_p.h> 56 #include <private/qpixmap_raster_p.h> 57 #include <private/qwindowsurface_qws_p.h> 58 #include <private/qpainter_p.h> 59 #include <private/qwidget_p.h> 60 #include <private/qgraphicssystem_qws_p.h> 66 #ifndef QT_NO_QWS_CURSOR 73 #ifndef QT_NO_QWS_CURSOR 253 #endif // QT_NO_QWS_CURSOR 394 #if Q_BYTE_ORDER == Q_BIG_ENDIAN 397 #ifdef QT_QWS_CLIENTBLIT 398 bool supportsBlitInClients;
404 template <
typename T>
408 T *dest =
reinterpret_cast<T*
>(screen->
base());
409 const T
c = qt_colorConvert<T, quint32>(color.
rgba(), 0);
410 const int stride = screen->
linestep();
413 for (
int i = 0; i < rects.
size(); ++i) {
419 #ifdef QT_QWS_DEPTH_GENERIC 420 static void solidFill_rgb_32bpp(
QScreen *screen,
const QColor &color,
424 const quint32 c = qt_convertToRgb<quint32>(color.
rgba());
426 const int stride = screen->
linestep();
429 for (
int i = 0; i < rects.
size(); ++i) {
435 static void solidFill_rgb_16bpp(
QScreen *screen,
const QColor &color,
439 const quint16 c = qt_convertToRgb<quint32>(color.
rgba());
441 const int stride = screen->
linestep();
444 for (
int i = 0; i < rects.
size(); ++i) {
449 #endif // QT_QWS_DEPTH_GENERIC 451 #ifdef QT_QWS_DEPTH_4 452 static inline void qt_rectfill_gray4(
quint8 *dest,
quint8 value,
453 int x,
int y,
int width,
int height,
456 const int pixelsPerByte = 2;
457 dest += y * stride + x / pixelsPerByte;
458 const int doAlign = x & 1;
459 const int doTail = (width - doAlign) & 1;
460 const int width8 = (width - doAlign) / pixelsPerByte;
462 for (
int j = 0; j < height; ++j) {
464 *dest = (*dest & 0xf0) | (value & 0x0f);
466 qt_memfill<quint8>(dest + doAlign, value, width8);
468 quint8 *
d = dest + doAlign + width8;
469 *d = (*d & 0x0f) | (value & 0xf0);
475 static void solidFill_gray4(
QScreen *screen,
const QColor &color,
480 const quint8 c8 = (c << 4) | c;
482 const int stride = screen->
linestep();
485 for (
int i = 0; i < rects.
size(); ++i) {
487 qt_rectfill_gray4(dest, c8, r.
x(), r.
y(), r.
width(), r.
height(),
491 #endif // QT_QWS_DEPTH_4 493 #ifdef QT_QWS_DEPTH_1 494 static inline void qt_rectfill_mono(
quint8 *dest,
quint8 value,
495 int x,
int y,
int width,
int height,
498 const int pixelsPerByte = 8;
499 const int alignWidth =
qMin(width, (8 - (x & 7)) & 7);
500 const int doAlign = (alignWidth > 0 ? 1 : 0);
501 const int alignStart = pixelsPerByte - 1 - (x & 7);
502 const int alignStop = alignStart - (alignWidth - 1);
503 const quint8 alignMask = ((1 << alignWidth) - 1) << alignStop;
504 const int tailWidth = (width - alignWidth) & 7;
505 const int doTail = (tailWidth > 0 ? 1 : 0);
506 const quint8 tailMask = (1 << (pixelsPerByte - tailWidth)) - 1;
507 const int width8 = (width - alignWidth) / pixelsPerByte;
509 dest += y * stride + x / pixelsPerByte;
510 stride -= (doAlign + width8);
512 for (
int j = 0; j < height; ++j) {
514 *dest = (*dest & ~alignMask) | (value & alignMask);
518 qt_memfill<quint8>(dest, value, width8);
522 *dest = (*dest & tailMask) | (value & ~tailMask);
527 static void solidFill_mono(
QScreen *screen,
const QColor &color,
533 const int stride = screen->
linestep();
536 for (
int i = 0; i < rects.
size(); ++i) {
538 qt_rectfill_mono(dest, c8, r.
x(), r.
y(), r.
width(), r.
height(),
542 #endif // QT_QWS_DEPTH_1 547 switch (screen->
depth()) {
548 #ifdef QT_QWS_DEPTH_32 556 #ifdef QT_QWS_DEPTH_24
564 #ifdef QT_QWS_DEPTH_18
569 #ifdef QT_QWS_DEPTH_16
577 #ifdef QT_QWS_DEPTH_15
585 #ifdef QT_QWS_DEPTH_12
590 #ifdef QT_QWS_DEPTH_8
595 #ifdef QT_QWS_DEPTH_4
600 #ifdef QT_QWS_DEPTH_1
606 qFatal(
"solidFill_setup(): Screen depth %d not supported!",
614 template <
typename DST,
typename SRC>
618 DST *dest =
reinterpret_cast<DST*
>(screen->
base());
619 const int screenStride = screen->
linestep();
624 const SRC *src =
reinterpret_cast<const SRC*
>(image.
scanLine(r.
y()))
626 qt_rectconvert<DST, SRC>(dest, src,
627 r.
x() + topLeft.
x(), r.
y() + topLeft.
y(),
629 screenStride, imageStride);
633 for (
int i = 0; i < rects.
size(); ++i) {
635 const SRC *src =
reinterpret_cast<const SRC*
>(image.
scanLine(r.
y()))
637 qt_rectconvert<DST, SRC>(dest, src,
638 r.
x() + topLeft.
x(), r.
y() + topLeft.
y(),
640 screenStride, imageStride);
645 #ifdef QT_QWS_DEPTH_32 653 blit_template<quint32, quint32>(screen,
image, topLeft, region);
655 #ifdef QT_QWS_DEPTH_16 657 blit_template<quint32, quint16>(screen,
image, topLeft, region);
661 qCritical(
"blit_32(): Image format %d not supported!", image.format());
664 #endif // QT_QWS_DEPTH_32 666 #ifdef QT_QWS_DEPTH_24 674 blit_template<quint24, quint32>(screen,
image, topLeft, region);
677 blit_template<quint24, qrgb888>(screen,
image, topLeft, region);
679 #ifdef QT_QWS_DEPTH_16 681 blit_template<quint24, quint16>(screen,
image, topLeft, region);
685 qCritical(
"blit_24(): Image format %d not supported!", image.format());
689 static void blit_qrgb888(
QScreen *screen,
const QImage &image,
696 blit_template<qrgb888, quint32>(screen,
image, topLeft, region);
699 blit_template<qrgb888, qrgb888>(screen,
image, topLeft, region);
701 #ifdef QT_QWS_DEPTH_16 703 blit_template<qrgb888, quint16>(screen,
image, topLeft, region);
707 qCritical(
"blit_24(): Image format %d not supported!", image.format());
711 #endif // QT_QWS_DEPTH_24 713 #ifdef QT_QWS_DEPTH_18 721 blit_template<qrgb666, quint32>(screen,
image, topLeft, region);
724 blit_template<qrgb666, qrgb666>(screen,
image, topLeft, region);
726 #ifdef QT_QWS_DEPTH_16 728 blit_template<qrgb666, quint16>(screen,
image, topLeft, region);
732 qCritical(
"blit_18(): Image format %d not supported!", image.format());
735 #endif // QT_QWS_DEPTH_18 737 #if (Q_BYTE_ORDER == Q_BIG_ENDIAN) && (defined(QT_QWS_DEPTH_16) || defined(QT_QWS_DEPTH_15)) 742 data = ((v & 0xff00) >> 8) | ((v & 0x00ff) << 8);
745 inline quint16LE(
int v) {
746 data = ((v & 0xff00) >> 8) | ((v & 0x00ff) << 8);
750 data = ((v & 0xff00) >> 8) | ((v & 0x00ff) << 8);
758 inline bool operator==(
const quint16LE &v)
const 760 return data == v.data;
768 #ifdef QT_QWS_DEPTH_16 777 blit_template<quint16, quint32>(screen,
image, topLeft, region);
780 blit_template<quint16, quint16>(screen,
image, topLeft, region);
783 qCritical(
"blit_16(): Image format %d not supported!", image.format());
787 #if Q_BYTE_ORDER == Q_BIG_ENDIAN 788 static void blit_16_bigToLittleEndian(
QScreen *screen,
const QImage &image,
796 blit_template<quint16LE, quint32>(screen,
image, topLeft, region);
799 blit_template<quint16LE, quint16>(screen,
image, topLeft, region);
802 qCritical(
"blit_16_bigToLittleEndian(): Image format %d not supported!", image.format());
806 #endif // Q_BIG_ENDIAN 807 #endif // QT_QWS_DEPTH_16 809 #ifdef QT_QWS_DEPTH_15 817 blit_template<qrgb555, quint32>(screen,
image, topLeft, region);
820 blit_template<qrgb555, qrgb555>(screen,
image, topLeft, region);
823 blit_template<qrgb555, quint16>(screen,
image, topLeft, region);
826 qCritical(
"blit_15(): Image format %d not supported!", image.format());
830 #if Q_BYTE_ORDER == Q_BIG_ENDIAN 831 static void blit_15_bigToLittleEndian(
QScreen *screen,
const QImage &image,
837 blit_template<quint16LE, qrgb555>(screen,
image, topLeft, region);
840 qCritical(
"blit_15_bigToLittleEndian(): Image format %d not supported!", image.format());
843 #endif // Q_BIG_ENDIAN 844 #endif // QT_QWS_DEPTH_15 847 #ifdef QT_QWS_DEPTH_12 853 blit_template<qrgb444, qargb4444>(screen,
image, topLeft, region);
856 blit_template<qrgb444, qrgb444>(screen,
image, topLeft, region);
859 qCritical(
"blit_12(): Image format %d not supported!", image.format());
862 #endif // QT_QWS_DEPTH_12 864 #ifdef QT_QWS_DEPTH_8 872 blit_template<quint8, quint32>(screen,
image, topLeft, region);
875 blit_template<quint8, quint16>(screen,
image, topLeft, region);
878 blit_template<quint8, qargb4444>(screen,
image, topLeft, region);
881 blit_template<quint8, qrgb444>(screen,
image, topLeft, region);
884 qCritical(
"blit_8(): Image format %d not supported!", image.format());
887 #endif // QT_QWS_DEPTH_8 889 #ifdef QT_QWS_DEPTH_4 893 template <
typename SRC>
899 return qGray(color) >> 4;
905 const int r = (color & 0xf800) >> 11;
906 const int g = (color & 0x07e0) >> 6;
907 const int b = (color & 0x001f);
908 return (r * 11 + g * 16 + b * 5) >> 6;
914 return qt_convertToGray4(
quint32(color));
920 return qt_convertToGray4(
quint32(color));
923 template <
typename SRC>
925 int x,
int y,
int width,
int height,
926 int dstStride,
int srcStride)
928 const int pixelsPerByte = 2;
930 + y * dstStride + x / pixelsPerByte;
931 const int doAlign = x & 1;
932 const int doTail = (width - doAlign) & 1;
933 const int width8 = (width - doAlign) / pixelsPerByte;
934 const int count8 = (width8 + 3) / 4;
936 srcStride = srcStride /
sizeof(SRC) - width;
937 dstStride -= (width8 + doAlign);
939 for (
int i = 0; i < height; ++i) {
941 *dest8 = (*dest8 & 0xf0) | qt_convertToGray4<SRC>(*src++);
946 switch (width8 & 0x03)
948 case 0:
do { *dest8++ = qt_convertToGray4<SRC>(src[0]) << 4
949 | qt_convertToGray4<SRC>(src[1]);
951 case 3: *dest8++ = qt_convertToGray4<SRC>(src[0]) << 4
952 | qt_convertToGray4<SRC>(src[1]);
954 case 2: *dest8++ = qt_convertToGray4<SRC>(src[0]) << 4
955 | qt_convertToGray4<SRC>(src[1]);
957 case 1: *dest8++ = qt_convertToGray4<SRC>(src[0]) << 4
958 | qt_convertToGray4<SRC>(src[1]);
965 *dest8 = qt_convertToGray4<SRC>(*src++) << 4 | (*dest8 & 0x0f);
974 int x,
int y,
int width,
int height,
975 int dstStride,
int srcStride)
977 qt_rectconvert_gray4<quint32>(dest, src, x, y, width, height,
978 dstStride, srcStride);
983 int x,
int y,
int width,
int height,
984 int dstStride,
int srcStride)
986 qt_rectconvert_gray4<quint16>(dest, src, x, y, width, height,
987 dstStride, srcStride);
992 int x,
int y,
int width,
int height,
993 int dstStride,
int srcStride)
995 qt_rectconvert_gray4<qrgb444>(dest, src, x, y, width, height,
996 dstStride, srcStride);
1001 int x,
int y,
int width,
int height,
1002 int dstStride,
int srcStride)
1004 qt_rectconvert_gray4<qargb4444>(dest, src, x, y, width, height,
1005 dstStride, srcStride);
1011 switch (image.
format()) {
1013 blit_template<qgray4, quint32>(screen,
image, topLeft, region);
1016 blit_template<qgray4, quint16>(screen,
image, topLeft, region);
1019 blit_template<qgray4, qrgb444>(screen,
image, topLeft, region);
1022 blit_template<qgray4, qargb4444>(screen,
image, topLeft, region);
1025 qCritical(
"blit_4(): Image format %d not supported!", image.format());
1028 #endif // QT_QWS_DEPTH_4 1030 #ifdef QT_QWS_DEPTH_1 1034 template <
typename SRC>
1040 return qGray(color) >> 7;
1046 return (
qGray(qt_colorConvert<quint32, quint16>(color, 0)) >> 7);
1061 template <
typename SRC>
1062 inline void qt_rectconvert_mono(qmono *dest,
const SRC *src,
1063 int x,
int y,
int width,
int height,
1064 int dstStride,
int srcStride)
1066 const int pixelsPerByte = 8;
1068 + y * dstStride + x / pixelsPerByte;
1069 const int alignWidth =
qMin(width, (8 - (x & 7)) & 7);
1070 const int doAlign = (alignWidth > 0 ? 1 : 0);
1071 const int alignStart = pixelsPerByte - 1 - (x & 7);
1072 const int alignStop = alignStart - (alignWidth - 1);
1073 const quint8 alignMask = ((1 << alignWidth) - 1) << alignStop;
1074 const int tailWidth = (width - alignWidth) & 7;
1075 const int doTail = (tailWidth > 0 ? 1 : 0);
1076 const quint8 tailMask = (1 << (pixelsPerByte - tailWidth)) - 1;
1077 const int width8 = (width - alignWidth) / pixelsPerByte;
1079 srcStride = srcStride /
sizeof(SRC) - (width8 * 8 + alignWidth);
1080 dstStride -= (width8 + doAlign);
1082 for (
int j = 0; j < height; ++j) {
1084 quint8 d = *dest8 & ~alignMask;
1085 for (
int i = alignStart; i >= alignStop; --i)
1086 d |= qt_convertToMono<SRC>(*src++) << i;
1089 for (
int i = 0; i < width8; ++i) {
1090 *dest8 = (qt_convertToMono<SRC>(src[0]) << 7)
1091 | (qt_convertToMono<SRC>(src[1]) << 6)
1092 | (qt_convertToMono<SRC>(src[2]) << 5)
1093 | (qt_convertToMono<SRC>(src[3]) << 4)
1094 | (qt_convertToMono<SRC>(src[4]) << 3)
1095 | (qt_convertToMono<SRC>(src[5]) << 2)
1096 | (qt_convertToMono<SRC>(src[6]) << 1)
1097 | (qt_convertToMono<SRC>(src[7]));
1103 switch (tailWidth) {
1104 case 7: d |= qt_convertToMono<SRC>(src[6]) << 1;
1105 case 6: d |= qt_convertToMono<SRC>(src[5]) << 2;
1106 case 5: d |= qt_convertToMono<SRC>(src[4]) << 3;
1107 case 4: d |= qt_convertToMono<SRC>(src[3]) << 4;
1108 case 3: d |= qt_convertToMono<SRC>(src[2]) << 5;
1109 case 2: d |= qt_convertToMono<SRC>(src[1]) << 6;
1110 case 1: d |= qt_convertToMono<SRC>(src[0]) << 7;
1122 int x,
int y,
int width,
int height,
1123 int dstStride,
int srcStride)
1125 qt_rectconvert_mono<quint32>(dest, src, x, y, width, height,
1126 dstStride, srcStride);
1131 int x,
int y,
int width,
int height,
1132 int dstStride,
int srcStride)
1134 qt_rectconvert_mono<quint16>(dest, src, x, y, width, height,
1135 dstStride, srcStride);
1140 int x,
int y,
int width,
int height,
1141 int dstStride,
int srcStride)
1143 qt_rectconvert_mono<qrgb444>(dest, src, x, y, width, height,
1144 dstStride, srcStride);
1149 int x,
int y,
int width,
int height,
1150 int dstStride,
int srcStride)
1152 qt_rectconvert_mono<qargb4444>(dest, src, x, y, width, height,
1153 dstStride, srcStride);
1159 switch (image.
format()) {
1161 blit_template<qmono, quint32>(screen,
image, topLeft, region);
1164 blit_template<qmono, quint16>(screen,
image, topLeft, region);
1167 blit_template<qmono, qrgb444>(screen,
image, topLeft, region);
1170 blit_template<qmono, qargb4444>(screen,
image, topLeft, region);
1173 qCritical(
"blit_1(): Image format %d not supported!", image.format());
1176 #endif // QT_QWS_DEPTH_1 1178 #ifdef QT_QWS_DEPTH_GENERIC 1183 switch (image.
format()) {
1185 blit_template<qrgb, quint32>(screen,
image, topLeft, region);
1188 blit_template<qrgb, quint16>(screen,
image, topLeft, region);
1191 qCritical(
"blit_rgb(): Image format %d not supported!", image.format());
1195 void qt_set_generic_blit(
QScreen *screen,
int bpp,
1196 int len_red,
int len_green,
int len_blue,
int len_alpha,
1197 int off_red,
int off_green,
int off_blue,
int off_alpha)
1199 qrgb::bpp = bpp / 8;
1200 qrgb::len_red = len_red;
1201 qrgb::len_green = len_green;
1202 qrgb::len_blue = len_blue;
1203 qrgb::len_alpha = len_alpha;
1204 qrgb::off_red = off_red;
1205 qrgb::off_green = off_green;
1206 qrgb::off_blue = off_blue;
1207 qrgb::off_alpha = off_alpha;
1215 #endif // QT_QWS_DEPTH_GENERIC 1220 switch (screen->
depth()) {
1221 #ifdef QT_QWS_DEPTH_32 1226 screen->
d_ptr->
blit = blit_template<qabgr8888, quint32>;
1229 #ifdef QT_QWS_DEPTH_24
1237 #ifdef QT_QWS_DEPTH_18
1242 #ifdef QT_QWS_DEPTH_16
1244 #
if Q_BYTE_ORDER == Q_BIG_ENDIAN
1246 screen->
d_ptr->
blit = blit_16_bigToLittleEndian;
1252 screen->
d_ptr->
blit = blit_template<qbgr565, quint16>;
1255 #ifdef QT_QWS_DEPTH_15
1257 #
if Q_BYTE_ORDER == Q_BIG_ENDIAN
1259 screen->
d_ptr->
blit = blit_15_bigToLittleEndian;
1261 #endif // Q_BIG_ENDIAN 1265 screen->
d_ptr->
blit = blit_template<qbgr555, qrgb555>;
1268 #ifdef QT_QWS_DEPTH_12
1273 #ifdef QT_QWS_DEPTH_8
1278 #ifdef QT_QWS_DEPTH_4
1283 #ifdef QT_QWS_DEPTH_1
1289 qFatal(
"blit_setup(): Screen depth %d not supported!",
1294 screen->
d_ptr->
blit(screen, image, topLeft, region);
1299 pixelFormat(
QImage::Format_Invalid),
1300 #ifdef QT_QWS_CLIENTBLIT
1301 supportsBlitInClients(false),
1303 classId(id), q_ptr(parent)
1307 #if Q_BYTE_ORDER == Q_BIG_ENDIAN 2164 : screencols(0),
data(0),
entries(0), entryp(0), lowest(0),
2165 w(0), lstep(0), h(0),
d(1), pixeltype(NormalPixel),
grayscale(false),
2166 dw(0), dh(0), size(0), mapsize(0), displayId(display_id),
2167 physWidth(0), physHeight(0), d_ptr(new
QScreenPrivate(this, classId))
2203 #ifndef QT_NO_QWS_CURSOR 2260 return qGray(r, g, b);
2263 const int pos = (r + 25) / 51 * 36 + (g + 25) / 51 * 6 + (b + 25) / 51;
2269 unsigned int mindiff = 0xffffffff;
2273 for (
int loopc = 0; loopc <
screencols; ++loopc) {
2277 diff = dr*dr + dg*dg + db*db;
2279 if (diff < mindiff) {
2286 }
else if (
d == 4) {
2287 ret =
qGray(r, g, b) >> 4;
2288 }
else if (
d == 1) {
2289 ret =
qGray(r, g, b) >= 128;
2291 qFatal(
"cannot alloc %dbpp color",
d);
2357 #ifdef QT_QWS_DEPTH_1 2361 #ifdef QT_QWS_DEPTH_4 2365 #ifdef QT_QWS_DEPTH_8 2369 #ifdef QT_QWS_DEPTH_16 2373 #ifdef QT_QWS_DEPTH_15 2374 }
else if (d == 15) {
2377 #ifdef QT_QWS_DEPTH_18 2378 }
else if(d==18 || d==19) {
2381 #ifdef QT_QWS_DEPTH_24 2385 #ifdef QT_QWS_DEPTH_32 2404 long t=(
unsigned long)p;
2405 long bmin=(
unsigned long)
data;
2425 long t=(
unsigned long)p;
2426 long bmin=(
unsigned long)
data;
2465 bool foundDriver =
false;
2470 driverList << driver;
2474 for (
int i = 0; i < driverList.
size(); ++i) {
2475 const QString driverName = driverList.
at(i);
2489 qFatal(
"No suitable driver found");
2490 else if (foundDriver)
2498 #ifndef QT_NO_QWS_CURSOR 2505 spanData.
init(&rb, 0);
2508 spanData.
dx = -offset.
x();
2509 spanData.
dy = -offset.
y();
2510 if (!spanData.
blend)
2515 const int w = rect.
width();
2519 for (
int i = 0; i <
h; ++i) {
2520 spans[i].x = rect.
x();
2522 spans[i].y = rect.
y() + i;
2523 spans[i].coverage = 255;
2527 #endif // QT_NO_QWS_CURSOR 2561 int changing = windowIndex;
2566 #ifdef QTOPIA_PERFTEST 2567 static enum { PerfTestUnknown, PerfTestOn, PerfTestOff } perfTestState = PerfTestUnknown;
2568 if(PerfTestUnknown == perfTestState) {
2569 if(::getenv(
"QTOPIA_PERFTEST"))
2570 perfTestState = PerfTestOn;
2572 perfTestState = PerfTestOff;
2574 if(PerfTestOn == perfTestState) {
2577 qDebug() <<
"Performance : expose_region :" 2588 #ifndef QT_NO_QWS_CURSOR 2593 compose(0, r, blendRegion, &blendBuffer, changing);
2595 if (blendBuffer && !blendBuffer->
isNull()) {
2597 #ifndef QT_NO_QWS_CURSOR 2605 #endif // QT_NO_QWS_CURSOR 2606 blit(*blendBuffer, offset, blendRegion);
2614 for (
int i = 0; i < rects.
size(); ++i)
2645 (reg & bound).translated(-topLeft));
2649 #ifdef QT_QWS_CLIENTBLIT 2660 bool QScreen::supportsBlitInClients()
const 2662 return d_ptr->supportsBlitInClients;
2671 void QScreen::setSupportsBlitInClients(
bool supported)
2673 d_ptr->supportsBlitInClients = supported;
2758 #ifndef QT_NO_PAINTONSCREEN 2765 #ifndef QT_NO_QWS_MULTIPROCESS 2769 #ifndef QT_NO_PAINT_DEBUG 2773 #ifndef QT_NO_DIRECTPAINTER 2781 #ifndef QT_NO_PAINTONSCREEN 2784 static int doOnScreen = -1;
2785 if (doOnScreen == -1) {
2790 doOnScreen = (env.
toInt() > 0 ? 1 : 0);
2793 if (doOnScreen == 2)
2799 return w->d_func()->isOpaque;
2813 #ifndef QT_NO_PAINTONSCREEN 2820 #ifndef QT_NO_QWS_MULTIPROCESS 2829 QImage **blendbuffer,
int changing_level)
2839 bool above_changing = level <= changing_level;
2841 QRegion exposedBelow = exposed;
2848 if (above_changing || !surface->
isBuffered())
2854 if (win && !exposedBelow.
isEmpty()) {
2855 compose(level, exposedBelow, blend, blendbuffer, changing_level);
2858 if (!blendSize.
isNull()) {
2863 const QRegion blitRegion = exposed - blend;
2866 else if (!above_changing && surface->
isBuffered())
2867 blit(win, blitRegion);
2869 QRegion blendRegion = exposed & blend;
2875 QPoint off = blend.boundingRect().topLeft();
2880 spanData.
init(&rb, 0);
2896 spanData.
dx = off.
x();
2897 spanData.
dy = off.
y();
2904 int const_alpha = win->
opacity();
2905 const_alpha += (const_alpha >> 7);
2908 spanData.
dx = winoff.
x();
2909 spanData.
dy = winoff.
y();
2911 if (!spanData.
blend)
2917 const int nspans = 256;
2919 for (
int i = 0; i < rects.
size(); ++i) {
2920 int y = rects.
at(i).
y() - off.
y();
2922 int x = rects.
at(i).
x() - off.
x();
2923 int len = rects.
at(i).
width();
2925 int n =
qMin(nspans, ye - y);
2934 spanData.
blend(n, spans, &spanData);
2959 spanData.
init(&rb, 0);
2961 spanData.
dx = off.x();
2962 spanData.
dy = off.y();
2966 const int nspans = 256;
2968 for (
int i = 0; i < rects.
size(); ++i) {
2969 int y = rects.
at(i).
y() - off.y();
2971 int x = rects.
at(i).
x() - off.x();
2972 int len = rects.
at(i).
width();
2974 int n =
qMin(nspans, ye - y);
2983 spanData.
blend(n, spans, &spanData);
3316 #if Q_BYTE_ORDER == Q_BIG_ENDIAN 3346 const int n = screens.
count();
3347 for (
int i = 0; i < n; ++i) {
3356 #ifdef QT_LOADABLE_MODULES 3361 static QScreen * qt_dodriver(
char * driver,
char *
a,
unsigned char * b)
3365 strcpy(buf,
"/etc/qws/drivers/");
3367 qDebug(
"Attempting driver %s",driver);
3370 handle=dlopen(buf,RTLD_LAZY);
3372 qFatal(
"Module load error");
3374 QScreen *(*qt_get_screen_func)(
char *,
unsigned char *);
3375 qt_get_screen_func=dlsym(handle,
"qt_get_screen");
3376 if(qt_get_screen_func==0) {
3377 qFatal(
"Couldn't get symbol");
3379 QScreen * ret=qt_get_screen_func(
a,b);
3383 static QScreen * qt_do_entry(
char * entry)
3385 unsigned char config[256];
3387 FILE * f=fopen(entry,
"r");
3392 int r=fread(config,256,1,f);
3398 unsigned short vendorid=*((
unsigned short int *)config);
3399 unsigned short deviceid=*(((
unsigned short int *)config)+1);
3403 if(vendorid==0x1002) {
3404 if(deviceid==0x4c4d) {
3405 qDebug(
"Compaq Armada/IBM Thinkpad's Mach64 card");
3406 return qt_dodriver(
"mach64.so",entry,config);
3407 }
else if(deviceid==0x4742) {
3408 qDebug(
"Desktop Rage Pro Mach64 card");
3409 return qt_dodriver(
"mach64.so",entry,config);
3411 qDebug(
"Unrecognised ATI card id %x",deviceid);
3415 qDebug(
"Unrecognised vendor");
3427 return qt_dodriver(
"unaccel.so",0,0);
3430 QT_DIR *dirptr = QT_OPENDIR(
"/proc/bus/pci");
3432 return qt_dodriver(
"unaccel.so",0,0);
3436 QT_DIRENT *busses = QT_READDIR(dirptr);
3439 if(busses->d_name[0]!=
'.') {
3441 strcpy(buf,
"/proc/bus/pci/");
3442 qstrcpy(buf+14,busses->d_name);
3444 dirptr2 = QT_OPENDIR(buf);
3446 cards = QT_READDIR(dirptr2);
3448 if(cards->d_name[0]!=
'.') {
3450 qstrcpy(buf+p+1,cards->d_name);
3451 QScreen * ret=qt_do_entry(buf);
3455 cards = QT_READDIR(dirptr2);
3457 QT_CLOSEDIR(dirptr2);
3460 busses = QT_READDIR(dirptr);
3462 QT_CLOSEDIR(dirptr);
3464 return qt_dodriver(
"unaccel.so",0,0);
3469 char *qt_qws_hardcoded_slot =
"/proc/bus/pci/01/00.0";
3474 slot=::getenv(
"QWS_CARD_SLOT");
3476 slot=qt_qws_hardcoded_slot;
3478 static unsigned char config[256];
3479 FILE * f=fopen(slot,
"r");
3481 qDebug(
"Open failure for %s",slot);
3484 int r=fread((
char*)config,256,1,f);
3507 static bool shownWarning =
false;
3508 if (!shownWarning) {
3509 qWarning(
"QScreen::setPixmapDataFactory() is deprecated - use setGraphicsSystem() instead");
3510 shownWarning =
true;
Q_GUI_EXPORT QScreen * qt_screen
The QColor class provides colors based on RGB, HSV or CMYK values.
The QScreenCursor class is a base class for screen cursors in Qt for Embedded Linux.
QGraphicsSystem * graphicsSystem
int screencols
the number of entries in the color table
const T * constData() const
void compose(int level, const QRegion &exposed, QRegion &blend, QImage **blendbuffer, int changing_level)
The QWSWindowSurface class provides the drawing area for top-level windows in Qt for Embedded Linux...
virtual void move(int x, int y)
Moves the mouse cursor to the given position, i.e., (x, y).
Format
The following image formats are available in Qt.
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
bool frameBufferLittleEndian() const
Q_CORE_EXPORT char * qstrcpy(char *dst, const char *src)
void qt_rectconvert(DST *dest, const SRC *src, int x, int y, int width, int height, int dstStride, int srcStride)
void setOffset(const QPoint &p)
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
static void blendCursor(QImage *dest, const QImage &cursor, const QPoint &offset)
QPointer< QWidget > widget
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
QScreenPrivate(QScreen *parent, QScreen::ClassId id=QScreen::CustomClass)
QImage::Format pixelFormat
virtual ~QScreen()
Destroys this screen driver.
static void solidFill_template(QScreen *screen, const QColor &color, const QRegion ®ion)
bool isNull() const
Returns true if it is a null image, otherwise returns false.
void qt_solidFill_setup(QScreen *screen, const QColor &color, const QRegion ®ion)
The QByteArray class provides an array of bytes.
void qt_rectfill(T *dest, T value, int x, int y, int width, int height, int stride)
void paintBackground(const QRegion &)
QWSClient * client() const
Returns a reference to the QWSClient object that owns this window.
virtual bool connect(const QString &displaySpec)=0
This function is called by every Qt for Embedded Linux application on startup, and must be implemente...
void(* ClearCacheFunc)(QScreen *obj, int)
virtual void restore()
Restores the previously saved state of the graphics card.
QRgb screenclut[256]
the color table
QList< QScreen * > subScreens
int width() const
Returns the width of the rectangle.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Q_GUI_EXPORT QScreen * qt_get_screen(int display_id, const char *spec)
int deviceWidth() const
Returns the physical width of the framebuffer device in pixels.
int bytesPerLine() const
Returns the number of bytes per image scanline.
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
virtual QSize mapFromDevice(const QSize &) const
Maps the given size from the framebuffer coordinate system to the coordinate space used by the applic...
QRect boundingRect() const
Returns the bounding rectangle of this region.
bool isBuffered() const
Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false.
static ClearCacheFunc clearCacheFunc
friend class QWSOnScreenSurface
int physHeight
the physical height of the screen in millimeters.
int height() const
Returns the height of the rectangle.
#define Q_STATIC_TEMPLATE_FUNCTION
The QString class provides a Unicode character string.
int size
the number of bytes in the visible region of the frame buffer
virtual bool lock(int timeout=-1)
virtual void setDirty(const QRect &)
Marks the given rectangle as dirty.
static void grayscale(const QImage &image, QImage &dest, const QRect &rect=QRect())
static void initSoftwareCursor()
Initializes the screen cursor.
QPainter::CompositionMode compositionMode
int rectCount() const
Returns the number of rectangles that will be returned in rects().
Format format() const
Returns the format of the image.
PixelType pixeltype
set to BGRPixel
int physWidth
the physical width of the screen in millimeters.
QImage image() const
Returns the cursor's image.
Q_GUI_EXPORT_INLINE int qRed(QRgb rgb)
virtual QSize mapToDevice(const QSize &) const
Maps the given size from the coordinate space used by the application to the framebuffer coordinate s...
void setPixelFormat(QImage::Format format)
Sets the screen's pixel format to format.
virtual void blit(const QImage &img, const QPoint &topLeft, const QRegion ®ion)
Copies the given region in the given image to the point specified by topLeft using device coordinates...
Q_CORE_EXPORT void qDebug(const char *,...)
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
virtual QRegion region() const
Returns the region covered by this screen driver.
virtual int alloc(unsigned int, unsigned int, unsigned int)
Returns the index in the screen's palette which is the closest match to the given RGB value (red...
bool isAccelerated() const
Returns true if the cursor is accelerated; otherwise false.
static QString toString(Register *reg, int type, bool *ok=0)
uchar * data
points to the first visible pixel in the frame buffer.
#define QT_BEGIN_NAMESPACE
This macro expands to.
PixelType pixelType() const
Returns the pixel storage format of the screen.
int linestep() const
Returns the length of each scanline of the framebuffer in bytes.
virtual void resumeUpdates()
QScreenCursor()
Constructs a screen cursor.
void truncate(int pos)
Truncates the string at the given position index.
static void blit_template(QScreen *screen, const QImage &image, const QPoint &topLeft, const QRegion ®ion)
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
QSize size() const
Returns the size of the rectangle.
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
int w
the logical width of the screen.
void setGraphicsSystem(QGraphicsSystem *system)
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
bool contains(const QPoint &p) const
Returns true if the region contains the point p; otherwise returns false.
static const char * data(const QByteArray &arr)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QScreen * create(const QString &, int)
The QRegion class specifies a clip region for a painter.
T value(int i) const
Returns the value at index position i in the list.
virtual ~QScreenCursor()
Destroys the screen cursor.
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
static QStringList keys()
Returns the list of valid keys, i.e.
Qt::BrushStyle style() const
Returns the brush style.
void initTexture(const QImage *image, int alpha, QTextureData::Type=QTextureData::Plain, const QRect &sourceRect=QRect())
QImage::Format prepare(QImage *image)
QScreen(int display_id, ClassId classId)
Constructs a new screen driver.
Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb)
const T & at(int i) const
Returns the item at index position i in the vector.
uint opacity() const
Returns the window's alpha channel value.
QSize size() const
Returns the size of the image, i.
QWSGraphicsSystem defaultGraphicsSystem
virtual void hide()
Hides the cursor from the screen.
virtual QWSWindowSurface * createSurface(QWidget *widget) const
Creates and returns a new window surface for the given widget.
const char * constData() const
Returns a pointer to the data stored in the byte array.
The QBrush class defines the fill pattern of shapes drawn by QPainter.
bool isNull() const
Returns true if this string is null; otherwise returns false.
static const MacSpecialKey entries[NumEntries]
Q_GUI_EXPORT_INLINE int qGray(int r, int g, int b)
uchar * base() const
Returns a pointer to the beginning of the framebuffer.
int subScreenIndexAt(const QPoint &p) const
Returns the index of the subscreen at the given position; returns -1 if no screen is found...
QString identity() const
Returns the name of this client's running application.
Q_CORE_EXPORT void qFatal(const char *,...)
QGraphicsSystem * graphicsSystem() const
void qt_blit_setup(QScreen *screen, const QImage &image, const QPoint &topLeft, const QRegion ®ion)
virtual void blank(bool on)
Prevents the screen driver form displaying any content on the screen.
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
Returns a copy of the image in the given format.
QImage::Format pixelFormat() const
Returns the pixel format of the screen, or QImage::Format_Invalid if the pixel format is not a suppor...
virtual void save()
Saves the current state of the graphics card.
void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode)
State state() const
Returns the current state of the window.
void init(QRasterBuffer *rb, const QRasterPaintEngine *pe)
virtual int memoryNeeded(const QString &)
int deviceHeight() const
Returns the full height of the framebuffer device in pixels.
virtual void haltUpdates()
const QBrush & backgroundBrush() const
Returns the brush used as background in the absence of obscuring windows.
const QRegion & requestedRegion() const
Returns the region that the window has requested to draw onto, including any window decorations...
int y() const
Returns the y-coordinate of the rectangle's top edge.
QRasterBuffer * rasterBuffer
static QTime currentTime()
Returns the current time as reported by the system clock.
ClassId
This enum defines the class identifiers for the known screen subclasses.
virtual bool isInterlaced() const
Returns true if the display is interlaced (i.
void setFrameBufferLittleEndian(bool littleEndian)
QImage::Format preferredImageFormat() const
int x() const
Returns the x-coordinate of the rectangle's left edge.
QRect boundingRect() const
Returns the cursor's bounding rectangle.
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
virtual QList< QScreen * > subScreens() const
virtual bool isTransformed() const
Returns true if the screen is transformed (for instance, rotated 90 degrees); otherwise returns false...
Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)
The QPoint class defines a point in the plane using integer precision.
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
int size() const
Returns the number of items in the list.
QPixmapDataFactory * pixmapDataFactory() const
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
bool grayscale
the gray scale screen mode flag
QWSWindowSurface * windowSurface() const
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
virtual void shutdownDevice()
This function is called by the Qt for Embedded Linux server before it calls the disconnect() function...
int y() const
Returns the y coordinate of this point.
virtual int transformOrientation() const
Returns the current rotation as an integer value.
bool intersects(const QRegion &r) const
Returns true if this region intersects with region, otherwise returns false.
Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb)
virtual bool onCard(const unsigned char *) const
Returns true if the specified buffer is within the graphics card's memory; otherwise returns false (i...
int lstep
the number of bytes representing a line in the frame buffer.
bool isNull() const
Returns true if both the width and height is 0; otherwise returns false.
ClassId classId() const
Returns the class identifier for the screen object.
The QSize class defines the size of a two-dimensional object using integer point precision.
QPixmapDataFactory * pixmapFactory
QRegion translated(int dx, int dy) const
Returns a copy of the region that is translated dx along the x axis and dy along the y axis...
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
int x() const
Returns the x coordinate of this point.
int h
the logical height of the screen.
void setPixmapDataFactory(QPixmapDataFactory *factory)
virtual void set(unsigned int, unsigned int, unsigned int, unsigned int)
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
Q_GUI_EXPORT QScreenCursor * qt_screencursor
bool isOpaque() const
Returns true if the window is opaque, i.
virtual bool supportsDepth(int) const
Returns true if the screen supports the specified color depth; otherwise returns false.
virtual void exposeRegion(QRegion r, int changing)
This function is called by the Qt for Embedded Linux server whenever a screen update is required...
const unsigned char * qt_probe_bus()
int mapsize
the total number of bytes in the frame buffer
virtual void show()
Shows the mouse cursor.
static bool isWidgetPaintOnScreen(const QWidget *w)
virtual QImage image() const =0
Implement this function to return an image of the top-level window.
#define qPrintable(string)
static Type type()
Returns the type of application (Tty , GuiClient, or GuiServer).
QRegion paintedRegion() const
Returns the region that the window is known to have drawn into.
enum QSpanData::Type type
bool operator==(QBool b1, bool b2)
int size() const
Returns the number of items in the vector.
virtual int pixmapDepth() const
Returns the preferred depth for pixmaps, in bits per pixel.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
virtual void solidFill(const QColor &color, const QRegion ®ion)
Fills the given region of the screen with the specified color.
virtual void set(const QImage &image, int hotx, int hoty)
Sets the cursor's image to be the given image.
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
Q_CORE_EXPORT void qCritical(const char *,...)
QPoint offset() const
Returns the logical offset of the screen, i.
QWSServer Q_GUI_EXPORT * qwsServer
int depth() const
Returns the depth of the framebuffer, in bits per pixel.
const QList< QWSWindow * > & clientWindows()
Returns the list of current top-level windows.
The QList class is a template class that provides lists.
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.