Qt 4.8
Public Functions | Private Functions | Properties | Static Private Attributes | Friends | List of all members
QMacPixmapData Class Reference

#include <qpixmap_mac_p.h>

Inheritance diagram for QMacPixmapData:
QPixmapData

Public Functions

QPixmap alphaChannel () const
 
void copy (const QPixmapData *data, const QRect &rect)
 
QPixmapDatacreateCompatiblePixmapData () const
 
void fill (const QColor &color)
 
void fromImage (const QImage &image, Qt::ImageConversionFlags flags)
 
bool hasAlphaChannel () const
 
QBitmap mask () const
 
int metric (QPaintDevice::PaintDeviceMetric metric) const
 
QPaintEnginepaintEngine () const
 
 QMacPixmapData (PixelType type)
 
void resize (int width, int height)
 
bool scroll (int dx, int dy, const QRect &rect)
 
void setAlphaChannel (const QPixmap &alphaChannel)
 
void setMask (const QBitmap &mask)
 
QImage toImage () const
 
 ~QMacPixmapData ()
 
- Public Functions inherited from QPixmapData
virtual QImagebuffer ()
 
qint64 cacheKey () const
 
ClassId classId () const
 
int colorCount () const
 
int depth () const
 
virtual bool fromData (const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags)
 
virtual bool fromFile (const QString &filename, const char *format, Qt::ImageConversionFlags flags)
 
virtual void fromImageReader (QImageReader *imageReader, Qt::ImageConversionFlags flags)
 
int height () const
 
bool isNull () const
 
QT_DEPRECATED int numColors () const
 
PixelType pixelType () const
 
 QPixmapData (PixelType pixelType, int classId)
 
virtual QPixmapDataruntimeData () const
 
int serialNumber () const
 
virtual QImage toImage (const QRect &rect) const
 
virtual QPixmap transformed (const QTransform &matrix, Qt::TransformationMode mode) const
 
int width () const
 
virtual ~QPixmapData ()
 

Private Functions

void macCreateCGImageRef ()
 
void macCreatePixels ()
 
void macGetAlphaChannel (QMacPixmapData *, bool asMask) const
 
void macReleaseCGImageRef ()
 
void macSetAlphaChannel (const QMacPixmapData *, bool asMask)
 
void macSetHasAlpha (bool b)
 

Properties

uint bytesPerRow
 
CGImageRef cg_data
 
CGImageRef cg_dataBeingReleased
 
CGImageRef cg_mask
 
QRectF cg_mask_rect
 
uint has_alpha: 1
 
uint has_mask: 1
 
QPaintEnginepengine
 
quint32pixels
 
uint pixelsSize
 
quint32pixelsToFree
 
uint uninit: 1
 

Static Private Attributes

static QSet< QMacPixmapData * > validDataPointers
 

Friends

QColor qcolorForThemeTextColor (ThemeTextColor themeColor)
 
class QCoreGraphicsPaintEngine
 
class QPixmap
 
class QRasterBuffer
 
class QRasterPaintEngine
 
CGContextRef qt_mac_cg_context (const QPaintDevice *)
 Returns the CoreGraphics CGContextRef of the paint device. More...
 
void qt_mac_cgimage_data_free (void *, const void *, size_t)
 
IconRef qt_mac_create_iconref (const QPixmap &)
 
CGImageRef qt_mac_create_imagemask (const QPixmap &, const QRectF &)
 
quint32qt_mac_pixmap_get_base (const QPixmap *)
 
int qt_mac_pixmap_get_bytes_per_line (const QPixmap *)
 

Additional Inherited Members

- Public Types inherited from QPixmapData
enum  ClassId {
  RasterClass, X11Class, MacClass, DirectFBClass,
  OpenGLClass, OpenVGClass, RuntimeClass, BlitterClass,
  CustomClass = 1024
}
 
enum  PixelType { PixmapType, BitmapType }
 
- Static Public Functions inherited from QPixmapData
static QPixmapDatacreate (int w, int h, PixelType type)
 
- Protected Functions inherited from QPixmapData
void setSerialNumber (int serNo)
 
- Protected Variables inherited from QPixmapData
int d
 
int h
 
bool is_null
 
int w
 

Detailed Description

Definition at line 62 of file qpixmap_mac_p.h.

Constructors and Destructors

◆ QMacPixmapData()

QMacPixmapData::QMacPixmapData ( PixelType  type)

Definition at line 173 of file qpixmap_mac.cpp.

Referenced by alphaChannel(), createCompatiblePixmapData(), macCreatePixels(), and mask().

175  uninit(true), pixels(0), pixelsSize(0), pixelsToFree(0),
177  pengine(0)
178 {
179 }
CGImageRef cg_data
CGImageRef cg_mask
PixelType type
QPixmapData(PixelType pixelType, int classId)
Definition: qpixmapdata.cpp:68
QPaintEngine * pengine
quint32 * pixelsToFree
quint32 * pixels
CGImageRef cg_dataBeingReleased

◆ ~QMacPixmapData()

QMacPixmapData::~QMacPixmapData ( )

Definition at line 519 of file qpixmap_mac.cpp.

520 {
522  if (cg_mask) {
523  CGImageRelease(cg_mask);
524  cg_mask = 0;
525  }
526 
527  delete pengine; // Make sure we aren't drawing on the context anymore.
528  if (cg_data) {
529  CGImageRelease(cg_data);
530  }
531  else if (pixels && (pixels != pixelsToFree))
532  free(pixels);
533  if (pixelsToFree)
534  free(pixelsToFree);
535 }
bool remove(const T &value)
Definition: qset.h:89
CGImageRef cg_data
CGImageRef cg_mask
QPaintEngine * pengine
quint32 * pixelsToFree
quint32 * pixels
static QSet< QMacPixmapData * > validDataPointers

Functions

◆ alphaChannel()

QPixmap QMacPixmapData::alphaChannel ( ) const
virtual

Reimplemented from QPixmapData.

Definition at line 442 of file qpixmap_mac.cpp.

443 {
444  if (!has_alpha)
445  return QPixmap();
446 
448  alpha->resize(w, h);
449  macGetAlphaChannel(alpha, false);
450  return QPixmap(alpha);
451 }
QMacPixmapData(PixelType type)
void resize(int width, int height)
void macGetAlphaChannel(QMacPixmapData *, bool asMask) const
friend class QPixmap

◆ copy()

void QMacPixmapData::copy ( const QPixmapData data,
const QRect rect 
)
virtual

Reimplemented from QPixmapData.

Definition at line 1198 of file qpixmap_mac.cpp.

1199 {
1200  if (data->pixelType() == BitmapType) {
1201  QBitmap::fromImage(toImage().copy(rect));
1202  return;
1203  }
1204 
1205  const QMacPixmapData *macData = static_cast<const QMacPixmapData*>(data);
1206 
1207  resize(rect.width(), rect.height());
1208 
1209  has_alpha = macData->has_alpha;
1210  has_mask = macData->has_mask;
1211  uninit = false;
1212 
1213  const int x = rect.x();
1214  const int y = rect.y();
1215  char *dest = reinterpret_cast<char*>(pixels);
1216 
1217  // only copy data buffer if destination buffer exists (resize might have failed)
1218  if (dest) {
1219  const char *src = reinterpret_cast<const char*>(macData->pixels + x) + y * macData->bytesPerRow;
1220  for (int i = 0; i < h; ++i) {
1221  memcpy(dest, src, w * 4);
1222  dest += bytesPerRow;
1223  src += macData->bytesPerRow;
1224  }
1225 
1226  has_alpha = macData->has_alpha;
1227  has_mask = macData->has_mask;
1228  }
1229 }
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
PixelType pixelType() const
for(int ii=mo->methodOffset();ii< mo->methodCount();++ii)
void resize(int width, int height)
static const char * data(const QByteArray &arr)
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
void copy(const QPixmapData *data, const QRect &rect)
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
static QBitmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Returns a copy of the given image converted to a bitmap using the specified image conversion flags...
Definition: qbitmap.cpp:281
QImage toImage() const
quint32 * pixels

◆ createCompatiblePixmapData()

QPixmapData * QMacPixmapData::createCompatiblePixmapData ( ) const
virtual

Reimplemented from QPixmapData.

Definition at line 181 of file qpixmap_mac.cpp.

182 {
183  return new QMacPixmapData(pixelType());
184 }
PixelType pixelType() const
QMacPixmapData(PixelType type)

◆ fill()

void QMacPixmapData::fill ( const QColor color)
virtual

Implements QPixmapData.

Definition at line 420 of file qpixmap_mac.cpp.

Referenced by setMask().

422 {
423  { //we don't know what backend to use so we cannot paint here
424  quint32 *dptr = pixels;
425  Q_ASSERT_X(dptr, "QPixmap::fill", "No dptr");
426  const quint32 colr = PREMUL(fillColor.rgba());
427  const int nbytes = bytesPerRow * h;
428  if (!colr) {
429  memset(dptr, 0, nbytes);
430  } else {
431  for (uint i = 0; i < nbytes / sizeof(quint32); ++i)
432  *(dptr + i) = colr;
433  }
434  }
435 
436  // If we had an alpha channel from before, don't
437  // switch it off. Only go from no alpha to alpha:
438  if (fillColor.alpha() != 255)
439  macSetHasAlpha(true);
440 }
void macSetHasAlpha(bool b)
Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x)
unsigned int uint
Definition: qglobal.h:996
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
unsigned int quint32
Definition: qglobal.h:938
quint32 * pixels

◆ fromImage()

void QMacPixmapData::fromImage ( const QImage image,
Qt::ImageConversionFlags  flags 
)
virtual

Implements QPixmapData.

Definition at line 222 of file qpixmap_mac.cpp.

224 {
226 
227  // the conversion code only handles format >=
228  // Format_ARGB32_Premultiplied at the moment..
229  if (img.format() > QImage::Format_ARGB32_Premultiplied) {
230  QImage image;
231  if (img.hasAlphaChannel())
233  else
235  fromImage(image, flags);
236  return;
237  }
238 
239  w = img.width();
240  h = img.height();
241  is_null = (w <= 0 || h <= 0);
242  d = (pixelType() == BitmapType ? 1 : img.depth());
243 
244  QImage image = img;
245  int dd = QPixmap::defaultDepth();
246  bool force_mono = (dd == 1 ||
247  (flags & Qt::ColorMode_Mask)==Qt::MonoOnly);
248  if (force_mono) { // must be monochrome
249  if (d != 1) {
250  image = image.convertToFormat(QImage::Format_MonoLSB, flags); // dither
251  d = 1;
252  }
253  } else { // can be both
254  bool conv8 = false;
255  if(d > 8 && dd <= 8) { // convert to 8 bit
256  if ((flags & Qt::DitherMode_Mask) == Qt::AutoDither)
257  flags = (flags & ~Qt::DitherMode_Mask)
259  conv8 = true;
260  } else if ((flags & Qt::ColorMode_Mask) == Qt::ColorOnly) {
261  conv8 = d == 1; // native depth wanted
262  } else if (d == 1) {
263  if (image.colorCount() == 2) {
264  QRgb c0 = image.color(0); // Auto: convert to best
265  QRgb c1 = image.color(1);
266  conv8 = qMin(c0,c1) != qRgb(0,0,0) || qMax(c0,c1) != qRgb(255,255,255);
267  } else {
268  // eg. 1-color monochrome images (they do exist).
269  conv8 = true;
270  }
271  }
272  if (conv8) {
273  image = image.convertToFormat(QImage::Format_Indexed8, flags);
274  d = 8;
275  }
276  }
277 
278  if (image.depth()==1) {
279  image.setColor(0, QColor(Qt::color0).rgba());
280  image.setColor(1, QColor(Qt::color1).rgba());
281  }
282 
283  if (d == 16 || d == 24) {
284  image = image.convertToFormat(QImage::Format_RGB32, flags);
285  fromImage(image, flags);
286  return;
287  }
288 
289  // different size or depth, make a new pixmap
290  resize(w, h);
291 
292  // exit if resize failed
293  if (is_null)
294  return;
295 
296  quint32 *dptr = pixels, *drow;
297  const uint dbpr = bytesPerRow;
298 
299  const QImage::Format sfmt = image.format();
300  const unsigned short sbpr = image.bytesPerLine();
301 
302  // use const_cast to prevent a detach
303  const uchar *sptr = const_cast<const QImage &>(image).bits(), *srow;
304 
305  for (int y = 0; y < h; ++y) {
306  drow = dptr + (y * (dbpr / 4));
307  srow = sptr + (y * sbpr);
308  switch(sfmt) {
310  case QImage::Format_Mono:{
311  for (int x = 0; x < w; ++x) {
312  char one_bit = *(srow + (x / 8));
313  if (sfmt == QImage::Format_Mono)
314  one_bit = one_bit >> (7 - (x % 8));
315  else
316  one_bit = one_bit >> (x % 8);
317  if ((one_bit & 0x01))
318  *(drow+x) = 0xFF000000;
319  else
320  *(drow+x) = 0xFFFFFFFF;
321  }
322  break;
323  }
325  int numColors = image.numColors();
326  if (numColors > 0) {
327  for (int x = 0; x < w; ++x) {
328  int index = *(srow + x);
329  *(drow+x) = PREMUL(image.color(qMin(index, numColors)));
330  }
331  }
332  } break;
334  for (int x = 0; x < w; ++x)
335  *(drow+x) = *(((quint32*)srow) + x) | 0xFF000000;
336  break;
339  for (int x = 0; x < w; ++x) {
340  if(sfmt == QImage::Format_RGB32)
341  *(drow+x) = 0xFF000000 | (*(((quint32*)srow) + x) & 0x00FFFFFF);
342  else if(sfmt == QImage::Format_ARGB32_Premultiplied)
343  *(drow+x) = *(((quint32*)srow) + x);
344  else
345  *(drow+x) = PREMUL(*(((quint32*)srow) + x));
346  }
347  break;
348  default:
349  qWarning("Qt: internal: Oops: Forgot a format [%d] %s:%d", sfmt,
350  __FILE__, __LINE__);
351  break;
352  }
353  }
354  if (sfmt != QImage::Format_RGB32) { //setup the alpha
355  bool alphamap = image.depth() == 32;
356  if (sfmt == QImage::Format_Indexed8) {
357  const QVector<QRgb> rgb = image.colorTable();
358  for (int i = 0, count = image.colorCount(); i < count; ++i) {
359  const int alpha = qAlpha(rgb[i]);
360  if (alpha != 0xff) {
361  alphamap = true;
362  break;
363  }
364  }
365  }
366  macSetHasAlpha(alphamap);
367  }
368  uninit = false;
369 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
Format
The following image formats are available in Qt.
Definition: qimage.h:91
static int defaultDepth()
Returns the default pixmap depth used by the application.
Definition: qpixmap.cpp:2092
unsigned int QRgb
Definition: qrgb.h:53
void setColor(int i, QRgb c)
Sets the color at the given index in the color table, to the given to colorValue. ...
Definition: qimage.cpp:1850
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb)
Definition: qrgb.h:66
void macSetHasAlpha(bool b)
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
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
PixelType pixelType() const
unsigned char uchar
Definition: qglobal.h:994
Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x)
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
void resize(int width, int height)
unsigned int uint
Definition: qglobal.h:996
QT_DEPRECATED int numColors() const
Returns the size of the color table for the image.
Definition: qimage.cpp:1636
int depth() const
Returns the depth of the image.
Definition: qimage.cpp:1620
#define rgb(r, g, b)
Definition: qcolor_p.cpp:130
static int qt_pixmap_serial
Definition: qpixmap_mac.cpp:73
QT_DEPRECATED int numColors() const
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
Returns a copy of the image in the given format.
Definition: qimage.cpp:3966
int colorCount() const
Returns the size of the color table for the image.
Definition: qimage.cpp:1656
Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)
Definition: qrgb.h:69
unsigned int quint32
Definition: qglobal.h:938
Definition: qnamespace.h:54
quint16 index
void setSerialNumber(int serNo)
quint32 * pixels
QVector< QRgb > colorTable() const
Returns a list of the colors contained in the image&#39;s color table, or an empty list if the image does...
Definition: qimage.cpp:1770
QRgb color(int i) const
Returns the color in the color table at index i.
Definition: qimage.cpp:1829
void fromImage(const QImage &image, Qt::ImageConversionFlags flags)

◆ hasAlphaChannel()

bool QMacPixmapData::hasAlphaChannel ( ) const
virtual

Implements QPixmapData.

Definition at line 1072 of file qpixmap_mac.cpp.

1073 {
1074  return has_alpha;
1075 }

◆ macCreateCGImageRef()

void QMacPixmapData::macCreateCGImageRef ( )
private

Definition at line 614 of file qpixmap_mac.cpp.

Referenced by QPixmap::grabWindow().

615 {
616  Q_ASSERT(cg_data == 0);
617  //create the cg data
619  QCFType<CGDataProviderRef> provider = CGDataProviderCreateWithData(this,
620  pixels, bytesPerRow * h,
623  uint cgflags = kCGImageAlphaPremultipliedFirst;
624 #ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
625  cgflags |= kCGBitmapByteOrder32Host;
626 #endif
627  cg_data = CGImageCreate(w, h, 8, 32, bytesPerRow, colorspace,
628  cgflags, provider, 0, 0, kCGRenderingIntentDefault);
629 }
static CGColorSpaceRef macDisplayColorSpace(const QWidget *widget=0)
friend void qt_mac_cgimage_data_free(void *, const void *, size_t)
Definition: qpixmap_mac.cpp:91
CGImageRef cg_data
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
const_iterator insert(const T &value)
Definition: qset.h:179
unsigned int uint
Definition: qglobal.h:996
struct CGColorSpace * CGColorSpaceRef
quint32 * pixels
static QSet< QMacPixmapData * > validDataPointers

◆ macCreatePixels()

void QMacPixmapData::macCreatePixels ( )
private

Definition at line 650 of file qpixmap_mac.cpp.

Referenced by macReleaseCGImageRef(), and resize().

651 {
652  int numBytes = bytesPerRow * h;
653  quint32 *base_pixels;
654  if (pixelsToFree && pixelsToFree != pixels) {
655  // Reuse unused block of memory lying around from a previous callback.
656  base_pixels = pixelsToFree;
657  pixelsToFree = 0;
658  } else {
659  // We need a block of memory to do stuff with.
660  base_pixels = static_cast<quint32 *>(malloc(numBytes));
661  if (!base_pixels) {
662  qWarning("Failed to allocate memory for pixmap data, setting to NULL");
663  numBytes = 0;
664  w = 0;
665  h = 0;
666  is_null = 0;
667  bytesPerRow=0;
668  }
669  }
670 
671  // only copy when both buffers exist
672  if (pixels && base_pixels)
673  memcpy(base_pixels, pixels, qMin(pixelsSize, (uint) numBytes));
674 
675  // free pixels before assigning new memory
676  if (pixels)
677  free(pixels);
678 
679  pixels = base_pixels;
680  pixelsSize = numBytes;
681 }
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Q_CORE_EXPORT void qWarning(const char *,...)
unsigned int uint
Definition: qglobal.h:996
unsigned int quint32
Definition: qglobal.h:938
quint32 * pixelsToFree
quint32 * pixels

◆ macGetAlphaChannel()

void QMacPixmapData::macGetAlphaChannel ( QMacPixmapData pix,
bool  asMask 
) const
private

Definition at line 583 of file qpixmap_mac.cpp.

Referenced by alphaChannel(), and mask().

584 {
585  quint32 *dptr = pix->pixels, *drow;
586  const uint dbpr = pix->bytesPerRow;
587  const unsigned short sbpr = bytesPerRow;
588  quint32 *sptr = pixels, *srow;
589  for(int y=0; y < h; ++y) {
590  drow = dptr + (y * (dbpr/4));
591  srow = sptr + (y * (sbpr/4));
592  if(asMask) {
593  for (int x = 0; x < w; ++x) {
594  if (*(srow + x) & qRgba(0, 0, 0, 255))
595  *(drow + x) = 0x00000000;
596  else
597  *(drow + x) = 0xFFFFFFFF;
598  }
599  } else {
600  for (int x = 0; x < w; ++x) {
601  const int alpha = qAlpha(*(srow + x));
602  *(drow + x) = qRgb(alpha, alpha, alpha);
603  }
604  }
605  }
606 }
Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb)
Definition: qrgb.h:66
Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)
Definition: qrgb.h:72
unsigned int uint
Definition: qglobal.h:996
Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)
Definition: qrgb.h:69
unsigned int quint32
Definition: qglobal.h:938
quint32 * pixels

◆ macReleaseCGImageRef()

void QMacPixmapData::macReleaseCGImageRef ( )
private

Definition at line 631 of file qpixmap_mac.cpp.

Referenced by macSetHasAlpha().

632 {
633  if (!cg_data)
634  return; // There's nothing we need to do
635 
637  CGImageRelease(cg_data);
638  cg_data = 0;
639 
640  if (pixels != pixelsToFree) {
641  macCreatePixels();
642  } else {
643  pixelsToFree = 0;
644  }
645 }
void macCreatePixels()
CGImageRef cg_data
quint32 * pixelsToFree
quint32 * pixels
CGImageRef cg_dataBeingReleased

◆ macSetAlphaChannel()

void QMacPixmapData::macSetAlphaChannel ( const QMacPixmapData pix,
bool  asMask 
)
private

Definition at line 537 of file qpixmap_mac.cpp.

Referenced by setAlphaChannel(), and setMask().

538 {
539  if (!pixels || !h || !w || pix->w != w || pix->h != h)
540  return;
541 
542  quint32 *dptr = pixels, *drow;
543  const uint dbpr = bytesPerRow;
544  const unsigned short sbpr = pix->bytesPerRow;
545  quint32 *sptr = pix->pixels, *srow;
546  for (int y=0; y < h; ++y) {
547  drow = dptr + (y * (dbpr/4));
548  srow = sptr + (y * (sbpr/4));
549  if(d == 1) {
550  for (int x=0; x < w; ++x) {
551  if((*(srow+x) & RGB_MASK))
552  *(drow+x) = 0xFFFFFFFF;
553  }
554  } else if(d == 8) {
555  for (int x=0; x < w; ++x)
556  *(drow+x) = (*(drow+x) & RGB_MASK) | (*(srow+x) << 24);
557  } else if(asMask) {
558  for (int x=0; x < w; ++x) {
559  if(*(srow+x) & RGB_MASK)
560  *(drow+x) = (*(drow+x) & RGB_MASK);
561  else
562  *(drow+x) = (*(drow+x) & RGB_MASK) | 0xFF000000;
563  *(drow+x) = PREMUL(*(drow+x));
564  }
565  } else {
566  for (int x=0; x < w; ++x) {
567  const uchar alpha = qGray(qRed(*(srow+x)), qGreen(*(srow+x)), qBlue(*(srow+x)));
568  const uchar destAlpha = qt_div_255(alpha * qAlpha(*(drow+x)));
569 #if 1
570  *(drow+x) = (*(drow+x) & RGB_MASK) | (destAlpha << 24);
571 #else
572  *(drow+x) = qRgba(qt_div_255(qRed(*(drow+x) * alpha)),
573  qt_div_255(qGreen(*(drow+x) * alpha)),
574  qt_div_255(qBlue(*(drow+x) * alpha)), destAlpha);
575 #endif
576  *(drow+x) = PREMUL(*(drow+x));
577  }
578  }
579  }
580  macSetHasAlpha(true);
581 }
Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb)
Definition: qrgb.h:66
void macSetHasAlpha(bool b)
Q_GUI_EXPORT_INLINE int qRed(QRgb rgb)
Definition: qrgb.h:57
unsigned char uchar
Definition: qglobal.h:994
const QRgb RGB_MASK
Definition: qrgb.h:55
Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)
Definition: qrgb.h:72
Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x)
unsigned int uint
Definition: qglobal.h:996
Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb)
Definition: qrgb.h:63
Q_GUI_EXPORT_INLINE int qGray(int r, int g, int b)
Definition: qrgb.h:75
unsigned int quint32
Definition: qglobal.h:938
Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb)
Definition: qrgb.h:60
Q_STATIC_INLINE_FUNCTION int qt_div_255(int x)
quint32 * pixels

◆ macSetHasAlpha()

void QMacPixmapData::macSetHasAlpha ( bool  b)
private

Definition at line 608 of file qpixmap_mac.cpp.

Referenced by fill(), fromImage(), macCreatePixels(), and macSetAlphaChannel().

609 {
610  has_alpha = b;
612 }
void macReleaseCGImageRef()

◆ mask()

QBitmap QMacPixmapData::mask ( ) const
virtual

Reimplemented from QPixmapData.

Definition at line 460 of file qpixmap_mac.cpp.

Referenced by qt_mac_create_iconref(), and qt_mac_create_imagemask().

461 {
462  if (!has_mask && !has_alpha)
463  return QBitmap();
464 
466  mask->resize(w, h);
467  macGetAlphaChannel(mask, true);
468  return QPixmap(mask);
469 }
QBitmap mask() const
The QBitmap class provides monochrome (1-bit depth) pixmaps.
Definition: qbitmap.h:55
QMacPixmapData(PixelType type)
void resize(int width, int height)
void macGetAlphaChannel(QMacPixmapData *, bool asMask) const
friend class QPixmap

◆ metric()

int QMacPixmapData::metric ( QPaintDevice::PaintDeviceMetric  metric) const
virtual

Implements QPixmapData.

Definition at line 488 of file qpixmap_mac.cpp.

489 {
490  switch (theMetric) {
492  return w;
494  return h;
500  return 1 << d;
503  extern float qt_mac_defaultDpi_x(); //qpaintdevice_mac.cpp
504  return int(qt_mac_defaultDpi_x());
505  }
508  extern float qt_mac_defaultDpi_y(); //qpaintdevice_mac.cpp
509  return int(qt_mac_defaultDpi_y());
510  }
512  return d;
513  default:
514  qWarning("QPixmap::metric: Invalid metric command");
515  }
516  return 0;
517 }
double qreal
Definition: qglobal.h:1193
float qt_mac_defaultDpi_y()
Q_CORE_EXPORT void qWarning(const char *,...)
float qt_mac_defaultDpi_x()
int metric(QPaintDevice::PaintDeviceMetric metric) const
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ paintEngine()

QPaintEngine * QMacPixmapData::paintEngine ( ) const
virtual
Warning
This function is not part of the public interface.

Implements QPixmapData.

Definition at line 1189 of file qpixmap_mac.cpp.

1190 {
1191  if (!pengine) {
1192  QMacPixmapData *that = const_cast<QMacPixmapData*>(this);
1193  that->pengine = new QCoreGraphicsPaintEngine();
1194  }
1195  return pengine;
1196 }
friend class QCoreGraphicsPaintEngine
QPaintEngine * pengine

◆ resize()

void QMacPixmapData::resize ( int  width,
int  height 
)
virtual

Implements QPixmapData.

Definition at line 190 of file qpixmap_mac.cpp.

Referenced by alphaChannel(), copy(), fromImage(), mask(), and setMask().

191 {
193 
194  w = width;
195  h = height;
196  is_null = (w <= 0 || h <= 0);
197  d = (pixelType() == BitmapType ? 1 : 32);
198  bool make_null = w <= 0 || h <= 0; // create null pixmap
199  if (make_null || d == 0) {
200  w = 0;
201  h = 0;
202  is_null = true;
203  d = 0;
204  if (!make_null)
205  qWarning("Qt: QPixmap: Invalid pixmap parameters");
206  return;
207  }
208 
209  if (w < 1 || h < 1)
210  return;
211 
212  //create the pixels
213  bytesPerRow = w * sizeof(quint32); // Minimum bytes per row.
214 
215  // Quartz2D likes things as a multple of 16 (for now).
217  macCreatePixels();
218 }
void macCreatePixels()
int width() const
PixelType pixelType() const
Q_CORE_EXPORT void qWarning(const char *,...)
static int qt_pixmap_serial
Definition: qpixmap_mac.cpp:73
#define COMPTUE_BEST_BYTES_PER_ROW(bpr)
unsigned int quint32
Definition: qglobal.h:938
int height() const
void setSerialNumber(int serNo)

◆ scroll()

bool QMacPixmapData::scroll ( int  dx,
int  dy,
const QRect rect 
)
virtual

Reimplemented from QPixmapData.

Definition at line 1231 of file qpixmap_mac.cpp.

1232 {
1233  Q_UNUSED(dx);
1234  Q_UNUSED(dy);
1235  Q_UNUSED(rect);
1236  return false;
1237 }
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAlphaChannel()

void QMacPixmapData::setAlphaChannel ( const QPixmap alphaChannel)
virtual

Reimplemented from QPixmapData.

Definition at line 453 of file qpixmap_mac.cpp.

454 {
455  has_mask = true;
456  QMacPixmapData *alphaData = static_cast<QMacPixmapData*>(alpha.data.data());
457  macSetAlphaChannel(alphaData, false);
458 }
void macSetAlphaChannel(const QMacPixmapData *, bool asMask)

◆ setMask()

void QMacPixmapData::setMask ( const QBitmap mask)
virtual

Reimplemented from QPixmapData.

Definition at line 471 of file qpixmap_mac.cpp.

472 {
473  if (mask.isNull()) {
474  QMacPixmapData opaque(PixmapType);
475  opaque.resize(w, h);
476  opaque.fill(QColor(255, 255, 255, 255));
477  macSetAlphaChannel(&opaque, true);
478  has_alpha = has_mask = false;
479  return;
480  }
481 
482  has_alpha = false;
483  has_mask = true;
484  QMacPixmapData *maskData = static_cast<QMacPixmapData*>(mask.data.data());
485  macSetAlphaChannel(maskData, true);
486 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
void macSetAlphaChannel(const QMacPixmapData *, bool asMask)
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition: qpixmap.cpp:615

◆ toImage()

QImage QMacPixmapData::toImage ( ) const
virtual

Implements QPixmapData.

Definition at line 383 of file qpixmap_mac.cpp.

Referenced by copy().

384 {
386  if (d != 1) //Doesn't support index color modes
389 
390  QImage image(w, h, format);
391  // exit if image was not created (out of memory)
392  if (image.isNull())
393  return image;
394  quint32 *sptr = pixels, *srow;
395  const uint sbpr = bytesPerRow;
396  if (format == QImage::Format_MonoLSB) {
397  image.fill(0);
398  image.setColorCount(2);
399  image.setColor(0, QColor(Qt::color0).rgba());
400  image.setColor(1, QColor(Qt::color1).rgba());
401  for (int y = 0; y < h; ++y) {
402  uchar *scanLine = image.scanLine(y);
403  srow = sptr + (y * (sbpr/4));
404  for (int x = 0; x < w; ++x) {
405  if (!(*(srow + x) & RGB_MASK))
406  scanLine[x >> 3] |= (1 << (x & 7));
407  }
408  }
409  } else {
410  for (int y = 0; y < h; ++y) {
411  srow = sptr + (y * (sbpr / 4));
412  memcpy(image.scanLine(y), srow, w * 4);
413  }
414 
415  }
416 
417  return image;
418 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
Format
The following image formats are available in Qt.
Definition: qimage.h:91
unsigned char uchar
Definition: qglobal.h:994
const QRgb RGB_MASK
Definition: qrgb.h:55
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
unsigned int uint
Definition: qglobal.h:996
unsigned int quint32
Definition: qglobal.h:938
quint32 * pixels

Friends and Related Functions

◆ qcolorForThemeTextColor

QColor qcolorForThemeTextColor ( ThemeTextColor  themeColor)
friend

Definition at line 128 of file qt_mac.cpp.

129 {
130 #ifdef Q_OS_MAC32
131  RGBColor c;
132  GetThemeTextColor(themeColor, 32, true, &c);
133  QColor color = QColor(c.red / 256, c.green / 256, c.blue / 256);
134  return color;
135 #else
136  // There is no equivalent to GetThemeTextColor in 64-bit and it was rather bad that
137  // I didn't file a request to implement this for Snow Leopard. So, in the meantime
138  // I've encoded the values from the GetThemeTextColor. This is not exactly ideal
139  // as if someone really wants to mess with themeing, these colors will be wrong.
140  // It also means that we need to make sure the values for differences between
141  // OS releases (and it will be likely that we are a step behind.)
142  switch (themeColor) {
143  case kThemeTextColorAlertActive:
144  case kThemeTextColorTabFrontActive:
145  case kThemeTextColorBevelButtonActive:
146  case kThemeTextColorListView:
147  case kThemeTextColorPlacardActive:
148  case kThemeTextColorPopupButtonActive:
149  case kThemeTextColorPopupLabelActive:
150  case kThemeTextColorPushButtonActive:
151  return Qt::black;
152  case kThemeTextColorAlertInactive:
153  case kThemeTextColorDialogInactive:
154  case kThemeTextColorPlacardInactive:
155  return QColor(69, 69, 69, 255);
156  case kThemeTextColorPopupButtonInactive:
157  case kThemeTextColorPopupLabelInactive:
158  case kThemeTextColorPushButtonInactive:
159  case kThemeTextColorTabFrontInactive:
160  case kThemeTextColorBevelButtonInactive:
161  return QColor(127, 127, 127, 255);
162  default: {
163  QNativeImage nativeImage(16,16, QNativeImage::systemFormat());
164  CGRect cgrect = CGRectMake(0, 0, 16, 16);
165  HIThemeSetTextFill(themeColor, 0, nativeImage.cg, kHIThemeOrientationNormal);
166  CGContextFillRect(nativeImage.cg, cgrect);
167  QColor color = nativeImage.image.pixel(0,0);
168  return QColor(nativeImage.image.pixel(0 , 0));
169  }
170  }
171 #endif
172 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
unsigned char c[8]
Definition: qnumeric_p.h:62
static QImage::Format systemFormat()
struct CGRect CGRect

◆ QCoreGraphicsPaintEngine

Definition at line 122 of file qpixmap_mac_p.h.

Referenced by paintEngine().

◆ QPixmap

friend class QPixmap
friend

◆ QRasterBuffer

friend class QRasterBuffer
friend

Definition at line 120 of file qpixmap_mac_p.h.

◆ QRasterPaintEngine

friend class QRasterPaintEngine
friend

Definition at line 121 of file qpixmap_mac_p.h.

◆ qt_mac_cg_context

CGContextRef qt_mac_cg_context ( const QPaintDevice )
friend

Returns the CoreGraphics CGContextRef of the paint device.

Warning
This function is not part of the public interface.

0 is returned if it can't be obtained. It is the caller's responsiblity to CGContextRelease the context when finished using it.

Warning
This function is only available on Mac OS X.

Definition at line 118 of file qpaintdevice_mac.cpp.

Referenced by QPixmap::fromMacCGImageRef().

119 {
120  if (pdev->devType() == QInternal::Pixmap) {
121  const QPixmap *pm = static_cast<const QPixmap*>(pdev);
123  uint flags = kCGImageAlphaPremultipliedFirst;
124 #ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
125  flags |= kCGBitmapByteOrder32Host;
126 #endif
127  CGContextRef ret = 0;
128 
129  // It would make sense to put this into a mac #ifdef'ed
130  // virtual function in the QPixmapData at some point
131  if (pm->data->classId() == QPixmapData::MacClass) {
132  const QMacPixmapData *pmData = static_cast<const QMacPixmapData*>(pm->data.data());
133  ret = CGBitmapContextCreate(pmData->pixels, pmData->w, pmData->h,
134  8, pmData->bytesPerRow, colorspace,
135  flags);
136  if(!ret)
137  qWarning("QPaintDevice: Unable to create context for pixmap (%d/%d/%d)",
138  pmData->w, pmData->h, (pmData->bytesPerRow * pmData->h));
139  } else if (pm->data->classId() == QPixmapData::RasterClass) {
140  QImage *image = pm->data->buffer();
141  ret = CGBitmapContextCreate(image->bits(), image->width(), image->height(),
142  8, image->bytesPerLine(), colorspace, flags);
143  }
144 
145  CGContextTranslateCTM(ret, 0, pm->height());
146  CGContextScaleCTM(ret, 1, -1);
147  return ret;
148  } else if (pdev->devType() == QInternal::Widget) {
149  CGContextRef ret = static_cast<CGContextRef>(static_cast<const QWidget *>(pdev)->macCGHandle());
150  CGContextRetain(ret);
151  return ret;
152  } else if (pdev->devType() == QInternal::MacQuartz) {
153  return static_cast<const QMacQuartzPaintDevice *>(pdev)->cgContext();
154  }
155  return 0;
156 }
QExplicitlySharedDataPointer< QPixmapData > data
Definition: qpixmap.h:252
CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *pdev)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int bytesPerLine() const
Returns the number of bytes per image scanline.
Definition: qimage.cpp:1812
virtual int devType() const
Definition: qpaintdevice.h:167
T * data() const
Returns a pointer to the shared data object.
Definition: qshareddata.h:145
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
unsigned int uint
Definition: qglobal.h:996
ClassId classId() const
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
struct CGColorSpace * CGColorSpaceRef
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
virtual QImage * buffer()
int height() const
Returns the height of the pixmap.
Definition: qpixmap.cpp:645
struct CGContext * CGContextRef
quint32 * pixels

◆ qt_mac_cgimage_data_free

void qt_mac_cgimage_data_free ( void *  info,
const void *  memoryToFree,
size_t   
)
friend

Definition at line 91 of file qpixmap_mac.cpp.

Referenced by macCreateCGImageRef(), and qt_mac_create_imagemask().

92 {
93  QMacPixmapData *pmdata = static_cast<QMacPixmapData *>(info);
94  if (!pmdata) {
95  free(const_cast<void *>(memoryToFree));
96  } else {
97  if (QMacPixmapData::validDataPointers.contains(pmdata) == false) {
98  free(const_cast<void *>(memoryToFree));
99  // mark data as freed
100  if (pmdata->pixels == memoryToFree)
101  pmdata->pixels = 0;
102  if (pmdata->pixelsToFree == memoryToFree)
103  pmdata->pixelsToFree = 0;
104  return;
105  }
106  if (pmdata->pixels == pmdata->pixelsToFree) {
107  // something we aren't expecting, just free it.
108  Q_ASSERT(memoryToFree != pmdata->pixelsToFree);
109  free(const_cast<void *>(memoryToFree));
110  } else {
111  free(pmdata->pixelsToFree);
112  pmdata->pixelsToFree = static_cast<quint32 *>(const_cast<void *>(memoryToFree));
113  }
114  pmdata->cg_dataBeingReleased = 0;
115  }
116 }
static mach_timebase_info_data_t info
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
unsigned int quint32
Definition: qglobal.h:938
quint32 * pixelsToFree
quint32 * pixels
static QSet< QMacPixmapData * > validDataPointers
CGImageRef cg_dataBeingReleased

◆ qt_mac_create_iconref

IconRef qt_mac_create_iconref ( const QPixmap )
friend

Definition at line 1109 of file qpixmap_mac.cpp.

1110 {
1111  if (px.isNull())
1112  return 0;
1113 
1114  //create icon
1115  IconFamilyHandle iconFamily = reinterpret_cast<IconFamilyHandle>(NewHandle(0));
1116  //create data
1117  {
1118  struct {
1119  OSType mac_type;
1120  int width, height, depth;
1121  bool mask;
1122  } images[] = {
1123  { kThumbnail32BitData, 128, 128, 32, false },
1124  { kThumbnail8BitMask, 128, 128, 8, true },
1125  { 0, 0, 0, 0, false } //end marker
1126  };
1127  for(int i = 0; images[i].mac_type; i++) {
1128  //get QPixmap data
1129  QImage scaled_px = px.toImage().scaled(images[i].width, images[i].height);
1130 
1131  quint32 *sptr = (quint32 *) scaled_px.bits();
1132  quint32 *srow;
1133  uint sbpr = scaled_px.bytesPerLine();
1134 
1135  //get Handle data
1136  const int dbpr = images[i].width * (images[i].depth/8);
1137  Handle hdl = NewHandle(dbpr*images[i].height);
1138  if(!sptr) { //handle null pixmap
1139  memset((*hdl), '\0', dbpr*images[i].height);
1140  } else if(images[i].mask) {
1141  if(images[i].mac_type == kThumbnail8BitMask) {
1142  for(int y = 0, hindex = 0; y < images[i].height; ++y) {
1143  srow = sptr + (y * (sbpr/4));
1144  for(int x = 0; x < images[i].width; ++x)
1145  *((*hdl)+(hindex++)) = qAlpha(*(srow+x));
1146  }
1147  }
1148  } else {
1149  char *dest = (*hdl);
1150 #if defined(__i386__)
1151  if(images[i].depth == 32) {
1152  for(int y = 0; y < images[i].height; ++y) {
1153  uint *source = (uint*)((const uchar*)sptr+(sbpr*y));
1154  for(int x = 0; x < images[i].width; ++x, dest += 4)
1155  *((uint*)dest) = CFSwapInt32(*(source + x));
1156  }
1157  } else
1158 #endif
1159  {
1160  for(int y = 0; y < images[i].height; ++y)
1161  memcpy(dest+(y*dbpr), ((const uchar*)sptr+(sbpr*y)), dbpr);
1162  }
1163  }
1164 
1165  //set the family data to the Handle
1166  OSStatus set = SetIconFamilyData(iconFamily, images[i].mac_type, hdl);
1167  if(set != noErr)
1168  qWarning("%s: %d -- Unable to create icon data[%d]!! %ld",
1169  __FILE__, __LINE__, i, long(set));
1170  DisposeHandle(hdl);
1171  }
1172  }
1173 
1174  //acquire and cleanup
1175  IconRef ret;
1176  static int counter = 0;
1177  const OSType kQtCreator = 'CUTE';
1178  RegisterIconRefFromIconFamily(kQtCreator, (OSType)counter, iconFamily, &ret);
1179  AcquireIconRef(ret);
1180  UnregisterIconRef(kQtCreator, (OSType)counter);
1181  DisposeHandle(reinterpret_cast<Handle>(iconFamily));
1182  counter++;
1183  return ret;
1184 
1185 }
QImage toImage() const
Converts the pixmap to a QImage.
Definition: qpixmap.cpp:542
Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb)
Definition: qrgb.h:66
int width() const
QBitmap mask() const
int bytesPerLine() const
Returns the number of bytes per image scanline.
Definition: qimage.cpp:1812
unsigned char uchar
Definition: qglobal.h:994
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
unsigned int uint
Definition: qglobal.h:996
signed long OSStatus
uchar * bits()
Returns a pointer to the first pixel data.
Definition: qimage.cpp:1946
int depth() const
unsigned int quint32
Definition: qglobal.h:938
int height() const
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition: qpixmap.cpp:615
QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
Definition: qimage.h:232
struct OpaqueIconRef * IconRef

◆ qt_mac_create_imagemask

CGImageRef qt_mac_create_imagemask ( const QPixmap ,
const QRectF  
)
friend

Definition at line 1077 of file qpixmap_mac.cpp.

1078 {
1079  QMacPixmapData *px = static_cast<QMacPixmapData*>(pixmap.data.data());
1080  if (px->cg_mask) {
1081  if (px->cg_mask_rect == sr) {
1082  CGImageRetain(px->cg_mask); //reference for the caller
1083  return px->cg_mask;
1084  }
1085  CGImageRelease(px->cg_mask);
1086  px->cg_mask = 0;
1087  }
1088 
1089  const int sx = qRound(sr.x()), sy = qRound(sr.y()), sw = qRound(sr.width()), sh = qRound(sr.height());
1090  const int sbpr = px->bytesPerRow;
1091  const uint nbytes = sw * sh;
1092  // alpha is always 255 for bitmaps, ignore it in this case.
1093  const quint32 mask = px->depth() == 1 ? 0x00ffffff : 0xffffffff;
1094  quint8 *dptr = static_cast<quint8 *>(malloc(nbytes));
1095  quint32 *sptr = px->pixels, *srow;
1096  for(int y = sy, offset=0; y < sh; ++y) {
1097  srow = sptr + (y * (sbpr / 4));
1098  for(int x = sx; x < sw; ++x)
1099  *(dptr+(offset++)) = (*(srow+x) & mask) ? 255 : 0;
1100  }
1101  QCFType<CGDataProviderRef> provider = CGDataProviderCreateWithData(0, dptr, nbytes, qt_mac_cgimage_data_free);
1102  px->cg_mask = CGImageMaskCreate(sw, sh, 8, 8, nbytes / sh, provider, 0, 0);
1103  px->cg_mask_rect = sr;
1104  CGImageRetain(px->cg_mask); //reference for the caller
1105  return px->cg_mask;
1106 }
qreal y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:667
friend void qt_mac_cgimage_data_free(void *, const void *, size_t)
Definition: qpixmap_mac.cpp:91
QExplicitlySharedDataPointer< QPixmapData > data
Definition: qpixmap.h:252
QBitmap mask() const
unsigned char quint8
Definition: qglobal.h:934
CGImageRef cg_mask
T * data() const
Returns a pointer to the shared data object.
Definition: qshareddata.h:145
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
unsigned int uint
Definition: qglobal.h:996
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
int depth() const
qreal x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:664
unsigned int quint32
Definition: qglobal.h:938
quint32 * pixels
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ qt_mac_pixmap_get_base

quint32* qt_mac_pixmap_get_base ( const QPixmap )
friend

Definition at line 75 of file qpixmap_mac.cpp.

76 {
78  return reinterpret_cast<quint32 *>(static_cast<QRasterPixmapData*>(pix->data.data())->buffer()->bits());
79  else
80  return static_cast<QMacPixmapData*>(pix->data.data())->pixels;
81 }
QExplicitlySharedDataPointer< QPixmapData > data
Definition: qpixmap.h:252
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
T * data() const
Returns a pointer to the shared data object.
Definition: qshareddata.h:145
static QString graphics_system_name
uchar * bits()
Returns a pointer to the first pixel data.
Definition: qimage.cpp:1946
unsigned int quint32
Definition: qglobal.h:938
virtual QImage * buffer()
quint32 * pixels

◆ qt_mac_pixmap_get_bytes_per_line

int qt_mac_pixmap_get_bytes_per_line ( const QPixmap )
friend

Definition at line 83 of file qpixmap_mac.cpp.

84 {
86  return static_cast<QRasterPixmapData*>(pix->data.data())->buffer()->bytesPerLine();
87  else
88  return static_cast<QMacPixmapData*>(pix->data.data())->bytesPerRow;
89 }
QExplicitlySharedDataPointer< QPixmapData > data
Definition: qpixmap.h:252
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int bytesPerLine() const
Returns the number of bytes per image scanline.
Definition: qimage.cpp:1812
T * data() const
Returns a pointer to the shared data object.
Definition: qshareddata.h:145
static QString graphics_system_name
virtual QImage * buffer()

Properties

◆ bytesPerRow

uint QMacPixmapData::bytesPerRow
private

◆ cg_data

CGImageRef QMacPixmapData::cg_data
private

◆ cg_dataBeingReleased

CGImageRef QMacPixmapData::cg_dataBeingReleased
private

Definition at line 114 of file qpixmap_mac_p.h.

Referenced by macReleaseCGImageRef(), and qt_mac_cgimage_data_free().

◆ cg_mask

CGImageRef QMacPixmapData::cg_mask
private

Definition at line 114 of file qpixmap_mac_p.h.

Referenced by qt_mac_create_imagemask(), and ~QMacPixmapData().

◆ cg_mask_rect

QRectF QMacPixmapData::cg_mask_rect
private

Definition at line 113 of file qpixmap_mac_p.h.

Referenced by qt_mac_create_imagemask().

◆ has_alpha

uint QMacPixmapData::has_alpha
private

Definition at line 89 of file qpixmap_mac_p.h.

Referenced by alphaChannel(), copy(), hasAlphaChannel(), macSetHasAlpha(), mask(), setMask(), and toImage().

◆ has_mask

uint QMacPixmapData::has_mask
private

Definition at line 89 of file qpixmap_mac_p.h.

Referenced by copy(), mask(), setAlphaChannel(), and setMask().

◆ pengine

QPaintEngine* QMacPixmapData::pengine
private

Definition at line 117 of file qpixmap_mac_p.h.

Referenced by paintEngine(), and ~QMacPixmapData().

◆ pixels

quint32* QMacPixmapData::pixels
private

◆ pixelsSize

uint QMacPixmapData::pixelsSize
private

Definition at line 110 of file qpixmap_mac_p.h.

Referenced by macCreatePixels().

◆ pixelsToFree

quint32* QMacPixmapData::pixelsToFree
private

◆ uninit

uint QMacPixmapData::uninit
private

Definition at line 89 of file qpixmap_mac_p.h.

Referenced by copy(), QPixmap::depth(), and fromImage().

◆ validDataPointers

QSet< QMacPixmapData * > QMacPixmapData::validDataPointers
staticprivate

The documentation for this class was generated from the following files: