summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2009-09-16 22:02:47 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2009-09-16 22:18:30 (GMT)
commit031498abcef715ab5db5379c0f03c03bce3e2364 (patch)
tree99b12e5ed6fc1fdfe670f92a575bec2859fdc46b /src/plugins
parentb0320ee05f8e5acabb82a8116d52a7d276798e9f (diff)
downloadQt-031498abcef715ab5db5379c0f03c03bce3e2364.zip
Qt-031498abcef715ab5db5379c0f03c03bce3e2364.tar.gz
Qt-031498abcef715ab5db5379c0f03c03bce3e2364.tar.bz2
Simplify QDirectFBPixmapData::fromDataBuffer
There's no need for the intermediate surface creation. RenderTo will handle things like palette/transparency etc. Should also provide some speedup. Reviewed-by: Noam Rosenthal <noam.rosenthal@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp51
1 files changed, 3 insertions, 48 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index b5c4cc5..ce9a55c 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -250,19 +250,6 @@ bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescripti
return false;
}
- QDirectFBPointer<IDirectFBSurface> surfaceFromDescription;
- surfaceFromDescription.reset(screen->createDFBSurface(surfaceDescription, QDirectFBScreen::DontTrackSurface, &result));
- if (!surfaceFromDescription) {
- DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't create surface", result);
- return false;
- }
-
- result = provider->RenderTo(provider.data(), surfaceFromDescription.data(), 0);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't render to surface", result);
- return false;
- }
-
DFBImageDescription imageDescription;
result = provider->GetImageDescription(provider.data(), &imageDescription);
if (result != DFB_OK) {
@@ -275,51 +262,19 @@ bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescripti
dfbSurface = screen->createDFBSurface(QSize(surfaceDescription.width, surfaceDescription.height),
imageFormat, QDirectFBScreen::TrackSurface);
- if (alpha)
- dfbSurface->Clear(dfbSurface, 0, 0, 0, 0);
-
- DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX;
- if (imageDescription.caps & DICAPS_COLORKEY) {
- blittingFlags |= DSBLIT_SRC_COLORKEY;
- result = surfaceFromDescription->SetSrcColorKey(surfaceFromDescription.data(),
- imageDescription.colorkey_r,
- imageDescription.colorkey_g,
- imageDescription.colorkey_b);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBPixmapData::fromSurfaceDescription: Can't set src color key", result);
- invalidate(); // release dfbSurface
- return false;
- }
- }
- if (imageDescription.caps & DICAPS_ALPHACHANNEL) {
- blittingFlags |= DSBLIT_BLEND_ALPHACHANNEL;
- }
- result = dfbSurface->SetBlittingFlags(dfbSurface, blittingFlags);
- if (result != DFB_OK) {
- DirectFBError("QDirectFBPixmapData::fromSurfaceDescription: Can't set blitting flags", result);
- invalidate(); // release dfbSurface
- return false;
- }
- result = dfbSurface->Blit(dfbSurface, surfaceFromDescription.data(), 0, 0, 0);
+ result = provider->RenderTo(provider.data(), dfbSurface, 0);
if (result != DFB_OK) {
- DirectFBError("QDirectFBPixmapData::fromSurfaceDescription: Can't blit to surface", result);
- invalidate(); // release dfbSurface
+ DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't render to surface", result);
return false;
}
- if (blittingFlags != DSBLIT_NOFX) {
- dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
- }
-
w = surfaceDescription.width;
h = surfaceDescription.height;
is_null = (w <= 0 || h <= 0);
d = QDirectFBScreen::depth(imageFormat);
setSerialNumber(++global_ser_no);
-#if (Q_DIRECTFB_VERSION >= 0x010000)
- dfbSurface->ReleaseSource(dfbSurface);
-#endif
+
#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
screen->setDirectFBImageProvider(providerPtr);
provider.take();