From c34bb163c38cfa893d1b5b0124ab9c5929dff16c Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Sat, 11 May 2019 11:49:21 +0000 Subject: Make BitmapColor inherit from / merge into Color MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BitmapColor itself is kept to distingish the Color usage as part of a color palette, which continues to store the offset in the blue value. The original special mbIndex handling is long gone since commit 1fefdd6f3b41 ("Alpha channel in BitmapColor - change bIndex to alpha"), so there is no data difference. This also results in the following changes: * now has a basic_ostream& operator<< (that was my actual starting point... for an other bug fix) * there is a minimal difference for GetLiminance BGR(29,151,76) => BGR(28,151,77) * no more return values for Merge and Invert (previously returning *this) * replaces all GetBlueOrIndex with GetIndex This leaves one "problematic" part: the GetColorError handling. At first glance it should probably be virtual. The Color variant is less strict then the BitmapColor one - for whatever reason. BitmapColor is always used to search for the best match in a Palette. Currently I'm simply leaving both variants. Would be nice to have an explict for functions here. Change-Id: I251ba3024a1d60f2a9d9fde9cd0a60f08e8322a7 Reviewed-on: https://gerrit.libreoffice.org/72181 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl Reviewed-by: Jan-Marek Glogowski --- sd/qa/unit/import-tests.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sd') diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 57cfb9ee7cb3..331bc251c82f 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -1374,7 +1374,7 @@ void SdImportTest::testTdf93124() { for (long nX = 34; nX < (34 + 43); ++nX) { - const Color aColor = pReadAccess->GetColor(nY, nX).GetColor(); + const Color aColor = pReadAccess->GetColor(nY, nX); if ((aColor.GetRed() != 0xff) || (aColor.GetGreen() != 0xff) || (aColor.GetBlue() != 0xff)) ++nNonWhiteCount; } @@ -1433,7 +1433,7 @@ void SdImportTest::testTdf99729() { for (long nY = 16; nY < (16 + 96); ++nY) { - const Color aColor = pRead->GetColor(nY, nX).GetColor(); + const Color aColor = pRead->GetColor(nY, nX); if ((aColor.GetRed() != 0xff) || (aColor.GetGreen() != 0xff) || (aColor.GetBlue() != 0xff)) ++nonwhitecounts[i]; } @@ -1873,7 +1873,7 @@ bool checkPatternValues(std::vector& rExpected, Bitmap& rBitmap) Scanline pScanline = pAccess->GetScanline( y ); for (long x = 0; x < pAccess->Width(); ++x) { - Color aColor = pAccess->GetPixelFromData(pScanline, x).GetColor(); + Color aColor = pAccess->GetPixelFromData(pScanline, x); sal_uInt8 aValue = rExpected[y*8+x]; if (aValue == 1 && aColor != aFGColor) -- cgit