|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the plugins of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include "qdirectfbpixmap.h" |
|
43 |
|
44 #ifndef QT_NO_QWS_DIRECTFB |
|
45 |
|
46 #include "qdirectfbscreen.h" |
|
47 #include "qdirectfbpaintengine.h" |
|
48 |
|
49 #include <QtGui/qbitmap.h> |
|
50 #include <QtCore/qfile.h> |
|
51 #include <directfb.h> |
|
52 |
|
53 |
|
54 QT_BEGIN_NAMESPACE |
|
55 |
|
56 static int global_ser_no = 0; |
|
57 |
|
58 QDirectFBPixmapData::QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixelType) |
|
59 : QPixmapData(pixelType, DirectFBClass), QDirectFBPaintDevice(screen), |
|
60 alpha(false) |
|
61 { |
|
62 setSerialNumber(0); |
|
63 } |
|
64 |
|
65 QDirectFBPixmapData::~QDirectFBPixmapData() |
|
66 { |
|
67 } |
|
68 |
|
69 void QDirectFBPixmapData::resize(int width, int height) |
|
70 { |
|
71 if (width <= 0 || height <= 0) { |
|
72 invalidate(); |
|
73 return; |
|
74 } |
|
75 |
|
76 imageFormat = screen->pixelFormat(); |
|
77 dfbSurface = screen->createDFBSurface(QSize(width, height), |
|
78 imageFormat, |
|
79 QDirectFBScreen::TrackSurface); |
|
80 d = QDirectFBScreen::depth(imageFormat); |
|
81 alpha = false; |
|
82 if (!dfbSurface) { |
|
83 invalidate(); |
|
84 qWarning("QDirectFBPixmapData::resize(): Unable to allocate surface"); |
|
85 return; |
|
86 } |
|
87 |
|
88 w = width; |
|
89 h = height; |
|
90 is_null = (w <= 0 || h <= 0); |
|
91 setSerialNumber(++global_ser_no); |
|
92 } |
|
93 |
|
94 // mostly duplicated from qimage.cpp (QImageData::checkForAlphaPixels) |
|
95 static bool checkForAlphaPixels(const QImage &img) |
|
96 { |
|
97 const uchar *bits = img.bits(); |
|
98 const int bytes_per_line = img.bytesPerLine(); |
|
99 const uchar *end_bits = bits + bytes_per_line; |
|
100 const int width = img.width(); |
|
101 const int height = img.height(); |
|
102 switch (img.format()) { |
|
103 case QImage::Format_Indexed8: |
|
104 return img.hasAlphaChannel(); |
|
105 case QImage::Format_ARGB32: |
|
106 case QImage::Format_ARGB32_Premultiplied: |
|
107 for (int y=0; y<height; ++y) { |
|
108 for (int x=0; x<width; ++x) { |
|
109 if ((((uint *)bits)[x] & 0xff000000) != 0xff000000) { |
|
110 return true; |
|
111 } |
|
112 } |
|
113 bits += bytes_per_line; |
|
114 } |
|
115 break; |
|
116 |
|
117 case QImage::Format_ARGB8555_Premultiplied: |
|
118 case QImage::Format_ARGB8565_Premultiplied: |
|
119 for (int y=0; y<height; ++y) { |
|
120 while (bits < end_bits) { |
|
121 if (bits[0] != 0) { |
|
122 return true; |
|
123 } |
|
124 bits += 3; |
|
125 } |
|
126 bits = end_bits; |
|
127 end_bits += bytes_per_line; |
|
128 } |
|
129 break; |
|
130 |
|
131 case QImage::Format_ARGB6666_Premultiplied: |
|
132 for (int y=0; y<height; ++y) { |
|
133 while (bits < end_bits) { |
|
134 if ((bits[0] & 0xfc) != 0) { |
|
135 return true; |
|
136 } |
|
137 bits += 3; |
|
138 } |
|
139 bits = end_bits; |
|
140 end_bits += bytes_per_line; |
|
141 } |
|
142 break; |
|
143 |
|
144 case QImage::Format_ARGB4444_Premultiplied: |
|
145 for (int y=0; y<height; ++y) { |
|
146 while (bits < end_bits) { |
|
147 if ((bits[0] & 0xf0) != 0) { |
|
148 return true; |
|
149 } |
|
150 bits += 2; |
|
151 } |
|
152 bits = end_bits; |
|
153 end_bits += bytes_per_line; |
|
154 } |
|
155 break; |
|
156 |
|
157 default: |
|
158 break; |
|
159 } |
|
160 |
|
161 return false; |
|
162 } |
|
163 |
|
164 bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img) |
|
165 { |
|
166 #ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION |
|
167 return checkForAlphaPixels(img); |
|
168 #else |
|
169 return img.hasAlphaChannel(); |
|
170 #endif |
|
171 } |
|
172 |
|
173 #ifdef QT_DIRECTFB_IMAGEPROVIDER |
|
174 bool QDirectFBPixmapData::fromFile(const QString &filename, const char *format, |
|
175 Qt::ImageConversionFlags flags) |
|
176 { |
|
177 if (flags == Qt::AutoColor) { |
|
178 if (filename.startsWith(QLatin1Char(':'))) { // resource |
|
179 QFile file(filename); |
|
180 if (!file.open(QIODevice::ReadOnly)) |
|
181 return false; |
|
182 const QByteArray data = file.readAll(); |
|
183 file.close(); |
|
184 return fromData(reinterpret_cast<const uchar*>(data.constData()), data.size(), format, flags); |
|
185 } else { |
|
186 DFBDataBufferDescription description; |
|
187 description.flags = DBDESC_FILE; |
|
188 const QByteArray fileNameData = filename.toLocal8Bit(); |
|
189 description.file = fileNameData.constData(); |
|
190 if (fromDataBufferDescription(description)) { |
|
191 return true; |
|
192 } |
|
193 // fall back to Qt |
|
194 } |
|
195 } |
|
196 return QPixmapData::fromFile(filename, format, flags); |
|
197 } |
|
198 |
|
199 bool QDirectFBPixmapData::fromData(const uchar *buffer, uint len, const char *format, |
|
200 Qt::ImageConversionFlags flags) |
|
201 { |
|
202 if (flags == Qt::AutoColor) { |
|
203 DFBDataBufferDescription description; |
|
204 description.flags = DBDESC_MEMORY; |
|
205 description.memory.data = buffer; |
|
206 description.memory.length = len; |
|
207 if (fromDataBufferDescription(description)) |
|
208 return true; |
|
209 // fall back to Qt |
|
210 } |
|
211 return QPixmapData::fromData(buffer, len, format, flags); |
|
212 } |
|
213 |
|
214 template <typename T> struct QDirectFBInterfaceCleanupHandler |
|
215 { |
|
216 static void cleanup(T *t) { if (t) t->Release(t); } |
|
217 }; |
|
218 |
|
219 template <typename T> |
|
220 class QDirectFBPointer : public QScopedPointer<T, QDirectFBInterfaceCleanupHandler<T> > |
|
221 { |
|
222 public: |
|
223 QDirectFBPointer(T *t = 0) |
|
224 : QScopedPointer<T, QDirectFBInterfaceCleanupHandler<T> >(t) |
|
225 {} |
|
226 }; |
|
227 |
|
228 bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescription &dataBufferDescription) |
|
229 { |
|
230 IDirectFB *dfb = screen->dfb(); |
|
231 Q_ASSERT(dfb); |
|
232 DFBResult result = DFB_OK; |
|
233 IDirectFBDataBuffer *dataBufferPtr; |
|
234 if ((result = dfb->CreateDataBuffer(dfb, &dataBufferDescription, &dataBufferPtr)) != DFB_OK) { |
|
235 DirectFBError("QDirectFBPixmapData::fromDataBufferDescription()", result); |
|
236 return false; |
|
237 } |
|
238 QDirectFBPointer<IDirectFBDataBuffer> dataBuffer(dataBufferPtr); |
|
239 |
|
240 IDirectFBImageProvider *providerPtr; |
|
241 if ((result = dataBuffer->CreateImageProvider(dataBuffer.data(), &providerPtr)) != DFB_OK) { |
|
242 DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't create image provider", result); |
|
243 return false; |
|
244 } |
|
245 QDirectFBPointer<IDirectFBImageProvider> provider(providerPtr); |
|
246 |
|
247 DFBSurfaceDescription surfaceDescription; |
|
248 if ((result = provider->GetSurfaceDescription(provider.data(), &surfaceDescription)) != DFB_OK) { |
|
249 DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't get surface description", result); |
|
250 return false; |
|
251 } |
|
252 |
|
253 DFBImageDescription imageDescription; |
|
254 result = provider->GetImageDescription(provider.data(), &imageDescription); |
|
255 if (result != DFB_OK) { |
|
256 DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't get image description", result); |
|
257 return false; |
|
258 } |
|
259 |
|
260 alpha = imageDescription.caps & (DICAPS_ALPHACHANNEL|DICAPS_COLORKEY); |
|
261 imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat(); |
|
262 |
|
263 dfbSurface = screen->createDFBSurface(QSize(surfaceDescription.width, surfaceDescription.height), |
|
264 imageFormat, QDirectFBScreen::TrackSurface); |
|
265 |
|
266 result = provider->RenderTo(provider.data(), dfbSurface, 0); |
|
267 if (result != DFB_OK) { |
|
268 DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't render to surface", result); |
|
269 return false; |
|
270 } |
|
271 |
|
272 w = surfaceDescription.width; |
|
273 h = surfaceDescription.height; |
|
274 is_null = (w <= 0 || h <= 0); |
|
275 d = QDirectFBScreen::depth(imageFormat); |
|
276 setSerialNumber(++global_ser_no); |
|
277 |
|
278 #if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE |
|
279 screen->setDirectFBImageProvider(providerPtr); |
|
280 provider.take(); |
|
281 #endif |
|
282 |
|
283 return true; |
|
284 } |
|
285 |
|
286 #endif |
|
287 |
|
288 void QDirectFBPixmapData::fromImage(const QImage &img, |
|
289 Qt::ImageConversionFlags flags) |
|
290 { |
|
291 if (img.depth() == 1 || img.format() == QImage::Format_RGB32) { |
|
292 fromImage(img.convertToFormat(screen->alphaPixmapFormat()), flags); |
|
293 return; |
|
294 } |
|
295 |
|
296 if (img.hasAlphaChannel() |
|
297 #ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION |
|
298 && (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img)) |
|
299 #endif |
|
300 ) { |
|
301 alpha = true; |
|
302 imageFormat = screen->alphaPixmapFormat(); |
|
303 } else { |
|
304 alpha = false; |
|
305 imageFormat = screen->pixelFormat(); |
|
306 } |
|
307 QImage image; |
|
308 if (flags != Qt::AutoColor) { |
|
309 image = img.convertToFormat(imageFormat, flags); |
|
310 flags = Qt::AutoColor; |
|
311 } else if (img.format() == QImage::Format_RGB32) { |
|
312 image = img.convertToFormat(imageFormat, flags); |
|
313 } else { |
|
314 image = img; |
|
315 } |
|
316 |
|
317 IDirectFBSurface *imageSurface = screen->createDFBSurface(image, image.format(), QDirectFBScreen::DontTrackSurface); |
|
318 if (!imageSurface) { |
|
319 qWarning("QDirectFBPixmapData::fromImage()"); |
|
320 invalidate(); |
|
321 return; |
|
322 } |
|
323 |
|
324 dfbSurface = screen->createDFBSurface(image.size(), imageFormat, QDirectFBScreen::TrackSurface); |
|
325 if (!dfbSurface) { |
|
326 qWarning("QDirectFBPixmapData::fromImage()"); |
|
327 invalidate(); |
|
328 return; |
|
329 } |
|
330 |
|
331 if (image.hasAlphaChannel()) { |
|
332 dfbSurface->Clear(dfbSurface, 0, 0, 0, 0); |
|
333 dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_BLEND_ALPHACHANNEL); |
|
334 } else { |
|
335 dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); |
|
336 } |
|
337 |
|
338 dfbSurface->Blit(dfbSurface, imageSurface, 0, 0, 0); |
|
339 imageSurface->Release(imageSurface); |
|
340 |
|
341 w = image.width(); |
|
342 h = image.height(); |
|
343 is_null = (w <= 0 || h <= 0); |
|
344 d = QDirectFBScreen::depth(imageFormat); |
|
345 setSerialNumber(++global_ser_no); |
|
346 #ifdef QT_NO_DIRECTFB_OPAQUE_DETECTION |
|
347 Q_UNUSED(flags); |
|
348 #endif |
|
349 } |
|
350 |
|
351 void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect) |
|
352 { |
|
353 if (data->classId() != DirectFBClass) { |
|
354 QPixmapData::copy(data, rect); |
|
355 return; |
|
356 } |
|
357 |
|
358 const QDirectFBPixmapData *otherData = static_cast<const QDirectFBPixmapData*>(data); |
|
359 #ifdef QT_NO_DIRECTFB_SUBSURFACE |
|
360 if (otherData->lockFlags()) { |
|
361 const_cast<QDirectFBPixmapData*>(otherData)->unlockSurface(); |
|
362 } |
|
363 #endif |
|
364 IDirectFBSurface *src = otherData->directFBSurface(); |
|
365 alpha = data->hasAlphaChannel(); |
|
366 imageFormat = (alpha |
|
367 ? QDirectFBScreen::instance()->alphaPixmapFormat() |
|
368 : QDirectFBScreen::instance()->pixelFormat()); |
|
369 |
|
370 |
|
371 dfbSurface = screen->createDFBSurface(rect.size(), imageFormat, |
|
372 QDirectFBScreen::TrackSurface); |
|
373 if (!dfbSurface) { |
|
374 qWarning("QDirectFBPixmapData::copy()"); |
|
375 invalidate(); |
|
376 return; |
|
377 } |
|
378 |
|
379 if (alpha) { |
|
380 dfbSurface->Clear(dfbSurface, 0, 0, 0, 0); |
|
381 dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_BLEND_ALPHACHANNEL); |
|
382 } else { |
|
383 dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); |
|
384 } |
|
385 const DFBRectangle blitRect = { rect.x(), rect.y(), |
|
386 rect.width(), rect.height() }; |
|
387 w = rect.width(); |
|
388 h = rect.height(); |
|
389 d = otherData->d; |
|
390 is_null = (w <= 0 || h <= 0); |
|
391 unlockSurface(); |
|
392 DFBResult result = dfbSurface->Blit(dfbSurface, src, &blitRect, 0, 0); |
|
393 #if (Q_DIRECTFB_VERSION >= 0x010000) |
|
394 dfbSurface->ReleaseSource(dfbSurface); |
|
395 #endif |
|
396 if (result != DFB_OK) { |
|
397 DirectFBError("QDirectFBPixmapData::copy()", result); |
|
398 invalidate(); |
|
399 return; |
|
400 } |
|
401 |
|
402 setSerialNumber(++global_ser_no); |
|
403 } |
|
404 |
|
405 static inline bool isOpaqueFormat(QImage::Format format) |
|
406 { |
|
407 switch (format) { |
|
408 case QImage::Format_RGB32: |
|
409 case QImage::Format_RGB16: |
|
410 case QImage::Format_RGB666: |
|
411 case QImage::Format_RGB555: |
|
412 case QImage::Format_RGB888: |
|
413 case QImage::Format_RGB444: |
|
414 return true; |
|
415 default: |
|
416 break; |
|
417 } |
|
418 return false; |
|
419 } |
|
420 |
|
421 void QDirectFBPixmapData::fill(const QColor &color) |
|
422 { |
|
423 if (!serialNumber()) |
|
424 return; |
|
425 |
|
426 Q_ASSERT(dfbSurface); |
|
427 |
|
428 alpha = (color.alpha() < 255); |
|
429 |
|
430 if (alpha && isOpaqueFormat(imageFormat)) { |
|
431 QSize size; |
|
432 dfbSurface->GetSize(dfbSurface, &size.rwidth(), &size.rheight()); |
|
433 screen->releaseDFBSurface(dfbSurface); |
|
434 imageFormat = screen->alphaPixmapFormat(); |
|
435 d = QDirectFBScreen::depth(imageFormat); |
|
436 dfbSurface = screen->createDFBSurface(size, screen->alphaPixmapFormat(), QDirectFBScreen::TrackSurface); |
|
437 setSerialNumber(++global_ser_no); |
|
438 if (!dfbSurface) { |
|
439 qWarning("QDirectFBPixmapData::fill()"); |
|
440 invalidate(); |
|
441 return; |
|
442 } |
|
443 } |
|
444 |
|
445 dfbSurface->Clear(dfbSurface, color.red(), color.green(), color.blue(), color.alpha()); |
|
446 } |
|
447 |
|
448 QPixmap QDirectFBPixmapData::transformed(const QTransform &transform, |
|
449 Qt::TransformationMode mode) const |
|
450 { |
|
451 QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this); |
|
452 #ifdef QT_NO_DIRECTFB_SUBSURFACE |
|
453 if (lockFlags()) |
|
454 that->unlockSurface(); |
|
455 #endif |
|
456 |
|
457 if (!dfbSurface || transform.type() != QTransform::TxScale |
|
458 || mode != Qt::FastTransformation) |
|
459 { |
|
460 const QImage *image = that->buffer(); |
|
461 Q_ASSERT(image); |
|
462 const QImage transformed = image->transformed(transform, mode); |
|
463 QDirectFBPixmapData *data = new QDirectFBPixmapData(screen, QPixmapData::PixmapType); |
|
464 data->fromImage(transformed, Qt::AutoColor); |
|
465 return QPixmap(data); |
|
466 } |
|
467 |
|
468 const QSize size = transform.mapRect(QRect(0, 0, w, h)).size(); |
|
469 if (size.isEmpty()) |
|
470 return QPixmap(); |
|
471 |
|
472 QDirectFBPixmapData *data = new QDirectFBPixmapData(screen, QPixmapData::PixmapType); |
|
473 DFBSurfaceBlittingFlags flags = DSBLIT_NOFX; |
|
474 data->alpha = alpha; |
|
475 if (alpha) { |
|
476 flags = DSBLIT_BLEND_ALPHACHANNEL; |
|
477 } |
|
478 data->dfbSurface = screen->createDFBSurface(size, |
|
479 imageFormat, |
|
480 QDirectFBScreen::TrackSurface); |
|
481 if (flags & DSBLIT_BLEND_ALPHACHANNEL) { |
|
482 data->dfbSurface->Clear(data->dfbSurface, 0, 0, 0, 0); |
|
483 } |
|
484 data->dfbSurface->SetBlittingFlags(data->dfbSurface, flags); |
|
485 |
|
486 const DFBRectangle destRect = { 0, 0, size.width(), size.height() }; |
|
487 data->dfbSurface->StretchBlit(data->dfbSurface, dfbSurface, 0, &destRect); |
|
488 data->w = size.width(); |
|
489 data->h = size.height(); |
|
490 data->is_null = (data->w <= 0 || data->h <= 0); |
|
491 |
|
492 #if (Q_DIRECTFB_VERSION >= 0x010000) |
|
493 data->dfbSurface->ReleaseSource(data->dfbSurface); |
|
494 #endif |
|
495 return QPixmap(data); |
|
496 } |
|
497 |
|
498 QImage QDirectFBPixmapData::toImage() const |
|
499 { |
|
500 if (!dfbSurface) |
|
501 return QImage(); |
|
502 |
|
503 #if 0 |
|
504 // In later versions of DirectFB one can set a flag to tell |
|
505 // DirectFB not to move the surface to videomemory. When that |
|
506 // happens we can use this (hopefully faster) codepath |
|
507 #ifndef QT_NO_DIRECTFB_PREALLOCATED |
|
508 QImage ret(w, h, QDirectFBScreen::getImageFormat(dfbSurface)); |
|
509 if (IDirectFBSurface *imgSurface = screen->createDFBSurface(ret, QDirectFBScreen::DontTrackSurface)) { |
|
510 if (hasAlphaChannel()) { |
|
511 imgSurface->SetBlittingFlags(imgSurface, DSBLIT_BLEND_ALPHACHANNEL); |
|
512 imgSurface->Clear(imgSurface, 0, 0, 0, 0); |
|
513 } else { |
|
514 imgSurface->SetBlittingFlags(imgSurface, DSBLIT_NOFX); |
|
515 } |
|
516 imgSurface->Blit(imgSurface, dfbSurface, 0, 0, 0); |
|
517 #if (Q_DIRECTFB_VERSION >= 0x010000) |
|
518 imgSurface->ReleaseSource(imgSurface); |
|
519 #endif |
|
520 imgSurface->Release(imgSurface); |
|
521 return ret; |
|
522 } |
|
523 #endif |
|
524 #endif |
|
525 |
|
526 QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this); |
|
527 const QImage *img = that->buffer(); |
|
528 return img->copy(); |
|
529 } |
|
530 |
|
531 /* This is QPixmapData::paintEngine(), not QPaintDevice::paintEngine() */ |
|
532 |
|
533 QPaintEngine *QDirectFBPixmapData::paintEngine() const |
|
534 { |
|
535 if (!engine) { |
|
536 // QDirectFBPixmapData is also a QCustomRasterPaintDevice, so pass |
|
537 // that to the paint engine: |
|
538 QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this); |
|
539 that->engine = new QDirectFBPaintEngine(that); |
|
540 } |
|
541 return engine; |
|
542 } |
|
543 |
|
544 QImage *QDirectFBPixmapData::buffer() |
|
545 { |
|
546 if (!lockFlgs) { |
|
547 lockSurface(DSLF_READ|DSLF_WRITE); |
|
548 } |
|
549 Q_ASSERT(lockFlgs); |
|
550 Q_ASSERT(!lockedImage.isNull()); |
|
551 return &lockedImage; |
|
552 } |
|
553 |
|
554 void QDirectFBPixmapData::invalidate() |
|
555 { |
|
556 if (dfbSurface) { |
|
557 screen->releaseDFBSurface(dfbSurface); |
|
558 dfbSurface = 0; |
|
559 } |
|
560 setSerialNumber(0); |
|
561 alpha = false; |
|
562 d = w = h = 0; |
|
563 is_null = true; |
|
564 imageFormat = QImage::Format_Invalid; |
|
565 } |
|
566 |
|
567 QT_END_NAMESPACE |
|
568 |
|
569 #endif // QT_NO_QWS_DIRECTFB |
|
570 |
|
571 |
|
572 |