QPixelFormat: don't inherit it
Instead of abusing inheritance to provide convenience constructors, use simple inline constructor functions. The name got a lower-case q to indicate a free function. The usual fromXYZ() static methods were deemed not fitting in this case in the initial round of review, since they implied some kind of conversion while these functions are simply constructors of formsts, which contain no data. This also solves the problem that some of these ctors could have been called with just one argument and were therefore candidates for hidden QPixelFormat temporary injection. QPixelFormatRgb was renamed to qPixelFormatRgba to explain the third argument at the call site better. There seem to be no users of this class in qt5.git at this time. Change-Id: Ib4fe8ceb2d30744127b116a748724a3406400eb8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
184fd8aa6c
commit
2431bf1b20
|
|
@ -253,29 +253,18 @@ QT_BEGIN_NAMESPACE
|
|||
YUV type The default value is 0.
|
||||
*/
|
||||
|
||||
Q_STATIC_ASSERT(sizeof(QPixelFormatRgb) == sizeof(QPixelFormat));
|
||||
|
||||
/*!
|
||||
\class QPixelFormatRgb
|
||||
\inmodule QtGui
|
||||
\since 5.4
|
||||
\brief QPixelFormatRgb is a helper class for creating pixel formats with
|
||||
the rgb color model
|
||||
\fn QPixelFormat qPixelFormatRgba(uchar redSize,
|
||||
uchar greenSize,
|
||||
uchar blueSize,
|
||||
uchar alphaSize,
|
||||
QPixelFormat::AlphaUsage alphaUsage,
|
||||
QPixelFormat::AlphaPosition alphaPosition,
|
||||
QPixelFormat::AlphaPremultiplied premultiplied = QPixelFormat::NotPremultiplied,
|
||||
QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger)
|
||||
\relates QPixelFormat
|
||||
|
||||
The size of QPixelFormatRgb is guaranteed to be the size of QPixelFormat.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QPixelFormatRgb::QPixelFormatRgb(uchar redSize,
|
||||
uchar greenSize,
|
||||
uchar blueSize,
|
||||
uchar alphaSize,
|
||||
AlphaUsage alphaUsage,
|
||||
AlphaPosition alphaPosition,
|
||||
AlphaPremultiplied premultiplied = NotPremultiplied,
|
||||
TypeInterpretation typeInterpretation = UnsignedInteger)
|
||||
|
||||
Constructor making an RGB pixelformat. \a redSize \a greenSize \a
|
||||
Constructor function making an RGB pixelformat. \a redSize \a greenSize \a
|
||||
blueSize represent the size of each color channel. \a alphaSize describes
|
||||
the alpha channel size and its position is described with \a alphaPosition.
|
||||
\a alphaUsage is used to determine if the alpha channel is used or not.
|
||||
|
|
@ -284,79 +273,49 @@ Q_STATIC_ASSERT(sizeof(QPixelFormatRgb) == sizeof(QPixelFormat));
|
|||
bits combined. \a premultiplied \a typeInterpretation are
|
||||
accessible with accessors with the same name.
|
||||
|
||||
\sa TypeInterpretation
|
||||
*/
|
||||
|
||||
Q_STATIC_ASSERT(sizeof(QPixelFormatGrayscale) == sizeof(QPixelFormat));
|
||||
/*!
|
||||
\class QPixelFormatGrayscale
|
||||
\inmodule QtGui
|
||||
\since 5.4
|
||||
\brief QPixelFormatGrayscale is a helper class for creating pixel formats with
|
||||
the gray scale color model.
|
||||
|
||||
The size of QPixelFormatGrayscale is guaranteed to be the size of QPixelFormat.
|
||||
\sa QPixelFormat::TypeInterpretation
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QPixelFormatGrayscale::QPixelFormatGrayscale(uchar channelSize,
|
||||
TypeInterpretation typeInterpretation = UnsignedInteger)
|
||||
\fn QPixelFormat qPixelFormatGrayscale(uchar channelSize,
|
||||
QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger)
|
||||
\relates QPixelFormat
|
||||
|
||||
Constructor for creating a Grayscale format. Monochrome formats can be
|
||||
Constructor function for creating a Grayscale format. Monochrome formats can be
|
||||
described by passing 1 to \a channelSize. Its also possible to define very
|
||||
accurate greyscale formats using doubles to describe each pixel by passing 8
|
||||
as \a channelSize and FloatingPoint as \a typeInterpretation.
|
||||
|
||||
\sa TypeInterpretation
|
||||
*/
|
||||
|
||||
Q_STATIC_ASSERT(sizeof(QPixelFormatCmyk) == sizeof(QPixelFormat));
|
||||
/*!
|
||||
\class QPixelFormatCmyk
|
||||
\inmodule QtGui
|
||||
\since 5.4
|
||||
\brief QPixelFormatCmyk is a helper class for creating pixel formats with
|
||||
the CMYK color model
|
||||
|
||||
The size of QPixelFormatCmyk is guaranteed to be the size of QPixelFormat.
|
||||
\sa QPixelFormat::TypeInterpretation
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QPixelFormatCmyk::QPixelFormatCmyk(uchar channelSize,
|
||||
uchar alphaSize = 0,
|
||||
AlphaUsage alphaUsage = IgnoresAlpha,
|
||||
AlphaPosition alphaPosition = AtBeginning,
|
||||
TypeInterpretation typeInterpretation = UnsignedInteger)
|
||||
\fn QPixelFormat qPixelFormatCmyk(uchar channelSize,
|
||||
uchar alphaSize = 0,
|
||||
QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha,
|
||||
QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning,
|
||||
QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger)
|
||||
\relates QPixelFormat
|
||||
|
||||
Constructor for creating CMYK formats. The channel count will be 4 or
|
||||
Constructor function for creating CMYK formats. The channel count will be 4 or
|
||||
5 depending on if \a alphaSize is bigger than zero or not. The CMYK color
|
||||
channels will all be set to the value of \a channelSize.
|
||||
|
||||
\a alphaUsage \a alphaPosition and \a typeInterpretation are all accessible with
|
||||
the accessors with the same name.
|
||||
|
||||
\sa TypeInterpretation
|
||||
*/
|
||||
|
||||
Q_STATIC_ASSERT(sizeof(QPixelFormatHsl) == sizeof(QPixelFormat));
|
||||
/*!
|
||||
\class QPixelFormatHsl
|
||||
\inmodule QtGui
|
||||
\since 5.4
|
||||
\brief QPixelFormatHsl is a helper class for creating pixel formats with
|
||||
the HSL color model.
|
||||
|
||||
The size of QPixelFormatHsl is guaranteed to be the size of QPixelFormat.
|
||||
\sa QPixelFormat::TypeInterpretation
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QPixelFormatHsl::QPixelFormatHsl(uchar channelSize,
|
||||
uchar alphaSize = 0,
|
||||
AlphaUsage alphaUsage = IgnoresAlpha,
|
||||
AlphaPosition alphaPosition = AtBeginning,
|
||||
TypeInterpretation typeInterpretation = FloatingPoint)
|
||||
\fn QPixelFormat qPixelFormatHsl(uchar channelSize,
|
||||
uchar alphaSize = 0,
|
||||
QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha,
|
||||
QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning,
|
||||
QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::FloatingPoint)
|
||||
\relates QPixelFormat
|
||||
|
||||
Constructor for creating HSL formats. The channel count will be 3 or 4
|
||||
Constructor function for creating HSL formats. The channel count will be 3 or 4
|
||||
depending on if \a alphaSize is bigger than 0.
|
||||
|
||||
\a channelSize will set the hueSize saturationSize and lightnessSize to the same value.
|
||||
|
|
@ -365,25 +324,15 @@ Q_STATIC_ASSERT(sizeof(QPixelFormatHsl) == sizeof(QPixelFormat));
|
|||
the accessors with the same name.
|
||||
*/
|
||||
|
||||
Q_STATIC_ASSERT(sizeof(QPixelFormatHsv) == sizeof(QPixelFormat));
|
||||
/*!
|
||||
\class QPixelFormatHsv
|
||||
\inmodule QtGui
|
||||
\since 5.4
|
||||
\brief QPixelFormatHsv is a helper class for creating pixel formats with
|
||||
the HSV color model.
|
||||
\fn QPixelFormat qPixelFormatHsv(uchar channelSize,
|
||||
uchar alphaSize = 0,
|
||||
QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha,
|
||||
QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning,
|
||||
QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::FloatingPoint)
|
||||
\relates QPixelFormat
|
||||
|
||||
The size of QPixelFormatHsv is guaranteed to be the size of QPixelFormat.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QPixelFormatHsv::QPixelFormatHsv(uchar channelSize,
|
||||
uchar alphaSize = 0,
|
||||
AlphaUsage alphaUsage = IgnoresAlpha,
|
||||
AlphaPosition alphaPosition = AtBeginning,
|
||||
TypeInterpretation typeInterpretation = FloatingPoint)
|
||||
|
||||
Constructor for creating HSV formats. The channel count will be 3 or 4
|
||||
Constructor function for creating HSV formats. The channel count will be 3 or 4
|
||||
depending on if \a alphaSize is bigger than 0.
|
||||
|
||||
\a channelSize will set the hueSize saturationSize and brightnessSize to the same value.
|
||||
|
|
@ -392,27 +341,17 @@ Q_STATIC_ASSERT(sizeof(QPixelFormatHsv) == sizeof(QPixelFormat));
|
|||
the accessors with the same name.
|
||||
*/
|
||||
|
||||
Q_STATIC_ASSERT(sizeof(QPixelFormatYuv) == sizeof(QPixelFormat));
|
||||
/*!
|
||||
\class QPixelFormatYuv
|
||||
\inmodule QtGui
|
||||
\since 5.4
|
||||
\brief QPixelFormatYuv is a helper class for creating pixel formats with
|
||||
the YUV color model.
|
||||
\fn QPixelFormat qPixelFormatYuv(QPixelFormat::YUVLayout yuvLayout,
|
||||
uchar alphaSize = 0,
|
||||
QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha,
|
||||
QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning,
|
||||
QPixelFormat::AlphaPremultiplied premultiplied = QPixelFormat::NotPremultiplied,
|
||||
QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedByte,
|
||||
QPixelFormat::ByteOrder byteOrder = QPixelFormat::LittleEndian)
|
||||
\relates QPixelFormat
|
||||
|
||||
The size of QPixelFormatYuv is guaranteed to be the size of QPixelFormat.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QPixelFormatYuv::QPixelFormatYuv(YUVLayout yuvLayout,
|
||||
uchar alphaSize = 0,
|
||||
AlphaUsage alphaUsage = IgnoresAlpha,
|
||||
AlphaPosition alphaPosition = AtBeginning,
|
||||
AlphaPremultiplied premultiplied = NotPremultiplied,
|
||||
TypeInterpretation typeInterpretation = UnsignedByte,
|
||||
ByteOrder byteOrder = LittleEndian)
|
||||
|
||||
Constructor for creating a QPixelFormat describing a YUV format with
|
||||
Constructor function for creating a QPixelFormat describing a YUV format with
|
||||
\a yuvLayout. \a alphaSize describes the size of a potential alpha channel
|
||||
and is position is described with \a alphaPosition. The "first" "second" ..
|
||||
"fifth" channels are all set to 0. \a alphaUsage \a premultiplied \a
|
||||
|
|
|
|||
|
|
@ -230,60 +230,6 @@ private:
|
|||
Q_STATIC_ASSERT(sizeof(QPixelFormat) == sizeof(quint64));
|
||||
Q_DECLARE_TYPEINFO(QPixelFormat, Q_PRIMITIVE_TYPE);
|
||||
|
||||
class QPixelFormatRgb : public QPixelFormat
|
||||
{
|
||||
public:
|
||||
Q_DECL_CONSTEXPR
|
||||
inline QPixelFormatRgb(uchar redSize,
|
||||
uchar greenSize,
|
||||
uchar blueSize,
|
||||
uchar alphaSize,
|
||||
AlphaUsage alphaUsage,
|
||||
AlphaPosition alphaPosition,
|
||||
AlphaPremultiplied premultiplied = NotPremultiplied,
|
||||
TypeInterpretation typeInterpretation = UnsignedInteger) Q_DECL_NOTHROW;
|
||||
};
|
||||
|
||||
class QPixelFormatGrayscale : public QPixelFormat
|
||||
{
|
||||
public:
|
||||
Q_DECL_CONSTEXPR
|
||||
inline QPixelFormatGrayscale(uchar bufferSize,
|
||||
TypeInterpretation typeInterpretation = UnsignedInteger) Q_DECL_NOTHROW;
|
||||
};
|
||||
|
||||
class QPixelFormatCmyk : public QPixelFormat
|
||||
{
|
||||
public:
|
||||
Q_DECL_CONSTEXPR
|
||||
inline QPixelFormatCmyk(uchar channelSize,
|
||||
uchar alphaSize = 0,
|
||||
AlphaUsage alphaUsage = IgnoresAlpha,
|
||||
AlphaPosition alphaPosition = AtBeginning,
|
||||
TypeInterpretation typeInterpretation = UnsignedInteger) Q_DECL_NOTHROW;
|
||||
};
|
||||
|
||||
class QPixelFormatHsl : public QPixelFormat
|
||||
{
|
||||
public:
|
||||
Q_DECL_CONSTEXPR
|
||||
inline QPixelFormatHsl(uchar channelSize,
|
||||
uchar alphaSize = 0,
|
||||
AlphaUsage alphaUsage = IgnoresAlpha,
|
||||
AlphaPosition alphaPosition = AtBeginning,
|
||||
TypeInterpretation typeInterpretation = FloatingPoint) Q_DECL_NOTHROW;
|
||||
};
|
||||
|
||||
class QPixelFormatHsv : public QPixelFormat
|
||||
{
|
||||
public:
|
||||
Q_DECL_CONSTEXPR
|
||||
inline QPixelFormatHsv(uchar channelSize,
|
||||
uchar alphaSize = 0,
|
||||
AlphaUsage alphaUsage = IgnoresAlpha,
|
||||
AlphaPosition alphaPosition = AtBeginning,
|
||||
TypeInterpretation typeInterpretation = FloatingPoint) Q_DECL_NOTHROW;
|
||||
};
|
||||
|
||||
namespace QtPrivate {
|
||||
QPixelFormat Q_GUI_EXPORT QPixelFormat_createYUV(QPixelFormat::YUVLayout yuvLayout,
|
||||
|
|
@ -295,18 +241,6 @@ namespace QtPrivate {
|
|||
QPixelFormat::ByteOrder byteOrder);
|
||||
}
|
||||
|
||||
class QPixelFormatYuv : public QPixelFormat
|
||||
{
|
||||
public:
|
||||
inline QPixelFormatYuv(YUVLayout yuvLayout,
|
||||
uchar alphaSize = 0,
|
||||
AlphaUsage alphaUsage = IgnoresAlpha,
|
||||
AlphaPosition alphaPosition = AtBeginning,
|
||||
AlphaPremultiplied premultiplied = NotPremultiplied,
|
||||
TypeInterpretation typeInterpretation = UnsignedByte,
|
||||
ByteOrder byteOrder = LittleEndian);
|
||||
};
|
||||
|
||||
Q_DECL_CONSTEXPR
|
||||
QPixelFormat::QPixelFormat(ColorModel mdl,
|
||||
uchar firstSize,
|
||||
|
|
@ -338,117 +272,117 @@ QPixelFormat::QPixelFormat(ColorModel mdl,
|
|||
{
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR
|
||||
QPixelFormatRgb::QPixelFormatRgb(uchar red,
|
||||
uchar green,
|
||||
uchar blue,
|
||||
uchar alfa,
|
||||
AlphaUsage usage,
|
||||
AlphaPosition position,
|
||||
AlphaPremultiplied pmul,
|
||||
TypeInterpretation typeInt) Q_DECL_NOTHROW
|
||||
: QPixelFormat(RGB,
|
||||
red,
|
||||
green,
|
||||
blue,
|
||||
0,
|
||||
0,
|
||||
alfa,
|
||||
usage,
|
||||
position,
|
||||
pmul,
|
||||
typeInt)
|
||||
{ }
|
||||
Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatRgba(uchar red,
|
||||
uchar green,
|
||||
uchar blue,
|
||||
uchar alfa,
|
||||
QPixelFormat::AlphaUsage usage,
|
||||
QPixelFormat::AlphaPosition position,
|
||||
QPixelFormat::AlphaPremultiplied pmul=QPixelFormat::NotPremultiplied,
|
||||
QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) Q_DECL_NOTHROW
|
||||
{
|
||||
return QPixelFormat(QPixelFormat::RGB,
|
||||
red,
|
||||
green,
|
||||
blue,
|
||||
0,
|
||||
0,
|
||||
alfa,
|
||||
usage,
|
||||
position,
|
||||
pmul,
|
||||
typeInt);
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR
|
||||
QPixelFormatGrayscale::QPixelFormatGrayscale(uchar channelSize,
|
||||
TypeInterpretation typeInt) Q_DECL_NOTHROW
|
||||
: QPixelFormat(Grayscale,
|
||||
channelSize,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
IgnoresAlpha,
|
||||
AtBeginning,
|
||||
NotPremultiplied,
|
||||
typeInt)
|
||||
{ }
|
||||
Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatGrayscale(uchar channelSize,
|
||||
QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) Q_DECL_NOTHROW
|
||||
{
|
||||
return QPixelFormat(QPixelFormat::Grayscale,
|
||||
channelSize,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
QPixelFormat::IgnoresAlpha,
|
||||
QPixelFormat::AtBeginning,
|
||||
QPixelFormat::NotPremultiplied,
|
||||
typeInt);
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR
|
||||
QPixelFormatCmyk::QPixelFormatCmyk(uchar channelSize,
|
||||
uchar alfa,
|
||||
AlphaUsage usage,
|
||||
AlphaPosition position,
|
||||
TypeInterpretation typeInt) Q_DECL_NOTHROW
|
||||
: QPixelFormat(CMYK,
|
||||
channelSize,
|
||||
channelSize,
|
||||
channelSize,
|
||||
channelSize,
|
||||
0,
|
||||
alfa,
|
||||
usage,
|
||||
position,
|
||||
NotPremultiplied,
|
||||
typeInt)
|
||||
{ }
|
||||
Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatCmyk(uchar channelSize,
|
||||
uchar alfa=0,
|
||||
QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
|
||||
QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
|
||||
QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedInteger) Q_DECL_NOTHROW
|
||||
{
|
||||
return QPixelFormat(QPixelFormat::CMYK,
|
||||
channelSize,
|
||||
channelSize,
|
||||
channelSize,
|
||||
channelSize,
|
||||
0,
|
||||
alfa,
|
||||
usage,
|
||||
position,
|
||||
QPixelFormat::NotPremultiplied,
|
||||
typeInt);
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR
|
||||
QPixelFormatHsl::QPixelFormatHsl(uchar channelSize,
|
||||
uchar alfa,
|
||||
AlphaUsage usage,
|
||||
AlphaPosition position,
|
||||
TypeInterpretation typeInt) Q_DECL_NOTHROW
|
||||
: QPixelFormat(HSL,
|
||||
channelSize,
|
||||
channelSize,
|
||||
channelSize,
|
||||
0,
|
||||
0,
|
||||
alfa,
|
||||
usage,
|
||||
position,
|
||||
NotPremultiplied,
|
||||
typeInt)
|
||||
{ }
|
||||
Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatHsl(uchar channelSize,
|
||||
uchar alfa=0,
|
||||
QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
|
||||
QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
|
||||
QPixelFormat::TypeInterpretation typeInt=QPixelFormat::FloatingPoint) Q_DECL_NOTHROW
|
||||
{
|
||||
return QPixelFormat(QPixelFormat::HSL,
|
||||
channelSize,
|
||||
channelSize,
|
||||
channelSize,
|
||||
0,
|
||||
0,
|
||||
alfa,
|
||||
usage,
|
||||
position,
|
||||
QPixelFormat::NotPremultiplied,
|
||||
typeInt);
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR
|
||||
QPixelFormatHsv::QPixelFormatHsv(uchar channelSize,
|
||||
uchar alfa,
|
||||
AlphaUsage usage,
|
||||
AlphaPosition position,
|
||||
TypeInterpretation typeInt) Q_DECL_NOTHROW
|
||||
: QPixelFormat(HSV,
|
||||
channelSize,
|
||||
channelSize,
|
||||
channelSize,
|
||||
0,
|
||||
0,
|
||||
alfa,
|
||||
usage,
|
||||
position,
|
||||
NotPremultiplied,
|
||||
typeInt)
|
||||
{ }
|
||||
Q_DECL_CONSTEXPR inline QPixelFormat qPixelFormatHsv(uchar channelSize,
|
||||
uchar alfa=0,
|
||||
QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
|
||||
QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
|
||||
QPixelFormat::TypeInterpretation typeInt=QPixelFormat::FloatingPoint) Q_DECL_NOTHROW
|
||||
{
|
||||
return QPixelFormat(QPixelFormat::HSV,
|
||||
channelSize,
|
||||
channelSize,
|
||||
channelSize,
|
||||
0,
|
||||
0,
|
||||
alfa,
|
||||
usage,
|
||||
position,
|
||||
QPixelFormat::NotPremultiplied,
|
||||
typeInt);
|
||||
}
|
||||
|
||||
QPixelFormatYuv::QPixelFormatYuv(YUVLayout layout,
|
||||
uchar alfa,
|
||||
AlphaUsage usage,
|
||||
AlphaPosition position,
|
||||
AlphaPremultiplied p_mul,
|
||||
TypeInterpretation typeInt,
|
||||
ByteOrder b_order)
|
||||
: QPixelFormat(QtPrivate::QPixelFormat_createYUV(layout,
|
||||
alfa,
|
||||
usage,
|
||||
position,
|
||||
p_mul,
|
||||
typeInt,
|
||||
b_order))
|
||||
|
||||
{ }
|
||||
inline QPixelFormat qPixelFormatYuv(QPixelFormat::YUVLayout layout,
|
||||
uchar alfa=0,
|
||||
QPixelFormat::AlphaUsage usage=QPixelFormat::IgnoresAlpha,
|
||||
QPixelFormat::AlphaPosition position=QPixelFormat::AtBeginning,
|
||||
QPixelFormat::AlphaPremultiplied p_mul=QPixelFormat::NotPremultiplied,
|
||||
QPixelFormat::TypeInterpretation typeInt=QPixelFormat::UnsignedByte,
|
||||
QPixelFormat::ByteOrder b_order=QPixelFormat::LittleEndian)
|
||||
{
|
||||
return QtPrivate::QPixelFormat_createYUV(layout,
|
||||
alfa,
|
||||
usage,
|
||||
position,
|
||||
p_mul,
|
||||
typeInt,
|
||||
b_order);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
|
|
|||
|
|
@ -2559,7 +2559,7 @@ void tst_QImage::scaled_QTBUG35972()
|
|||
|
||||
void tst_QImage::convertToPixelFormat()
|
||||
{
|
||||
QPixelFormat rgb565 = QPixelFormatRgb(5,6,5,0,QPixelFormat::IgnoresAlpha, QPixelFormat::AtBeginning, QPixelFormat::NotPremultiplied, QPixelFormat::UnsignedShort);
|
||||
QPixelFormat rgb565 = qPixelFormatRgba(5,6,5,0,QPixelFormat::IgnoresAlpha, QPixelFormat::AtBeginning, QPixelFormat::NotPremultiplied, QPixelFormat::UnsignedShort);
|
||||
QPixelFormat rgb565ImageFormat = QImage::toPixelFormat(QImage::Format_RGB16);
|
||||
QCOMPARE(rgb565, rgb565ImageFormat);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,11 +59,11 @@ private slots:
|
|||
|
||||
void tst_QPixelFormat::testOperators()
|
||||
{
|
||||
QPixelFormat first = QPixelFormatRgb(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtBeginning, QPixelFormat::Premultiplied);
|
||||
QPixelFormat second = QPixelFormatRgb(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtBeginning, QPixelFormat::Premultiplied);
|
||||
QPixelFormat first = qPixelFormatRgba(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtBeginning, QPixelFormat::Premultiplied);
|
||||
QPixelFormat second = qPixelFormatRgba(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtBeginning, QPixelFormat::Premultiplied);
|
||||
QVERIFY(first == second);
|
||||
|
||||
QPixelFormat third = QPixelFormatRgb(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtEnd, QPixelFormat::NotPremultiplied);
|
||||
QPixelFormat third = qPixelFormatRgba(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtEnd, QPixelFormat::NotPremultiplied);
|
||||
QVERIFY(first != third);
|
||||
}
|
||||
|
||||
|
|
@ -88,20 +88,20 @@ void tst_QPixelFormat::testQVectorOfFormats()
|
|||
|
||||
void tst_QPixelFormat::testRGB()
|
||||
{
|
||||
QPixelFormat argb8888 = QPixelFormatRgb(8,8,8,8,QPixelFormat::UsesAlpha,QPixelFormat::AtBeginning, QPixelFormat::Premultiplied);
|
||||
QPixelFormat argb8888 = qPixelFormatRgba(8,8,8,8,QPixelFormat::UsesAlpha,QPixelFormat::AtBeginning, QPixelFormat::Premultiplied);
|
||||
QCOMPARE(argb8888.redSize(), uchar(8));
|
||||
QCOMPARE(argb8888.greenSize(), uchar(8));
|
||||
QCOMPARE(argb8888.blueSize(), uchar(8));
|
||||
QCOMPARE(argb8888.alphaSize(), uchar(8));
|
||||
|
||||
QPixelFormat rgb565 = QPixelFormatRgb(5,6,5,0,QPixelFormat::IgnoresAlpha,QPixelFormat::AtBeginning, QPixelFormat::NotPremultiplied);
|
||||
QPixelFormat rgb565 = qPixelFormatRgba(5,6,5,0,QPixelFormat::IgnoresAlpha,QPixelFormat::AtBeginning, QPixelFormat::NotPremultiplied);
|
||||
QCOMPARE(rgb565.redSize(), uchar(5));
|
||||
QCOMPARE(rgb565.greenSize(), uchar(6));
|
||||
QCOMPARE(rgb565.blueSize(), uchar(5));
|
||||
QCOMPARE(rgb565.alphaSize(), uchar(0));
|
||||
QCOMPARE(rgb565.bitsPerPixel(), uchar(16));
|
||||
|
||||
QPixelFormat rgba1235 = QPixelFormatRgb(1,2,3,5,QPixelFormat::IgnoresAlpha, QPixelFormat::AtEnd, QPixelFormat::Premultiplied);
|
||||
QPixelFormat rgba1235 = qPixelFormatRgba(1,2,3,5,QPixelFormat::IgnoresAlpha, QPixelFormat::AtEnd, QPixelFormat::Premultiplied);
|
||||
QCOMPARE(rgba1235.redSize(), uchar(1));
|
||||
QCOMPARE(rgba1235.greenSize(), uchar(2));
|
||||
QCOMPARE(rgba1235.blueSize(), uchar(3));
|
||||
|
|
@ -111,26 +111,26 @@ void tst_QPixelFormat::testRGB()
|
|||
|
||||
void tst_QPixelFormat::testCMYK()
|
||||
{
|
||||
QPixelFormat cmyk6 = QPixelFormatCmyk(6);
|
||||
QPixelFormat cmyk6 = qPixelFormatCmyk(6);
|
||||
QCOMPARE(cmyk6.cyanSize(), uchar(6));
|
||||
QCOMPARE(cmyk6.magentaSize(), uchar(6));
|
||||
QCOMPARE(cmyk6.yellowSize(), uchar(6));
|
||||
QCOMPARE(cmyk6.blackSize(), uchar(6));
|
||||
QCOMPARE(cmyk6.bitsPerPixel(), uchar(6*4));
|
||||
|
||||
QPixelFormat cmykWithAlpha = QPixelFormatCmyk(8,8);
|
||||
QPixelFormat cmykWithAlpha = qPixelFormatCmyk(8,8);
|
||||
QCOMPARE(cmykWithAlpha.bitsPerPixel(), uchar(8*5));
|
||||
}
|
||||
void tst_QPixelFormat::testHSLandHSV()
|
||||
{
|
||||
QPixelFormat hsl = QPixelFormatHsl(3,5);
|
||||
QPixelFormat hsl = qPixelFormatHsl(3,5);
|
||||
|
||||
QCOMPARE(hsl.hueSize(), uchar(3));
|
||||
QCOMPARE(hsl.saturationSize(), uchar(3));
|
||||
QCOMPARE(hsl.lightnessSize(), uchar(3));
|
||||
QCOMPARE(hsl.bitsPerPixel(), uchar(3 * 3 + 5));
|
||||
|
||||
QPixelFormat hsv = QPixelFormatHsv(5,7);
|
||||
QPixelFormat hsv = qPixelFormatHsv(5,7);
|
||||
|
||||
QCOMPARE(hsv.hueSize(), uchar(5));
|
||||
QCOMPARE(hsv.saturationSize(), uchar(5));
|
||||
|
|
@ -164,7 +164,7 @@ void tst_QPixelFormat::testYUV()
|
|||
{
|
||||
QFETCH(QPixelFormat::YUVLayout, yuv_layout);
|
||||
|
||||
QPixelFormat format = QPixelFormatYuv(yuv_layout, 0);
|
||||
QPixelFormat format = qPixelFormatYuv(yuv_layout, 0);
|
||||
|
||||
switch (yuv_layout) {
|
||||
case QPixelFormat::YUV444:
|
||||
|
|
|
|||
Loading…
Reference in New Issue