- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
r651 r769 62 62 , flipFlags(flip) 63 63 , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) 64 , flushPending(false) 64 65 { 65 66 #ifdef QT_NO_DIRECTFB_WM … … 81 82 , flipFlags(flip) 82 83 , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) 84 , flushPending(false) 83 85 { 84 86 SurfaceFlags flags = 0; … … 93 95 flags = Buffered; 94 96 } 95 #else96 noSystemBackground = widget && widget->testAttribute(Qt::WA_NoSystemBackground);97 if (noSystemBackground)98 flags &= ~Opaque;99 97 #endif 100 98 setSurfaceFlags(flags); … … 135 133 qFatal("QDirectFBWindowSurface: Unable to get primary display layer!"); 136 134 135 updateIsOpaque(); 136 137 137 DFBWindowDescription description; 138 138 memset(&description, 0, sizeof(DFBWindowDescription)); 139 139 140 description.flags = DWDESC_CAPS|DWDESC_HEIGHT|DWDESC_WIDTH|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT; 140 141 description.caps = DWCAPS_NODECORATION; 141 description.flags = DWDESC_CAPS|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT|DWDESC_HEIGHT|DWDESC_WIDTH|DWDESC_POSX|DWDESC_POSY; 142 #if (Q_DIRECTFB_VERSION >= 0x010200) 143 description.flags |= DWDESC_OPTIONS; 144 #endif 145 146 if (noSystemBackground) { 142 description.surface_caps = DSCAPS_NONE; 143 imageFormat = screen->pixelFormat(); 144 145 if (!(surfaceFlags() & Opaque)) { 146 imageFormat = screen->alphaPixmapFormat(); 147 147 description.caps |= DWCAPS_ALPHACHANNEL; 148 148 #if (Q_DIRECTFB_VERSION >= 0x010200) 149 description.flags |= DWDESC_OPTIONS; 149 150 description.options |= DWOP_ALPHACHANNEL; 150 151 #endif 151 152 } 152 153 description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(imageFormat); 153 154 description.posx = rect.x(); 154 155 description.posy = rect.y(); 155 156 description.width = rect.width(); 156 157 description.height = rect.height(); 157 description.surface_caps = DSCAPS_NONE; 158 159 if (QDirectFBScreen::isPremultiplied(imageFormat)) 160 description.surface_caps = DSCAPS_PREMULTIPLIED; 161 158 162 if (screen->directFBFlags() & QDirectFBScreen::VideoOnly) 159 163 description.surface_caps |= DSCAPS_VIDEOONLY; 160 const QImage::Format format = (noSystemBackground ? screen->alphaPixmapFormat() : screen->pixelFormat());161 description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(format);162 if (QDirectFBScreen::isPremultiplied(format))163 description.surface_caps = DSCAPS_PREMULTIPLIED;164 164 165 165 DFBResult result = layer->CreateWindow(layer, &description, &dfbWindow); … … 183 183 Q_ASSERT(!dfbSurface); 184 184 dfbWindow->GetSurface(dfbWindow, &dfbSurface); 185 updateFormat();186 185 } 187 186 … … 268 267 } else { // mode == Offscreen 269 268 if (!dfbSurface) { 270 dfbSurface = screen->createDFBSurface(rect.size(), screen->pixelFormat(), QDirectFBScreen::DontTrackSurface); 269 dfbSurface = screen->createDFBSurface(rect.size(), surfaceFlags() & Opaque ? screen->pixelFormat() : screen->alphaPixmapFormat(), 270 QDirectFBScreen::DontTrackSurface); 271 271 } 272 272 } … … 275 275 #endif 276 276 } 277 if (oldSurface != dfbSurface) 278 updateFormat(); 277 if (oldSurface != dfbSurface) { 278 imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid; 279 } 279 280 280 281 if (oldRect.size() != rect.size()) { … … 297 298 sibling = *reinterpret_cast<QDirectFBWindowSurface *const*>(state.constData()); 298 299 Q_ASSERT(sibling); 299 sibling->setSurfaceFlags(surfaceFlags()); 300 } 301 } 302 303 static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) 304 { 300 setSurfaceFlags(sibling->surfaceFlags()); 301 } 302 } 303 304 bool QDirectFBWindowSurface::scroll(const QRegion ®ion, int dx, int dy) 305 { 306 if (!dfbSurface || !(flipFlags & DSFLIP_BLIT) || region.rectCount() != 1) 307 return false; 308 if (flushPending) { 309 dfbSurface->Flip(dfbSurface, 0, DSFLIP_BLIT); 310 } else { 311 flushPending = true; 312 } 313 dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); 314 const QRect r = region.boundingRect(); 305 315 const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; 306 surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy); 307 const DFBRegion region = { rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy }; 308 surface->Flip(surface, ®ion, DSFLIP_BLIT); 309 } 310 311 bool QDirectFBWindowSurface::scroll(const QRegion ®ion, int dx, int dy) 312 { 313 if (!dfbSurface || !(flipFlags & DSFLIP_BLIT) || region.isEmpty()) 314 return false; 315 dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); 316 if (region.rectCount() == 1) { 317 scrollSurface(dfbSurface, region.boundingRect(), dx, dy); 318 } else { 319 const QVector<QRect> rects = region.rects(); 320 const int n = rects.size(); 321 for (int i=0; i<n; ++i) { 322 scrollSurface(dfbSurface, rects.at(i), dx, dy); 323 } 324 } 316 dfbSurface->Blit(dfbSurface, dfbSurface, &rect, r.x() + dx, r.y() + dy); 325 317 return true; 326 318 } … … 360 352 const QRect windowGeometry = geometry(); 361 353 #ifdef QT_DIRECTFB_WM 362 const bool wasNoSystemBackground = noSystemBackground;363 noSystemBackground = win->testAttribute(Qt::WA_NoSystemBackground);364 354 quint8 currentOpacity; 365 355 Q_ASSERT(dfbWindow); … … 369 359 } 370 360 371 setOpaque(noSystemBackground || windowOpacity != 0xff);372 if (wasNoSystemBackground != noSystemBackground) {373 releaseSurface();374 dfbWindow->Release(dfbWindow);375 dfbWindow = 0;376 createWindow(windowGeometry);377 win->update();378 return;379 }380 361 screen->flipSurface(dfbSurface, flipFlags, region, offset); 381 362 #else 382 setOpaque(windowOpacity != 0xff);363 setOpaque(windowOpacity == 0xff); 383 364 if (mode == Offscreen) { 384 365 screen->exposeRegion(region.translated(offset + geometry().topLeft()), 0); … … 397 378 } 398 379 #endif 380 flushPending = false; 399 381 } 400 382 … … 404 386 engine = new QDirectFBPaintEngine(this); 405 387 } 388 flushPending = true; 406 389 } 407 390 … … 443 426 } 444 427 445 void QDirectFBWindowSurface::updateFormat()446 {447 imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid;448 }449 450 428 void QDirectFBWindowSurface::releaseSurface() 451 429 { … … 466 444 } 467 445 446 void QDirectFBWindowSurface::updateIsOpaque() 447 { 448 const QWidget *win = window(); 449 Q_ASSERT(win); 450 if (win->testAttribute(Qt::WA_OpaquePaintEvent) || win->testAttribute(Qt::WA_PaintOnScreen)) { 451 setOpaque(true); 452 return; 453 } 454 455 if (qFuzzyCompare(static_cast<float>(win->windowOpacity()), 1.0f)) { 456 const QPalette &pal = win->palette(); 457 458 if (win->autoFillBackground()) { 459 const QBrush &autoFillBrush = pal.brush(win->backgroundRole()); 460 if (autoFillBrush.style() != Qt::NoBrush && autoFillBrush.isOpaque()) { 461 setOpaque(true); 462 return; 463 } 464 } 465 466 if (win->isWindow() && !win->testAttribute(Qt::WA_NoSystemBackground)) { 467 const QBrush &windowBrush = win->palette().brush(QPalette::Window); 468 if (windowBrush.style() != Qt::NoBrush && windowBrush.isOpaque()) { 469 setOpaque(true); 470 return; 471 } 472 } 473 } 474 setOpaque(false); 475 } 468 476 469 477 QT_END_NAMESPACE 470 478 471 479 #endif // QT_NO_QWS_DIRECTFB 472 473
Note:
See TracChangeset
for help on using the changeset viewer.