Add generic optimized rectfill methods
Also makes the qt_rectfill_quint16 actually work with any uint16 format Change-Id: Ibb3deed54ee1a0a86b14d5349c95f106ced057f7 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
21435e7d04
commit
b64ec6687e
@ -5755,8 +5755,26 @@ static void qt_rectfill_quint16(QRasterBuffer *rasterBuffer,
|
|||||||
int x, int y, int width, int height,
|
int x, int y, int width, int height,
|
||||||
const QRgba64 &color)
|
const QRgba64 &color)
|
||||||
{
|
{
|
||||||
|
const QPixelLayout &layout = qPixelLayouts[rasterBuffer->format];
|
||||||
|
quint32 c32 = color.toArgb32();
|
||||||
|
layout.convertFromARGB32PM(&c32, &c32, 1, nullptr, nullptr);
|
||||||
|
quint16 c16;
|
||||||
|
storePixel<QPixelLayout::BPP16>(reinterpret_cast<uchar *>(&c16), 0, c32);
|
||||||
qt_rectfill<quint16>(reinterpret_cast<quint16 *>(rasterBuffer->buffer()),
|
qt_rectfill<quint16>(reinterpret_cast<quint16 *>(rasterBuffer->buffer()),
|
||||||
color.toRgb16(), x, y, width, height, rasterBuffer->bytesPerLine());
|
c16, x, y, width, height, rasterBuffer->bytesPerLine());
|
||||||
|
}
|
||||||
|
|
||||||
|
static void qt_rectfill_quint24(QRasterBuffer *rasterBuffer,
|
||||||
|
int x, int y, int width, int height,
|
||||||
|
const QRgba64 &color)
|
||||||
|
{
|
||||||
|
const QPixelLayout &layout = qPixelLayouts[rasterBuffer->format];
|
||||||
|
quint32 c32 = color.toArgb32();
|
||||||
|
layout.convertFromARGB32PM(&c32, &c32, 1, nullptr, nullptr);
|
||||||
|
quint24 c24;
|
||||||
|
storePixel<QPixelLayout::BPP24>(reinterpret_cast<uchar *>(&c24), 0, c32);
|
||||||
|
qt_rectfill<quint24>(reinterpret_cast<quint24 *>(rasterBuffer->buffer()),
|
||||||
|
c24, x, y, width, height, rasterBuffer->bytesPerLine());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qt_rectfill_nonpremul_argb32(QRasterBuffer *rasterBuffer,
|
static void qt_rectfill_nonpremul_argb32(QRasterBuffer *rasterBuffer,
|
||||||
@ -5876,7 +5894,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
|
|||||||
0,
|
0,
|
||||||
qt_alphamapblit_generic,
|
qt_alphamapblit_generic,
|
||||||
qt_alphargbblit_generic,
|
qt_alphargbblit_generic,
|
||||||
0
|
qt_rectfill_quint24
|
||||||
},
|
},
|
||||||
// Format_RGB666
|
// Format_RGB666
|
||||||
{
|
{
|
||||||
@ -5885,7 +5903,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
|
|||||||
0,
|
0,
|
||||||
qt_alphamapblit_generic,
|
qt_alphamapblit_generic,
|
||||||
qt_alphargbblit_generic,
|
qt_alphargbblit_generic,
|
||||||
0
|
qt_rectfill_quint24
|
||||||
},
|
},
|
||||||
// Format_ARGB6666_Premultiplied
|
// Format_ARGB6666_Premultiplied
|
||||||
{
|
{
|
||||||
@ -5894,7 +5912,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
|
|||||||
0,
|
0,
|
||||||
qt_alphamapblit_generic,
|
qt_alphamapblit_generic,
|
||||||
qt_alphargbblit_generic,
|
qt_alphargbblit_generic,
|
||||||
0
|
qt_rectfill_quint24
|
||||||
},
|
},
|
||||||
// Format_RGB555
|
// Format_RGB555
|
||||||
{
|
{
|
||||||
@ -5903,7 +5921,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
|
|||||||
0,
|
0,
|
||||||
qt_alphamapblit_generic,
|
qt_alphamapblit_generic,
|
||||||
qt_alphargbblit_generic,
|
qt_alphargbblit_generic,
|
||||||
0
|
qt_rectfill_quint16
|
||||||
},
|
},
|
||||||
// Format_ARGB8555_Premultiplied
|
// Format_ARGB8555_Premultiplied
|
||||||
{
|
{
|
||||||
@ -5912,7 +5930,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
|
|||||||
0,
|
0,
|
||||||
qt_alphamapblit_generic,
|
qt_alphamapblit_generic,
|
||||||
qt_alphargbblit_generic,
|
qt_alphargbblit_generic,
|
||||||
0
|
qt_rectfill_quint24
|
||||||
},
|
},
|
||||||
// Format_RGB888
|
// Format_RGB888
|
||||||
{
|
{
|
||||||
@ -5921,7 +5939,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
|
|||||||
0,
|
0,
|
||||||
qt_alphamapblit_generic,
|
qt_alphamapblit_generic,
|
||||||
qt_alphargbblit_generic,
|
qt_alphargbblit_generic,
|
||||||
0
|
qt_rectfill_quint24
|
||||||
},
|
},
|
||||||
// Format_RGB444
|
// Format_RGB444
|
||||||
{
|
{
|
||||||
@ -5930,7 +5948,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
|
|||||||
0,
|
0,
|
||||||
qt_alphamapblit_generic,
|
qt_alphamapblit_generic,
|
||||||
qt_alphargbblit_generic,
|
qt_alphargbblit_generic,
|
||||||
0
|
qt_rectfill_quint16
|
||||||
},
|
},
|
||||||
// Format_ARGB4444_Premultiplied
|
// Format_ARGB4444_Premultiplied
|
||||||
{
|
{
|
||||||
@ -5939,7 +5957,7 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
|
|||||||
0,
|
0,
|
||||||
qt_alphamapblit_generic,
|
qt_alphamapblit_generic,
|
||||||
qt_alphargbblit_generic,
|
qt_alphargbblit_generic,
|
||||||
0
|
qt_rectfill_quint16
|
||||||
},
|
},
|
||||||
// Format_RGBX8888
|
// Format_RGBX8888
|
||||||
{
|
{
|
||||||
|
@ -784,6 +784,7 @@ static Q_ALWAYS_INLINE uint qAlphaRgb30(uint c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct quint24 {
|
struct quint24 {
|
||||||
|
quint24() = default;
|
||||||
quint24(uint value);
|
quint24(uint value);
|
||||||
operator uint() const;
|
operator uint() const;
|
||||||
uchar data[3];
|
uchar data[3];
|
||||||
|
Loading…
Reference in New Issue
Block a user