Kaydet (Commit) 726b6b1c authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:unusedmethods

Change-Id: I360ed9c98a42026f6f3894e93f89be39080af6b5
Reviewed-on: https://gerrit.libreoffice.org/53542Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst c688b01d
......@@ -54,7 +54,6 @@ private:
void HandleSubToolBarEvent( const VclWindowEvent& rVclWindowEvent );
void ReleaseSubToolBox( ToolBox* _pSubToolBox );
sal_Int32 implGetAccessibleChildCount();
sal_Int32 implGetSelectedAccessibleChildCount();
virtual ~VCLXAccessibleToolBox() override;
......
......@@ -484,7 +484,6 @@ public:
virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPageCapsule pPage ) const;
virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, void* pData, tools::Rectangle& rTextRect, SdrObject* pObj ) override;
virtual void NotifyFreeObj(void* pData, SdrObject* pObj) override;
void FreeObj(void* pData, SdrObject* pObj);
virtual void ProcessClientAnchor2( SvStream& rSt, DffRecordHeader& rHd, void* pData, DffObjData& rObj ) override;
void ImportHeaderFooterContainer( DffRecordHeader const & rHeader, HeaderFooterEntry& rEntry );
};
......
......@@ -79,9 +79,6 @@ protected:
// asserted there
virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const;
// method for flushing View Independent Primitive2DContainer for VOC implementations
void flushViewIndependentPrimitive2DSequence() { mxViewIndependentPrimitive2DSequence.clear(); }
// basic constructor. Since this is a base class only, it shall
// never be called directly
ViewContact();
......
......@@ -118,8 +118,6 @@ public:
bool bExcludeImportSubsets
);
void InsertTextEncoding( const rtl_TextEncoding nEnc );
void InsertTextEncoding( const rtl_TextEncoding nEnc,
const OUString& rEntry );
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
#ifndef INCLUDED_INCLUDE_VCL_BITMAPMEDIANCOLORQUANTIZATIONFILTER_HXX
#define INCLUDED_INCLUDE_VCL_BITMAPMEDIANCOLORQUANTIZATIONFILTER_HXX
#include <tools/color.hxx>
#include <vcl/BitmapFilter.hxx>
#define RGB15(_def_cR, _def_cG, _def_cB) \
((static_cast<sal_uLong>(_def_cR) << 10) | (static_cast<sal_uLong>(_def_cG) << 5) \
| static_cast<sal_uLong>(_def_cB))
#define GAMMA(_def_cVal, _def_InvGamma) \
(static_cast<sal_uInt8>(MinMax(FRound(pow(_def_cVal / 255.0, _def_InvGamma) * 255.0), 0, 255)))
class VCL_DLLPUBLIC BitmapMedianColorQuantizationFilter : public BitmapFilter
{
public:
/** Reduce number of colors for the bitmap using the median algorithm
@param nNewColorCount
Maximal number of bitmap colors after the reduce operation
*/
BitmapMedianColorQuantizationFilter(sal_uInt16 nNewColorCount)
: mnNewColorCount(nNewColorCount)
{
}
virtual BitmapEx execute(BitmapEx const& rBitmapEx) override;
private:
sal_uInt16 mnNewColorCount;
void medianCut(Bitmap& rBitmap, sal_uLong* pColBuf, BitmapPalette& rPal, long nR1, long nR2,
long nG1, long nG2, long nB1, long nB2, long nColors, long nPixels,
long& rIndex);
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -267,15 +267,6 @@ void TextEncodingBox::InsertTextEncoding( const rtl_TextEncoding nEnc,
m_xControl->append(OUString::number(nEnc), rEntry);
}
void TextEncodingBox::InsertTextEncoding( const rtl_TextEncoding nEnc )
{
const OUString& rEntry = SvxTextEncodingTable::GetTextString(nEnc);
if (!rEntry.isEmpty())
InsertTextEncoding( nEnc, rEntry );
else
SAL_WARN( "svx.dialog", "TextEncodingBox::InsertTextEncoding: no resource string for text encoding: " << static_cast<sal_Int32>( nEnc ) );
}
rtl_TextEncoding TextEncodingBox::GetSelectTextEncoding() const
{
OUString sId(m_xControl->get_active_id());
......
......@@ -335,7 +335,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/bitmap/BitmapSymmetryCheck \
vcl/source/bitmap/BitmapColorQuantizationFilter \
vcl/source/bitmap/BitmapSimpleColorQuantizationFilter \
vcl/source/bitmap/BitmapMedianColorQuantizationFilter \
vcl/source/bitmap/BitmapTools \
vcl/source/bitmap/checksum \
vcl/source/image/Image \
......
......@@ -239,7 +239,6 @@ public:
cairo_t* getCairoContext(bool bXorModeAllowed) const;
void releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, const basegfx::B2DRange& rExtents) const;
static cairo_surface_t* createCairoSurface(const BitmapBuffer *pBuffer);
double getScale() const { return m_fScale; }
void clipRegion(cairo_t* cr);
};
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/bitmapaccess.hxx>
#include <vcl/BitmapMedianColorQuantizationFilter.hxx>
#include <bitmapwriteaccess.hxx>
#include <impoctree.hxx>
#include <cstdlib>
BitmapEx BitmapMedianColorQuantizationFilter::execute(BitmapEx const& aBitmapEx)
{
Bitmap aBitmap = aBitmapEx.GetBitmap();
bool bRet = false;
if (aBitmap.GetColorCount() <= static_cast<sal_uLong>(mnNewColorCount))
{
bRet = true;
}
else
{
Bitmap::ScopedReadAccess pRAcc(aBitmap);
sal_uInt16 nBitCount;
if (mnNewColorCount < 17)
{
nBitCount = 4;
}
else if (mnNewColorCount < 257)
{
nBitCount = 8;
}
else
{
OSL_FAIL("Bitmap::ImplReduceMedian(): invalid color count!");
nBitCount = 8;
mnNewColorCount = 256;
}
if (pRAcc)
{
Bitmap aNewBmp(aBitmap.GetSizePixel(), nBitCount);
BitmapScopedWriteAccess pWAcc(aNewBmp);
if (pWAcc)
{
const sal_uLong nSize = 32768 * sizeof(sal_uLong);
sal_uLong* pColBuf = static_cast<sal_uLong*>(rtl_allocateMemory(nSize));
const long nWidth = pWAcc->Width();
const long nHeight = pWAcc->Height();
long nIndex = 0;
memset(pColBuf, 0, nSize);
// create Buffer
if (pRAcc->HasPalette())
{
for (long nY = 0; nY < nHeight; nY++)
{
Scanline pScanlineRead = pRAcc->GetScanline(nY);
for (long nX = 0; nX < nWidth; nX++)
{
const BitmapColor& rCol = pRAcc->GetPaletteColor(
pRAcc->GetIndexFromData(pScanlineRead, nX));
pColBuf[RGB15(rCol.GetRed() >> 3, rCol.GetGreen() >> 3,
rCol.GetBlue() >> 3)]++;
}
}
}
else
{
for (long nY = 0; nY < nHeight; nY++)
{
Scanline pScanlineRead = pRAcc->GetScanline(nY);
for (long nX = 0; nX < nWidth; nX++)
{
const BitmapColor aCol(pRAcc->GetPixelFromData(pScanlineRead, nX));
pColBuf[RGB15(aCol.GetRed() >> 3, aCol.GetGreen() >> 3,
aCol.GetBlue() >> 3)]++;
}
}
}
// create palette via median cut
BitmapPalette aPal(pWAcc->GetPaletteEntryCount());
medianCut(aBitmap, pColBuf, aPal, 0, 31, 0, 31, 0, 31, mnNewColorCount,
nWidth * nHeight, nIndex);
// do mapping of colors to palette
InverseColorMap aMap(aPal);
pWAcc->SetPalette(aPal);
for (long nY = 0; nY < nHeight; nY++)
{
Scanline pScanline = pWAcc->GetScanline(nY);
for (long nX = 0; nX < nWidth; nX++)
{
pWAcc->SetPixelOnData(
pScanline, nX,
BitmapColor(static_cast<sal_uInt8>(
aMap.GetBestPaletteIndex(pRAcc->GetColor(nY, nX)))));
}
}
rtl_freeMemory(pColBuf);
pWAcc.reset();
bRet = true;
}
pRAcc.reset();
if (bRet)
{
const MapMode aMap(aBitmap.GetPrefMapMode());
const Size aSize(aBitmap.GetPrefSize());
aBitmap = aNewBmp;
aBitmap.SetPrefMapMode(aMap);
aBitmap.SetPrefSize(aSize);
}
}
}
if (bRet)
return BitmapEx(aBitmap);
return BitmapEx();
}
void BitmapMedianColorQuantizationFilter::medianCut(Bitmap& rBitmap, sal_uLong* pColBuf,
BitmapPalette& rPal, long nR1, long nR2,
long nG1, long nG2, long nB1, long nB2,
long nColors, long nPixels, long& rIndex)
{
if (!nPixels)
return;
BitmapColor aCol;
const long nRLen = nR2 - nR1;
const long nGLen = nG2 - nG1;
const long nBLen = nB2 - nB1;
sal_uLong* pBuf = pColBuf;
if (!nRLen && !nGLen && !nBLen)
{
if (pBuf[RGB15(nR1, nG1, nB1)])
{
aCol.SetRed(static_cast<sal_uInt8>(nR1 << 3));
aCol.SetGreen(static_cast<sal_uInt8>(nG1 << 3));
aCol.SetBlue(static_cast<sal_uInt8>(nB1 << 3));
rPal[static_cast<sal_uInt16>(rIndex++)] = aCol;
}
}
else
{
if (nColors == 1 || nPixels == 1)
{
long nPixSum = 0, nRSum = 0, nGSum = 0, nBSum = 0;
for (long nR = nR1; nR <= nR2; nR++)
{
for (long nG = nG1; nG <= nG2; nG++)
{
for (long nB = nB1; nB <= nB2; nB++)
{
nPixSum = pBuf[RGB15(nR, nG, nB)];
if (nPixSum)
{
nRSum += nR * nPixSum;
nGSum += nG * nPixSum;
nBSum += nB * nPixSum;
}
}
}
}
aCol.SetRed(static_cast<sal_uInt8>((nRSum / nPixels) << 3));
aCol.SetGreen(static_cast<sal_uInt8>((nGSum / nPixels) << 3));
aCol.SetBlue(static_cast<sal_uInt8>((nBSum / nPixels) << 3));
rPal[static_cast<sal_uInt16>(rIndex++)] = aCol;
}
else
{
const long nTest = (nPixels >> 1);
long nPixOld = 0;
long nPixNew = 0;
if (nBLen > nGLen && nBLen > nRLen)
{
long nB = nB1 - 1;
while (nPixNew < nTest)
{
nB++;
nPixOld = nPixNew;
for (long nR = nR1; nR <= nR2; nR++)
{
for (long nG = nG1; nG <= nG2; nG++)
{
nPixNew += pBuf[RGB15(nR, nG, nB)];
}
}
}
if (nB < nB2)
{
medianCut(rBitmap, pBuf, rPal, nR1, nR2, nG1, nG2, nB1, nB, nColors >> 1,
nPixNew, rIndex);
medianCut(rBitmap, pBuf, rPal, nR1, nR2, nG1, nG2, nB + 1, nB2, nColors >> 1,
nPixels - nPixNew, rIndex);
}
else
{
medianCut(rBitmap, pBuf, rPal, nR1, nR2, nG1, nG2, nB1, nB - 1, nColors >> 1,
nPixOld, rIndex);
medianCut(rBitmap, pBuf, rPal, nR1, nR2, nG1, nG2, nB, nB2, nColors >> 1,
nPixels - nPixOld, rIndex);
}
}
else if (nGLen > nRLen)
{
long nG = nG1 - 1;
while (nPixNew < nTest)
{
nG++;
nPixOld = nPixNew;
for (long nR = nR1; nR <= nR2; nR++)
{
for (long nB = nB1; nB <= nB2; nB++)
{
nPixNew += pBuf[RGB15(nR, nG, nB)];
}
}
}
if (nG < nG2)
{
medianCut(rBitmap, pBuf, rPal, nR1, nR2, nG1, nG, nB1, nB2, nColors >> 1,
nPixNew, rIndex);
medianCut(rBitmap, pBuf, rPal, nR1, nR2, nG + 1, nG2, nB1, nB2, nColors >> 1,
nPixels - nPixNew, rIndex);
}
else
{
medianCut(rBitmap, pBuf, rPal, nR1, nR2, nG1, nG - 1, nB1, nB2, nColors >> 1,
nPixOld, rIndex);
medianCut(rBitmap, pBuf, rPal, nR1, nR2, nG, nG2, nB1, nB2, nColors >> 1,
nPixels - nPixOld, rIndex);
}
}
else
{
long nR = nR1 - 1;
while (nPixNew < nTest)
{
nR++;
nPixOld = nPixNew;
for (long nG = nG1; nG <= nG2; nG++)
{
for (long nB = nB1; nB <= nB2; nB++)
{
nPixNew += pBuf[RGB15(nR, nG, nB)];
}
}
}
if (nR < nR2)
{
medianCut(rBitmap, pBuf, rPal, nR1, nR, nG1, nG2, nB1, nB2, nColors >> 1,
nPixNew, rIndex);
medianCut(rBitmap, pBuf, rPal, nR1 + 1, nR2, nG1, nG2, nB1, nB2, nColors >> 1,
nPixels - nPixNew, rIndex);
}
else
{
medianCut(rBitmap, pBuf, rPal, nR1, nR - 1, nG1, nG2, nB1, nB2, nColors >> 1,
nPixOld, rIndex);
medianCut(rBitmap, pBuf, rPal, nR, nR2, nG1, nG2, nB1, nB2, nColors >> 1,
nPixels - nPixOld, rIndex);
}
}
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment