212 uchar *mem = QDirectFBScreen::lockSurface(surface, DSLF_WRITE, &bplDFB); |
212 uchar *mem = QDirectFBScreen::lockSurface(surface, DSLF_WRITE, &bplDFB); |
213 if (mem) { |
213 if (mem) { |
214 const int height = image.height(); |
214 const int height = image.height(); |
215 const int bplQt = image.bytesPerLine(); |
215 const int bplQt = image.bytesPerLine(); |
216 if (bplQt == bplDFB && bplQt == (image.width() * image.depth() / 8)) { |
216 if (bplQt == bplDFB && bplQt == (image.width() * image.depth() / 8)) { |
217 memcpy(mem, image.bits(), image.numBytes()); |
217 memcpy(mem, image.bits(), image.byteCount()); |
218 } else { |
218 } else { |
219 for (int i=0; i<height; ++i) { |
219 for (int i=0; i<height; ++i) { |
220 memcpy(mem, image.scanLine(i), bplQt); |
220 memcpy(mem, image.scanLine(i), bplQt); |
221 mem += bplDFB; |
221 mem += bplDFB; |
222 } |
222 } |
223 } |
223 } |
224 surface->Unlock(surface); |
224 surface->Unlock(surface); |
225 } |
225 } |
226 } |
226 } |
227 #ifdef QT_DIRECTFB_PALETTE |
227 #ifdef QT_DIRECTFB_PALETTE |
228 if (image.numColors() != 0 && surface) |
228 if (image.colorCount() != 0 && surface) |
229 QDirectFBScreen::setSurfaceColorTable(surface, image); |
229 QDirectFBScreen::setSurfaceColorTable(surface, image); |
230 #endif |
230 #endif |
231 return surface; |
231 return surface; |
232 } |
232 } |
233 |
233 |
956 const char *name; |
956 const char *name; |
957 uint flag; |
957 uint flag; |
958 }; |
958 }; |
959 |
959 |
960 static const FlagDescription accelerationDescriptions[] = { |
960 static const FlagDescription accelerationDescriptions[] = { |
961 { " DFXL_NONE ", DFXL_NONE }, |
961 { "DFXL_NONE", DFXL_NONE }, |
962 { " DFXL_FILLRECTANGLE", DFXL_FILLRECTANGLE }, |
962 { "DFXL_FILLRECTANGLE", DFXL_FILLRECTANGLE }, |
963 { " DFXL_DRAWRECTANGLE", DFXL_DRAWRECTANGLE }, |
963 { "DFXL_DRAWRECTANGLE", DFXL_DRAWRECTANGLE }, |
964 { " DFXL_DRAWLINE", DFXL_DRAWLINE }, |
964 { "DFXL_DRAWLINE", DFXL_DRAWLINE }, |
965 { " DFXL_FILLTRIANGLE", DFXL_FILLTRIANGLE }, |
965 { "DFXL_FILLTRIANGLE", DFXL_FILLTRIANGLE }, |
966 { " DFXL_BLIT", DFXL_BLIT }, |
966 { "DFXL_BLIT", DFXL_BLIT }, |
967 { " DFXL_STRETCHBLIT", DFXL_STRETCHBLIT }, |
967 { "DFXL_STRETCHBLIT", DFXL_STRETCHBLIT }, |
968 { " DFXL_TEXTRIANGLES", DFXL_TEXTRIANGLES }, |
968 { "DFXL_TEXTRIANGLES", DFXL_TEXTRIANGLES }, |
969 { " DFXL_DRAWSTRING", DFXL_DRAWSTRING }, |
969 { "DFXL_DRAWSTRING", DFXL_DRAWSTRING }, |
970 { 0, 0 } |
970 { 0, 0 } |
971 }; |
971 }; |
972 |
972 |
973 static const FlagDescription blitDescriptions[] = { |
973 static const FlagDescription blitDescriptions[] = { |
974 { " DSBLIT_NOFX", DSBLIT_NOFX }, |
974 { "DSBLIT_NOFX", DSBLIT_NOFX }, |
975 { " DSBLIT_BLEND_ALPHACHANNEL", DSBLIT_BLEND_ALPHACHANNEL }, |
975 { "DSBLIT_BLEND_ALPHACHANNEL", DSBLIT_BLEND_ALPHACHANNEL }, |
976 { " DSBLIT_BLEND_COLORALPHA", DSBLIT_BLEND_COLORALPHA }, |
976 { "DSBLIT_BLEND_COLORALPHA", DSBLIT_BLEND_COLORALPHA }, |
977 { " DSBLIT_COLORIZE", DSBLIT_COLORIZE }, |
977 { "DSBLIT_COLORIZE", DSBLIT_COLORIZE }, |
978 { " DSBLIT_SRC_COLORKEY", DSBLIT_SRC_COLORKEY }, |
978 { "DSBLIT_SRC_COLORKEY", DSBLIT_SRC_COLORKEY }, |
979 { " DSBLIT_DST_COLORKEY", DSBLIT_DST_COLORKEY }, |
979 { "DSBLIT_DST_COLORKEY", DSBLIT_DST_COLORKEY }, |
980 { " DSBLIT_SRC_PREMULTIPLY", DSBLIT_SRC_PREMULTIPLY }, |
980 { "DSBLIT_SRC_PREMULTIPLY", DSBLIT_SRC_PREMULTIPLY }, |
981 { " DSBLIT_DST_PREMULTIPLY", DSBLIT_DST_PREMULTIPLY }, |
981 { "DSBLIT_DST_PREMULTIPLY", DSBLIT_DST_PREMULTIPLY }, |
982 { " DSBLIT_DEMULTIPLY", DSBLIT_DEMULTIPLY }, |
982 { "DSBLIT_DEMULTIPLY", DSBLIT_DEMULTIPLY }, |
983 { " DSBLIT_DEINTERLACE", DSBLIT_DEINTERLACE }, |
983 { "DSBLIT_DEINTERLACE", DSBLIT_DEINTERLACE }, |
984 #if (Q_DIRECTFB_VERSION >= 0x000923) |
984 #if (Q_DIRECTFB_VERSION >= 0x000923) |
985 { " DSBLIT_SRC_PREMULTCOLOR", DSBLIT_SRC_PREMULTCOLOR }, |
985 { "DSBLIT_SRC_PREMULTCOLOR", DSBLIT_SRC_PREMULTCOLOR }, |
986 { " DSBLIT_XOR", DSBLIT_XOR }, |
986 { "DSBLIT_XOR", DSBLIT_XOR }, |
987 #endif |
987 #endif |
988 #if (Q_DIRECTFB_VERSION >= 0x010000) |
988 #if (Q_DIRECTFB_VERSION >= 0x010000) |
989 { " DSBLIT_INDEX_TRANSLATION", DSBLIT_INDEX_TRANSLATION }, |
989 { "DSBLIT_INDEX_TRANSLATION", DSBLIT_INDEX_TRANSLATION }, |
990 #endif |
990 #endif |
991 { 0, 0 } |
991 { 0, 0 } |
992 }; |
992 }; |
993 |
993 |
994 static const FlagDescription drawDescriptions[] = { |
994 static const FlagDescription drawDescriptions[] = { |
995 { " DSDRAW_NOFX", DSDRAW_NOFX }, |
995 { "DSDRAW_NOFX", DSDRAW_NOFX }, |
996 { " DSDRAW_BLEND", DSDRAW_BLEND }, |
996 { "DSDRAW_BLEND", DSDRAW_BLEND }, |
997 { " DSDRAW_DST_COLORKEY", DSDRAW_DST_COLORKEY }, |
997 { "DSDRAW_DST_COLORKEY", DSDRAW_DST_COLORKEY }, |
998 { " DSDRAW_SRC_PREMULTIPLY", DSDRAW_SRC_PREMULTIPLY }, |
998 { "DSDRAW_SRC_PREMULTIPLY", DSDRAW_SRC_PREMULTIPLY }, |
999 { " DSDRAW_DST_PREMULTIPLY", DSDRAW_DST_PREMULTIPLY }, |
999 { "DSDRAW_DST_PREMULTIPLY", DSDRAW_DST_PREMULTIPLY }, |
1000 { " DSDRAW_DEMULTIPLY", DSDRAW_DEMULTIPLY }, |
1000 { "DSDRAW_DEMULTIPLY", DSDRAW_DEMULTIPLY }, |
1001 { " DSDRAW_XOR", DSDRAW_XOR }, |
1001 { "DSDRAW_XOR", DSDRAW_XOR }, |
1002 { 0, 0 } |
1002 { 0, 0 } |
1003 }; |
1003 }; |
1004 #endif |
1004 #endif |
1005 |
1005 |
1006 static const QByteArray flagDescriptions(uint mask, const FlagDescription *flags) |
1006 static const QByteArray flagDescriptions(uint mask, const FlagDescription *flags) |
1257 |
1257 |
1258 setIntOption(displayArgs, QLatin1String("width"), &w); |
1258 setIntOption(displayArgs, QLatin1String("width"), &w); |
1259 setIntOption(displayArgs, QLatin1String("height"), &h); |
1259 setIntOption(displayArgs, QLatin1String("height"), &h); |
1260 |
1260 |
1261 #ifndef QT_NO_DIRECTFB_LAYER |
1261 #ifndef QT_NO_DIRECTFB_LAYER |
1262 result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, DLID_PRIMARY, |
1262 int layerId = DLID_PRIMARY; |
|
1263 setIntOption(displayArgs, QLatin1String("layerid"), &layerId); |
|
1264 |
|
1265 result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, static_cast<DFBDisplayLayerID>(layerId), |
1263 &d_ptr->dfbLayer); |
1266 &d_ptr->dfbLayer); |
1264 if (result != DFB_OK) { |
1267 if (result != DFB_OK) { |
1265 DirectFBError("QDirectFBScreen::connect: " |
1268 DirectFBError("QDirectFBScreen::connect: " |
1266 "Unable to get primary display layer!", result); |
1269 "Unable to get display layer!", result); |
1267 return false; |
1270 return false; |
1268 } |
1271 } |
1269 result = d_ptr->dfbLayer->GetScreen(d_ptr->dfbLayer, &d_ptr->dfbScreen); |
1272 result = d_ptr->dfbLayer->GetScreen(d_ptr->dfbLayer, &d_ptr->dfbScreen); |
1270 #else |
1273 #else |
1271 result = d_ptr->dfb->GetScreen(d_ptr->dfb, 0, &d_ptr->dfbScreen); |
1274 result = d_ptr->dfb->GetScreen(d_ptr->dfb, 0, &d_ptr->dfbScreen); |
1562 primary->SetBlittingFlags(primary, cmd.blittingFlags); |
1565 primary->SetBlittingFlags(primary, cmd.blittingFlags); |
1563 if (cmd.blittingFlags & DSBLIT_BLEND_COLORALPHA) { |
1566 if (cmd.blittingFlags & DSBLIT_BLEND_COLORALPHA) { |
1564 primary->SetColor(primary, 0xff, 0xff, 0xff, cmd.windowOpacity); |
1567 primary->SetColor(primary, 0xff, 0xff, 0xff, cmd.windowOpacity); |
1565 } |
1568 } |
1566 const QRegion ®ion = cmd.source; |
1569 const QRegion ®ion = cmd.source; |
1567 const int rectCount = region.numRects(); |
1570 const int rectCount = region.rectCount(); |
1568 DFBRectangle source; |
1571 DFBRectangle source; |
1569 if (rectCount == 1) { |
1572 if (rectCount == 1) { |
1570 ::initParameters(source, region.boundingRect(), cmd.windowPosition); |
1573 ::initParameters(source, region.boundingRect(), cmd.windowPosition); |
1571 primary->Blit(primary, surface, &source, cmd.windowPosition.x() + source.x, cmd.windowPosition.y() + source.y); |
1574 primary->Blit(primary, surface, &source, cmd.windowPosition.x() + source.x, cmd.windowPosition.y() + source.y); |
1572 } else { |
1575 } else { |