diff options
author | Marius Storm-Olsen <marius.storm-olsen@nokia.com> | 2009-11-06 09:36:38 (GMT) |
---|---|---|
committer | Marius Storm-Olsen <marius.storm-olsen@nokia.com> | 2009-11-06 15:10:02 (GMT) |
commit | 8d4f3c94411d21f0b7d851b56f951ad54d64340f (patch) | |
tree | fc84e1c710012c723e6b1806d1439976c00533e7 | |
parent | e53c26b52c890f242491e0dfed4201313d98f720 (diff) | |
download | Qt-8d4f3c94411d21f0b7d851b56f951ad54d64340f.zip Qt-8d4f3c94411d21f0b7d851b56f951ad54d64340f.tar.gz Qt-8d4f3c94411d21f0b7d851b56f951ad54d64340f.tar.bz2 |
API review: Rename numCols() -> colorCount()
The name numCols is ambiguous, as sometimes it's refering to the number
of columns, and sometimes the number of colors. It also does not match
the typical Qt naming convention *Count().
Reviewed-by: Tom Cooksey
Reviewed-by: Andreas Aardal Hanssen
-rw-r--r-- | src/gui/embedded/qscreen_qws.cpp | 14 | ||||
-rw-r--r-- | src/gui/embedded/qscreen_qws.h | 3 | ||||
-rw-r--r-- | src/gui/image/qpixmap.cpp | 7 | ||||
-rw-r--r-- | src/gui/image/qpixmap.h | 3 | ||||
-rw-r--r-- | src/gui/image/qpixmap_qws.cpp | 5 | ||||
-rw-r--r-- | src/gui/painting/qcolormap_qws.cpp | 2 |
6 files changed, 28 insertions, 6 deletions
diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp index 911a77e..0dbfd05 100644 --- a/src/gui/embedded/qscreen_qws.cpp +++ b/src/gui/embedded/qscreen_qws.cpp @@ -1385,7 +1385,7 @@ QImage::Format QScreenPrivate::preferredImageFormat() const QScreen provides several functions to retrieve information about the color palette: The clut() function returns a pointer to the - color lookup table (i.e. its color palette). Use the numCols() + color lookup table (i.e. its color palette). Use the colorCount() function to determine the number of entries in this table, and the alloc() function to retrieve the palette index of the color that is the closest match to a given RGB value. @@ -1998,12 +1998,20 @@ QImage::Format QScreenPrivate::preferredImageFormat() const i.e. in modes where only the palette indexes (and not the actual color values) are stored in memory. - \sa alloc(), depth(), numCols() + \sa alloc(), depth(), colorCount() */ /*! + \obsolete \fn int QScreen::numCols() + \sa colorCount() +*/ + +/*! + \since 4.6 + \fn int QScreen::colorCount() + Returns the number of entries in the screen's color lookup table (i.e. its color palette). A pointer to the color table can be retrieved using the clut() function. @@ -2103,7 +2111,7 @@ void QScreen::setPixelFormat(QImage::Format format) i.e. in modes where only the palette indexes (and not the actual color values) are stored in memory. - \sa clut(), numCols() + \sa clut(), colorCount() */ int QScreen::alloc(unsigned int r,unsigned int g,unsigned int b) diff --git a/src/gui/embedded/qscreen_qws.h b/src/gui/embedded/qscreen_qws.h index d20d709..b3246f9 100644 --- a/src/gui/embedded/qscreen_qws.h +++ b/src/gui/embedded/qscreen_qws.h @@ -243,7 +243,8 @@ public: int totalSize() const { return mapsize; } QRgb * clut() { return screenclut; } - int numCols() { return screencols; } + QT_DEPRECATED int numCols() { return screencols; } + int colorCount() { return screencols; } virtual QSize mapToDevice(const QSize &) const; virtual QSize mapFromDevice(const QSize &) const; diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index dfeea76..985a20b 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -2150,6 +2150,13 @@ QPixmapData* QPixmap::pixmapData() const */ /*! \fn int QPixmap::numCols() const + \obsolete + \internal + \sa colorCount() +*/ + +/*! \fn int QPixmap::colorCount() const + \since 4.6 \internal */ diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index d11bd03..d95b4ee 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -185,7 +185,8 @@ public: const uchar *qwsBits() const; int qwsBytesPerLine() const; QRgb *clut() const; - int numCols() const; + QT_DEPRECATED int numCols() const; + int colorCount() const; #elif defined(Q_WS_MAC) Qt::HANDLE macQDHandle() const; Qt::HANDLE macQDAlphaHandle() const; diff --git a/src/gui/image/qpixmap_qws.cpp b/src/gui/image/qpixmap_qws.cpp index 9a52f3f..69626ed 100644 --- a/src/gui/image/qpixmap_qws.cpp +++ b/src/gui/image/qpixmap_qws.cpp @@ -124,6 +124,11 @@ QRgb* QPixmap::clut() const int QPixmap::numCols() const { + return colorCount(); +} + +int QPixmap::colorCount() const +{ if (data && data->classId() == QPixmapData::RasterClass) { const QRasterPixmapData *d = static_cast<const QRasterPixmapData*>(data.data()); return d->image.colorCount(); diff --git a/src/gui/painting/qcolormap_qws.cpp b/src/gui/painting/qcolormap_qws.cpp index ce4cd09..bc97b08 100644 --- a/src/gui/painting/qcolormap_qws.cpp +++ b/src/gui/painting/qcolormap_qws.cpp @@ -170,7 +170,7 @@ const QColor QColormap::colorAt(uint pixel) const (pixel & green_mask) >> green_shift, (pixel & blue_mask)); } - Q_ASSERT_X(int(pixel) < qt_screen->numCols(), "QColormap::colorAt", "pixel out of bounds of palette"); + Q_ASSERT_X(int(pixel) < qt_screen->colorCount(), "QColormap::colorAt", "pixel out of bounds of palette"); return QColor(qt_screen->clut()[pixel]); } |