forked from amazingfate/loongoffice
Since we're in the "if (bRet)" block, it means
22 bool bRet = isPalettePixelFormat(aBitmap.getPixelFormat())
23 || aBitmap.Convert(BmpConversion::N8BitColors);
is verified.
isPalettePixelFormat implementation is:
29 constexpr bool isPalettePixelFormat(PixelFormat ePixelFormat)
30 {
31 assert(ePixelFormat != PixelFormat::INVALID);
32 return sal_uInt16(ePixelFormat) <= 8;
33 }
So we know we're using 8 bits max and this line:
pWriteAcc->GetBitCount()
can't give more than 8 and we can safely declare nEntryCount as sal_uInt16 (idem for "n" just below)
Since "nFirstEntry" and "nLastEntry" are related to "nEntryCount", idem for mnIndex
they can also be sal_uInt16.
Thanks to these, we can avoid all sal::static_int_cast<sal_uInt16> conversions.
Change-Id: I8cac2d01f00be33c86058c7a6eb7b9e25fb2635e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140206
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
34 lines
809 B
C++
34 lines
809 B
C++
/* -*- 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_VCL_BITMAPPOPARTILTER_HXX
|
|
#define INCLUDED_VCL_BITMAPPOPARTILTER_HXX
|
|
|
|
#include <vcl/BitmapFilter.hxx>
|
|
|
|
class VCL_DLLPUBLIC BitmapPopArtFilter final : public BitmapFilter
|
|
{
|
|
public:
|
|
BitmapPopArtFilter() {}
|
|
|
|
virtual BitmapEx execute(BitmapEx const& rBitmapEx) const override;
|
|
|
|
private:
|
|
struct PopArtEntry
|
|
{
|
|
sal_uInt16 mnIndex;
|
|
sal_uInt32 mnCount;
|
|
};
|
|
};
|
|
|
|
#endif
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|