mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-05-25 07:50:23 -04:00
clang-tidy: one declaration per line; braces around statements
clang-tidy checks: readability-isolate-declaration and readability-braces-around-statements KF task: https://phabricator.kde.org/T14729 GIT_SILENT
This commit is contained in:
parent
a8f92e5525
commit
f5d574b3ad
@ -1,2 +1,3 @@
|
||||
#clang-format
|
||||
#clang-format/tidy
|
||||
1169859b07f25c865ee0bfc2a7dc97a431651776
|
||||
eaca33bec8b19498c3621fc3a20a8c55a2812462
|
||||
|
@ -44,11 +44,13 @@ static bool fuzzyeq(const QImage &im1, const QImage &im2, uchar fuzziness)
|
||||
const Trait *line2 = reinterpret_cast<const Trait *>(im2.scanLine(i));
|
||||
for (int j = 0; j < width; ++j) {
|
||||
if (line1[j] > line2[j]) {
|
||||
if (line1[j] - line2[j] > fuzziness)
|
||||
if (line1[j] - line2[j] > fuzziness) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (line2[j] - line1[j] > fuzziness)
|
||||
if (line2[j] - line1[j] > fuzziness) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,10 @@ static bool bbox(QIODevice *io, int *x1, int *y1, int *x2, int *y2)
|
||||
if (strncmp(buf, BBOX, BBOX_LEN) == 0) {
|
||||
// Some EPS files have non-integer values for the bbox
|
||||
// We don't support that currently, but at least we parse it
|
||||
float _x1, _y1, _x2, _y2;
|
||||
float _x1;
|
||||
float _y1;
|
||||
float _x2;
|
||||
float _y2;
|
||||
if (sscanf(buf, "%*s %f %f %f %f", &_x1, &_y1, &_x2, &_y2) == 4) {
|
||||
qCDebug(EPSPLUGIN) << "BBOX: " << _x1 << " " << _y1 << " " << _x2 << " " << _y2;
|
||||
*x1 = int(_x1);
|
||||
@ -127,14 +130,18 @@ bool EPSHandler::read(QImage *image)
|
||||
{
|
||||
qCDebug(EPSPLUGIN) << "starting...";
|
||||
|
||||
int x1, y1, x2, y2;
|
||||
int x1;
|
||||
int y1;
|
||||
int x2;
|
||||
int y2;
|
||||
#ifdef EPS_PERFORMANCE_DEBUG
|
||||
QTime dt;
|
||||
dt.start();
|
||||
#endif
|
||||
|
||||
QIODevice *io = device();
|
||||
qint64 ps_offset, ps_size;
|
||||
qint64 ps_offset;
|
||||
qint64 ps_size;
|
||||
|
||||
// find start of PostScript code
|
||||
if (!seekToCodeStart(io, ps_offset, ps_size)) {
|
||||
|
@ -99,7 +99,10 @@ void K_IStream::clear()
|
||||
*/
|
||||
QRgb RgbaToQrgba(struct Imf::Rgba &imagePixel)
|
||||
{
|
||||
float r, g, b, a;
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
float a;
|
||||
|
||||
// 1) Compensate for fogging by subtracting defog
|
||||
// from the raw pixel values.
|
||||
@ -178,7 +181,8 @@ bool EXRHandler::canRead() const
|
||||
bool EXRHandler::read(QImage *outImage)
|
||||
{
|
||||
try {
|
||||
int width, height;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
K_IStream istr(device(), QByteArray());
|
||||
Imf::RgbaInputFile file(istr);
|
||||
|
@ -89,7 +89,8 @@ static void RGBE_To_QRgbLine(uchar *image, QRgb *scanline, int width)
|
||||
// Load the HDR image.
|
||||
static bool LoadHDR(QDataStream &s, const int width, const int height, QImage &img)
|
||||
{
|
||||
uchar val, code;
|
||||
uchar val;
|
||||
uchar code;
|
||||
|
||||
// Create dst image.
|
||||
img = QImage(width, height, QImage::Format_RGB32);
|
||||
|
@ -35,12 +35,14 @@ bool KraHandler::canRead() const
|
||||
bool KraHandler::read(QImage *image)
|
||||
{
|
||||
KZip zip(device());
|
||||
if (!zip.open(QIODevice::ReadOnly))
|
||||
if (!zip.open(QIODevice::ReadOnly)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const KArchiveEntry *entry = zip.directory()->entry(QStringLiteral("mergedimage.png"));
|
||||
if (!entry || !entry->isFile())
|
||||
if (!entry || !entry->isFile()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const KZipFileEntry *fileZipEntry = static_cast<const KZipFileEntry *>(entry);
|
||||
|
||||
@ -57,8 +59,9 @@ bool KraHandler::canRead(QIODevice *device)
|
||||
}
|
||||
|
||||
char buff[57];
|
||||
if (device->peek(buff, sizeof(buff)) == sizeof(buff))
|
||||
if (device->peek(buff, sizeof(buff)) == sizeof(buff)) {
|
||||
return memcmp(buff + 0x26, s_magic, s_magic_size) == 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -34,12 +34,14 @@ bool OraHandler::canRead() const
|
||||
bool OraHandler::read(QImage *image)
|
||||
{
|
||||
KZip zip(device());
|
||||
if (!zip.open(QIODevice::ReadOnly))
|
||||
if (!zip.open(QIODevice::ReadOnly)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const KArchiveEntry *entry = zip.directory()->entry(QStringLiteral("mergedimage.png"));
|
||||
if (!entry || !entry->isFile())
|
||||
if (!entry || !entry->isFile()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const KZipFileEntry *fileZipEntry = static_cast<const KZipFileEntry *>(entry);
|
||||
|
||||
@ -56,8 +58,9 @@ bool OraHandler::canRead(QIODevice *device)
|
||||
}
|
||||
|
||||
char buff[54];
|
||||
if (device->peek(buff, sizeof(buff)) == sizeof(buff))
|
||||
if (device->peek(buff, sizeof(buff)) == sizeof(buff)) {
|
||||
return memcmp(buff + 0x26, s_magic, s_magic_size) == 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -105,7 +105,9 @@ public:
|
||||
|
||||
static QDataStream &operator>>(QDataStream &s, RGB &rgb)
|
||||
{
|
||||
quint8 r, g, b;
|
||||
quint8 r;
|
||||
quint8 g;
|
||||
quint8 b;
|
||||
|
||||
s >> r >> g >> b;
|
||||
rgb.r = r;
|
||||
@ -126,24 +128,32 @@ static QDataStream &operator>>(QDataStream &s, Palette &pal)
|
||||
|
||||
static QDataStream &operator>>(QDataStream &s, PCXHEADER &ph)
|
||||
{
|
||||
quint8 m, ver, enc, bpp;
|
||||
quint8 m;
|
||||
quint8 ver;
|
||||
quint8 enc;
|
||||
quint8 bpp;
|
||||
s >> m >> ver >> enc >> bpp;
|
||||
ph.Manufacturer = m;
|
||||
ph.Version = ver;
|
||||
ph.Encoding = enc;
|
||||
ph.Bpp = bpp;
|
||||
quint16 xmin, ymin, xmax, ymax;
|
||||
quint16 xmin;
|
||||
quint16 ymin;
|
||||
quint16 xmax;
|
||||
quint16 ymax;
|
||||
s >> xmin >> ymin >> xmax >> ymax;
|
||||
ph.XMin = xmin;
|
||||
ph.YMin = ymin;
|
||||
ph.XMax = xmax;
|
||||
ph.YMax = ymax;
|
||||
quint16 hdpi, ydpi;
|
||||
quint16 hdpi;
|
||||
quint16 ydpi;
|
||||
s >> hdpi >> ydpi;
|
||||
ph.HDpi = hdpi;
|
||||
ph.YDpi = ydpi;
|
||||
Palette colorMap;
|
||||
quint8 res, np;
|
||||
quint8 res;
|
||||
quint8 np;
|
||||
s >> colorMap >> res >> np;
|
||||
ph.ColorMap = colorMap;
|
||||
ph.Reserved = res;
|
||||
@ -154,7 +164,8 @@ static QDataStream &operator>>(QDataStream &s, PCXHEADER &ph)
|
||||
quint16 paletteinfo;
|
||||
s >> paletteinfo;
|
||||
ph.PaletteInfo = paletteinfo;
|
||||
quint16 hscreensize, vscreensize;
|
||||
quint16 hscreensize;
|
||||
quint16 vscreensize;
|
||||
s >> hscreensize;
|
||||
ph.HScreenSize = hscreensize;
|
||||
s >> vscreensize;
|
||||
@ -222,7 +233,8 @@ static void readLine(QDataStream &s, QByteArray &buf, const PCXHEADER &header)
|
||||
{
|
||||
quint32 i = 0;
|
||||
quint32 size = buf.size();
|
||||
quint8 byte, count;
|
||||
quint8 byte;
|
||||
quint8 count;
|
||||
|
||||
if (header.isCompressed()) {
|
||||
// Uncompress the image data
|
||||
@ -300,10 +312,11 @@ static void readImage4(QImage &img, QDataStream &s, const PCXHEADER &header)
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
quint32 offset = i * header.BytesPerLine;
|
||||
for (int x = 0; x < header.width(); ++x)
|
||||
for (int x = 0; x < header.width(); ++x) {
|
||||
if (buf[offset + (x / 8)] & (128 >> (x % 8))) {
|
||||
pixbuf[x] = (int)(pixbuf[x]) + (1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uchar *p = img.scanLine(y);
|
||||
@ -343,8 +356,9 @@ static void readImage8(QImage &img, QDataStream &s, const PCXHEADER &header)
|
||||
|
||||
uchar *p = img.scanLine(y);
|
||||
|
||||
if (!p)
|
||||
if (!p) {
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int bpl = qMin(header.BytesPerLine, (quint16)header.width());
|
||||
for (unsigned int x = 0; x < bpl; ++x) {
|
||||
@ -358,7 +372,9 @@ static void readImage8(QImage &img, QDataStream &s, const PCXHEADER &header)
|
||||
|
||||
if (flag == 12 && (header.Version == 5 || header.Version == 2)) {
|
||||
// Read the palette
|
||||
quint8 r, g, b;
|
||||
quint8 r;
|
||||
quint8 g;
|
||||
quint8 b;
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
s >> r >> g >> b;
|
||||
img.setColor(i, qRgb(r, g, b));
|
||||
@ -400,7 +416,8 @@ static void writeLine(QDataStream &s, QByteArray &buf)
|
||||
{
|
||||
quint32 i = 0;
|
||||
quint32 size = buf.size();
|
||||
quint8 count, data;
|
||||
quint8 count;
|
||||
quint8 data;
|
||||
char byte;
|
||||
|
||||
while (i < size) {
|
||||
@ -473,10 +490,11 @@ static void writeImage4(QImage &img, QDataStream &s, PCXHEADER &header)
|
||||
}
|
||||
|
||||
for (int x = 0; x < header.width(); ++x) {
|
||||
for (int i = 0; i < 4; ++i)
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (*(p + x) & (1 << i)) {
|
||||
buf[i][x / 8] = (int)(buf[i][x / 8]) | 1 << (7 - x % 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
|
@ -154,13 +154,16 @@ static bool LoadRAS(QDataStream &s, const RasHeader &ras, QImage &img)
|
||||
// Allocate image
|
||||
img = QImage(ras.Width, ras.Height, QImage::Format_ARGB32);
|
||||
|
||||
if (img.isNull())
|
||||
if (img.isNull()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reconstruct image from RGB palette if we have a palette
|
||||
// TODO: make generic so it works with 24bit or 32bit palettes
|
||||
if (ras.ColorMapType == 1 && ras.Depth == 8) {
|
||||
quint8 red, green, blue;
|
||||
quint8 red;
|
||||
quint8 green;
|
||||
quint8 blue;
|
||||
for (quint32 y = 0; y < ras.Height; y++) {
|
||||
for (quint32 x = 0; x < ras.Width; x++) {
|
||||
red = palette.value((int)input[y * ras.Width + x]);
|
||||
@ -172,7 +175,9 @@ static bool LoadRAS(QDataStream &s, const RasHeader &ras, QImage &img)
|
||||
}
|
||||
|
||||
if (ras.ColorMapType == 0 && ras.Depth == 24 && (ras.Type == 1 || ras.Type == 2)) {
|
||||
quint8 red, green, blue;
|
||||
quint8 red;
|
||||
quint8 green;
|
||||
quint8 blue;
|
||||
for (quint32 y = 0; y < ras.Height; y++) {
|
||||
for (quint32 x = 0; x < ras.Width; x++) {
|
||||
red = input[y * 3 * ras.Width + x * 3 + 2];
|
||||
@ -184,7 +189,9 @@ static bool LoadRAS(QDataStream &s, const RasHeader &ras, QImage &img)
|
||||
}
|
||||
|
||||
if (ras.ColorMapType == 0 && ras.Depth == 24 && ras.Type == 3) {
|
||||
quint8 red, green, blue;
|
||||
quint8 red;
|
||||
quint8 green;
|
||||
quint8 blue;
|
||||
for (quint32 y = 0; y < ras.Height; y++) {
|
||||
for (quint32 x = 0; x < ras.Width; x++) {
|
||||
red = input[y * 3 * ras.Width + x * 3];
|
||||
@ -196,7 +203,9 @@ static bool LoadRAS(QDataStream &s, const RasHeader &ras, QImage &img)
|
||||
}
|
||||
|
||||
if (ras.ColorMapType == 0 && ras.Depth == 32 && (ras.Type == 1 || ras.Type == 2)) {
|
||||
quint8 red, green, blue;
|
||||
quint8 red;
|
||||
quint8 green;
|
||||
quint8 blue;
|
||||
for (quint32 y = 0; y < ras.Height; y++) {
|
||||
for (quint32 x = 0; x < ras.Width; x++) {
|
||||
red = input[y * 4 * ras.Width + x * 4 + 3];
|
||||
@ -208,7 +217,9 @@ static bool LoadRAS(QDataStream &s, const RasHeader &ras, QImage &img)
|
||||
}
|
||||
|
||||
if (ras.ColorMapType == 0 && ras.Depth == 32 && ras.Type == 3) {
|
||||
quint8 red, green, blue;
|
||||
quint8 red;
|
||||
quint8 green;
|
||||
quint8 blue;
|
||||
for (quint32 y = 0; y < ras.Height; y++) {
|
||||
for (quint32 x = 0; x < ras.Width; x++) {
|
||||
red = input[y * 4 * ras.Width + x * 4 + 1];
|
||||
@ -274,8 +285,9 @@ bool RASHandler::read(QImage *outImage)
|
||||
RasHeader ras;
|
||||
s >> ras;
|
||||
|
||||
if (ras.ColorMapLength > std::numeric_limits<int>::max())
|
||||
if (ras.ColorMapLength > std::numeric_limits<int>::max()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: add support for old versions of RAS where Length may be zero in header
|
||||
s.device()->seek(RasHeader::SIZE + ras.Length + ras.ColorMapLength);
|
||||
|
@ -138,7 +138,8 @@ SGIImage::~SGIImage()
|
||||
|
||||
bool SGIImage::getRow(uchar *dest)
|
||||
{
|
||||
int n, i;
|
||||
int n;
|
||||
int i;
|
||||
if (!_rle) {
|
||||
for (i = 0; i < _xsize; i++) {
|
||||
if (_pos >= _data.end()) {
|
||||
@ -184,7 +185,8 @@ bool SGIImage::readData(QImage &img)
|
||||
quint32 *start = _starttab;
|
||||
QByteArray lguard(_xsize, 0);
|
||||
uchar *line = (uchar *)lguard.data();
|
||||
unsigned x, y;
|
||||
unsigned x;
|
||||
unsigned y;
|
||||
|
||||
if (!_rle) {
|
||||
_pos = _data.begin();
|
||||
@ -279,9 +281,9 @@ bool SGIImage::readImage(QImage &img)
|
||||
// bytes per channel
|
||||
_stream >> _bpc;
|
||||
// qDebug() << "bytes per channel: " << int(_bpc);
|
||||
if (_bpc == 1)
|
||||
if (_bpc == 1) {
|
||||
;
|
||||
else if (_bpc == 2) {
|
||||
} else if (_bpc == 2) {
|
||||
// qDebug() << "dropping least significant byte";
|
||||
} else {
|
||||
return false;
|
||||
@ -328,8 +330,9 @@ bool SGIImage::readImage(QImage &img)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_zsize == 0)
|
||||
if (_zsize == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_zsize == 2 || _zsize == 4) {
|
||||
img = img.convertToFormat(QImage::Format_ARGB32);
|
||||
@ -337,8 +340,9 @@ bool SGIImage::readImage(QImage &img)
|
||||
// qDebug() << "using first 4 of " << _zsize << " channels";
|
||||
// Only let this continue if it won't cause a int overflow later
|
||||
// this is most likely a broken file anyway
|
||||
if (_ysize > std::numeric_limits<int>::max() / _zsize)
|
||||
if (_ysize > std::numeric_limits<int>::max() / _zsize) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
_numrows = _ysize * _zsize;
|
||||
@ -363,13 +367,15 @@ bool SGIImage::readImage(QImage &img)
|
||||
_data = _dev->readAll();
|
||||
|
||||
// sanity check
|
||||
if (_rle)
|
||||
for (uint o = 0; o < _numrows; o++)
|
||||
if (_rle) {
|
||||
for (uint o = 0; o < _numrows; o++) {
|
||||
// don't change to greater-or-equal!
|
||||
if (_starttab[o] + _lengthtab[o] > (uint)_data.size()) {
|
||||
// qDebug() << "image corrupt (sanity check failed)";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!readData(img)) {
|
||||
// qDebug() << "image corrupt (incomplete scanline)";
|
||||
@ -390,7 +396,8 @@ void RLEData::write(QDataStream &s)
|
||||
|
||||
bool RLEData::operator<(const RLEData &b) const
|
||||
{
|
||||
uchar ac, bc;
|
||||
uchar ac;
|
||||
uchar bc;
|
||||
for (int i = 0; i < qMin(size(), b.size()); i++) {
|
||||
ac = at(i);
|
||||
bc = b[i];
|
||||
@ -436,8 +443,13 @@ uchar SGIImage::intensity(uchar c)
|
||||
|
||||
uint SGIImage::compact(uchar *d, uchar *s)
|
||||
{
|
||||
uchar *dest = d, *src = s, patt, *t, *end = s + _xsize;
|
||||
int i, n;
|
||||
uchar *dest = d;
|
||||
uchar *src = s;
|
||||
uchar patt;
|
||||
uchar *t;
|
||||
uchar *end = s + _xsize;
|
||||
int i;
|
||||
int n;
|
||||
while (src < end) {
|
||||
for (n = 0, t = src; t + 2 < end && !(*t == t[1] && *t == t[2]); t++) {
|
||||
n++;
|
||||
@ -480,7 +492,8 @@ bool SGIImage::scanData(const QImage &img)
|
||||
uchar *line = (uchar *)lineguard.data();
|
||||
uchar *buf = (uchar *)bufguard.data();
|
||||
const QRgb *c;
|
||||
unsigned x, y;
|
||||
unsigned x;
|
||||
unsigned y;
|
||||
uint len;
|
||||
|
||||
for (y = 0; y < _ysize; y++) {
|
||||
@ -606,7 +619,8 @@ void SGIImage::writeVerbatim(const QImage &img)
|
||||
writeHeader();
|
||||
|
||||
const QRgb *c;
|
||||
unsigned x, y;
|
||||
unsigned x;
|
||||
unsigned y;
|
||||
|
||||
for (y = 0; y < _ysize; y++) {
|
||||
c = reinterpret_cast<const QRgb *>(img.scanLine(_ysize - y - 1));
|
||||
|
@ -311,7 +311,9 @@ static bool LoadTGA(QDataStream &s, const TgaHeader &tga, QImage &img)
|
||||
}
|
||||
|
||||
// Convert image to internal format.
|
||||
int y_start, y_step, y_end;
|
||||
int y_start;
|
||||
int y_step;
|
||||
int y_end;
|
||||
if (tga.flags & TGA_ORIGIN_UPPER) {
|
||||
y_start = 0;
|
||||
y_step = 1;
|
||||
@ -437,7 +439,7 @@ bool TGAHandler::write(const QImage &image)
|
||||
s << quint8(hasAlpha ? 32 : 24); // depth (24 bit RGB + 8 bit alpha)
|
||||
s << quint8(hasAlpha ? 0x24 : 0x20); // top left image (0x20) + 8 bit alpha (0x4)
|
||||
|
||||
for (int y = 0; y < img.height(); y++)
|
||||
for (int y = 0; y < img.height(); y++) {
|
||||
for (int x = 0; x < img.width(); x++) {
|
||||
const QRgb color = img.pixel(x, y);
|
||||
s << quint8(qBlue(color));
|
||||
@ -447,6 +449,7 @@ bool TGAHandler::write(const QImage &image)
|
||||
s << quint8(qAlpha(color));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -747,7 +747,9 @@ bool XCFImageFormat::loadImageProperties(QDataStream &xcf_io, XCFImage &xcf_imag
|
||||
xcf_image.palette.reserve(xcf_image.num_colors);
|
||||
|
||||
for (int i = 0; i < xcf_image.num_colors; i++) {
|
||||
uchar r, g, b;
|
||||
uchar r;
|
||||
uchar g;
|
||||
uchar b;
|
||||
property >> r >> g >> b;
|
||||
xcf_image.palette.push_back(qRgb(r, g, b));
|
||||
}
|
||||
@ -1951,11 +1953,13 @@ bool XCFImageFormat::initializeImage(XCFImage &xcf_image)
|
||||
|
||||
if (xcf_image.x_resolution > 0 && xcf_image.y_resolution > 0) {
|
||||
const float dpmx = xcf_image.x_resolution * INCHESPERMETER;
|
||||
if (dpmx > std::numeric_limits<int>::max())
|
||||
if (dpmx > std::numeric_limits<int>::max()) {
|
||||
return false;
|
||||
}
|
||||
const float dpmy = xcf_image.y_resolution * INCHESPERMETER;
|
||||
if (dpmy > std::numeric_limits<int>::max())
|
||||
if (dpmy > std::numeric_limits<int>::max()) {
|
||||
return false;
|
||||
}
|
||||
image.setDotsPerMeterX((int)dpmx);
|
||||
image.setDotsPerMeterY((int)dpmy);
|
||||
}
|
||||
@ -2639,7 +2643,8 @@ void XCFImageFormat::mergeRGBToRGB(const Layer &layer, uint i, uint j, int k, in
|
||||
src_a = qMin(src_a, dst_a);
|
||||
} break;
|
||||
case GIMP_LAYER_MODE_SOFTLIGHT_LEGACY: {
|
||||
uint tmpS, tmpM;
|
||||
uint tmpS;
|
||||
uint tmpM;
|
||||
|
||||
tmpM = INT_MULT(dst_r, src_r);
|
||||
tmpS = 255 - INT_MULT((255 - dst_r), (255 - src_r));
|
||||
@ -2707,7 +2712,10 @@ void XCFImageFormat::mergeRGBToRGB(const Layer &layer, uint i, uint j, int k, in
|
||||
src_a = INT_MULT(src_a, layer.mask_tiles[j][i].pixelIndex(k, l));
|
||||
}
|
||||
|
||||
uchar new_r, new_g, new_b, new_a;
|
||||
uchar new_r;
|
||||
uchar new_g;
|
||||
uchar new_b;
|
||||
uchar new_a;
|
||||
new_a = dst_a + INT_MULT(OPAQUE_OPACITY - dst_a, src_a);
|
||||
|
||||
const float src_ratio = new_a == 0 ? 1.0 : (float)src_a / new_a;
|
||||
@ -2813,7 +2821,8 @@ void XCFImageFormat::mergeGrayAToGray(const Layer &layer, uint i, uint j, int k,
|
||||
}
|
||||
} break;
|
||||
case SOFTLIGHT_MODE: {
|
||||
uint tmpS, tmpM;
|
||||
uint tmpS;
|
||||
uint tmpM;
|
||||
|
||||
tmpM = INT_MULT(dst, src);
|
||||
tmpS = 255 - INT_MULT((255 - dst), (255 - src));
|
||||
@ -2965,7 +2974,8 @@ void XCFImageFormat::mergeGrayAToRGB(const Layer &layer, uint i, uint j, int k,
|
||||
src_a = qMin(src_a, dst_a);
|
||||
} break;
|
||||
case SOFTLIGHT_MODE: {
|
||||
uint tmpS, tmpM;
|
||||
uint tmpS;
|
||||
uint tmpM;
|
||||
|
||||
tmpM = INT_MULT(dst, src);
|
||||
tmpS = 255 - INT_MULT((255 - dst), (255 - src));
|
||||
|
Loading…
Reference in New Issue
Block a user