Qt 4.8
Classes | Functions | Variables
qdirectfbpixmap.cpp File Reference
#include "qdirectfbpixmap.h"
#include "qdirectfbscreen.h"
#include "qdirectfbpaintengine.h"
#include <QtGui/qbitmap.h>
#include <QtCore/qfile.h>
#include <directfb.h>

Go to the source code of this file.

Classes

struct  QDirectFBInterfaceCleanupHandler< T >
 
class  QDirectFBPointer< T >
 

Functions

static bool checkForAlphaPixels (const QImage &img)
 
static bool isOpaqueFormat (QImage::Format format)
 
Q_GUI_EXPORT IDirectFBSurface * qt_directfb_surface_for_pixmap (const QPixmap &pixmap)
 

Variables

static int global_ser_no = 0
 

Function Documentation

◆ checkForAlphaPixels()

static bool checkForAlphaPixels ( const QImage img)
static

Definition at line 96 of file qdirectfbpixmap.cpp.

Referenced by QDirectFBPixmapData::hasAlphaChannel().

97 {
98  const uchar *bits = img.bits();
99  const int bytes_per_line = img.bytesPerLine();
100  const uchar *end_bits = bits + bytes_per_line;
101  const int width = img.width();
102  const int height = img.height();
103  switch (img.format()) {
105  return img.hasAlphaChannel();
108  for (int y=0; y<height; ++y) {
109  for (int x=0; x<width; ++x) {
110  if ((((uint *)bits)[x] & 0xff000000) != 0xff000000) {
111  return true;
112  }
113  }
114  bits += bytes_per_line;
115  }
116  break;
117 
120  for (int y=0; y<height; ++y) {
121  while (bits < end_bits) {
122  if (bits[0] != 0) {
123  return true;
124  }
125  bits += 3;
126  }
127  bits = end_bits;
128  end_bits += bytes_per_line;
129  }
130  break;
131 
133  for (int y=0; y<height; ++y) {
134  while (bits < end_bits) {
135  if ((bits[0] & 0xfc) != 0) {
136  return true;
137  }
138  bits += 3;
139  }
140  bits = end_bits;
141  end_bits += bytes_per_line;
142  }
143  break;
144 
146  for (int y=0; y<height; ++y) {
147  while (bits < end_bits) {
148  if ((bits[0] & 0xf0) != 0) {
149  return true;
150  }
151  bits += 2;
152  }
153  bits = end_bits;
154  end_bits += bytes_per_line;
155  }
156  break;
157 
158  default:
159  break;
160  }
161 
162  return false;
163 }
bool hasAlphaChannel() const
Returns true if the image has a format that respects the alpha channel, otherwise returns false...
Definition: qimage.cpp:6495
int bytesPerLine() const
Returns the number of bytes per image scanline.
Definition: qimage.cpp:1812
Format format() const
Returns the format of the image.
Definition: qimage.cpp:2305
unsigned char uchar
Definition: qglobal.h:994
unsigned int uint
Definition: qglobal.h:996
uchar * bits()
Returns a pointer to the first pixel data.
Definition: qimage.cpp:1946
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572

◆ isOpaqueFormat()

static bool isOpaqueFormat ( QImage::Format  format)
inlinestatic

Definition at line 386 of file qdirectfbpixmap.cpp.

Referenced by QDirectFBPixmapData::fill().

387 {
388  switch (format) {
395  return true;
396  default:
397  break;
398  }
399  return false;
400 }

◆ qt_directfb_surface_for_pixmap()

Q_GUI_EXPORT IDirectFBSurface* qt_directfb_surface_for_pixmap ( const QPixmap pixmap)

Definition at line 577 of file qdirectfbpixmap.cpp.

578 {
579  const QPixmapData *data = pixmap.pixmapData();
580  if (!data || data->classId() != QPixmapData::DirectFBClass)
581  return 0;
582  const QDirectFBPixmapData *dfbData = static_cast<const QDirectFBPixmapData*>(data);
583  return dfbData->directFBSurface();
584 }
static const char * data(const QByteArray &arr)
ClassId classId() const
virtual IDirectFBSurface * directFBSurface() const
QPixmapData * pixmapData() const
Definition: qpixmap.cpp:2277

Variable Documentation

◆ global_ser_no

int global_ser_no = 0
static