simplify and modernise ScopedBitmapAccess

(*) Make all of it use a "Scoped" paradigm
(*) pass by value, no need to allocate on heap
(*) make all of the construction go via the *Access constructors, instead of it being some via the constructors and some via the Acquire*Access methods.
(*) take the Bitmap& by const& in the constructor, so we can avoid doing const_cast in random places.

Change-Id: Ie03a9145c0965980ee8df9a89b8714a425e18f74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160293
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2023-12-04 11:17:23 +02:00 committed by Noel Grandin
parent 7101c62085
commit a214ac6774
149 changed files with 587 additions and 705 deletions

View file

@ -133,7 +133,6 @@
#include <vcl/rendercontext/SystemTextColorFlags.hxx>
#include <vcl/salgtype.hxx>
#include <vcl/salnativewidgets.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/syswin.hxx>

View file

@ -154,7 +154,6 @@
#include <vcl/rendercontext/SystemTextColorFlags.hxx>
#include <vcl/salgtype.hxx>
#include <vcl/salnativewidgets.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/syswin.hxx>

View file

@ -95,7 +95,7 @@ public:
mRenderState);
exportDevice("test-draw-line.png", mVclDevice);
Bitmap bitmap = mVclDevice->GetBitmap(Point(), mVclDevice->GetOutputSizePixel());
Bitmap::ScopedReadAccess access(bitmap);
BitmapScopedReadAccess access(bitmap);
// Canvas uses AA, which blurs the line, and it cannot be turned off,
// so do not check the end points.
CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_WHITE), access->GetPixel(0, 0));
@ -130,7 +130,7 @@ public:
exportDevice("test-tdf134053.png", mVclDevice);
Bitmap bitmap = mVclDevice->GetBitmap(Point(), mVclDevice->GetOutputSizePixel());
Bitmap::ScopedReadAccess access(bitmap);
BitmapScopedReadAccess access(bitmap);
struct Check
{
tools::Long start;

View file

@ -100,7 +100,7 @@ namespace dxcanvas::tools
{
// first of all, ensure that Bitmap contains a DIB, by
// acquiring a read access
BitmapReadAccess* pReadAcc = rBmp.AcquireReadAccess();
BitmapScopedReadAccess pReadAcc(rBmp);
// TODO(P2): Acquiring a read access can actually
// force a read from VRAM, thus, avoiding this
@ -116,8 +116,6 @@ namespace dxcanvas::tools
return drawDIBits( rGraphics,
aBmpSysData.pDIB );
}
Bitmap::ReleaseAccess( pReadAcc );
}
}
else
@ -156,7 +154,7 @@ namespace dxcanvas::tools
Bitmap aBitmap( rBmpEx.GetBitmap() );
Bitmap::ScopedReadAccess pReadAccess( aBitmap );
BitmapScopedReadAccess pReadAccess( aBitmap );
const sal_Int32 nWidth( aBmpSize.Width() );
const sal_Int32 nHeight( aBmpSize.Height() );
@ -167,7 +165,7 @@ namespace dxcanvas::tools
Bitmap aAlpha( rBmpEx.GetAlphaMask().GetBitmap() );
Bitmap::ScopedReadAccess pAlphaReadAccess( aAlpha );
BitmapScopedReadAccess pAlphaReadAccess( aAlpha );
// By convention, the access buffer always has
// one of the following formats:

View file

@ -971,7 +971,7 @@ namespace vclcanvas
Bitmap aBitmap( rOutDev.GetBitmapEx(aRect.TopLeft(),
aRect.GetSize()).GetBitmap() );
Bitmap::ScopedReadAccess pReadAccess( aBitmap );
BitmapScopedReadAccess pReadAccess( aBitmap );
ENSURE_OR_THROW( pReadAccess.get() != nullptr,
"Could not acquire read access to OutDev bitmap" );

View file

@ -145,7 +145,6 @@
#include <vcl/rendercontext/State.hxx>
#include <vcl/rendercontext/SystemTextColorFlags.hxx>
#include <vcl/salnativewidgets.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/syswin.hxx>

View file

@ -112,7 +112,6 @@
#include <vcl/gfxlink.hxx>
#include <vcl/mapmod.hxx>
#include <vcl/region.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/task.hxx>
#include <vcl/timer.hxx>
#include <vcl/vectorgraphicdata.hxx>

View file

@ -77,7 +77,6 @@
#include <vcl/dllapi.h>
#include <vcl/mapmod.hxx>
#include <vcl/region.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/vclenum.hxx>
#endif // PCH_LEVEL >= 2
#if PCH_LEVEL >= 3

View file

@ -51,7 +51,7 @@ public:
CPPUNIT_TEST_FIXTURE(Test, testFdo77229)
{
Bitmap aBitmap = load("fdo77229.emf");
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
// The green star was missing.
Color aColor(pAccess->GetPixel(284, 280));
CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), aColor.GetRed());

View file

@ -145,7 +145,6 @@
#include <vcl/rendercontext/State.hxx>
#include <vcl/rendercontext/SystemTextColorFlags.hxx>
#include <vcl/salnativewidgets.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/syswin.hxx>

View file

@ -99,7 +99,6 @@
#include <vcl/dllapi.h>
#include <vcl/mapmod.hxx>
#include <vcl/region.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/vclenum.hxx>
#include <vcl/vclptr.hxx>
#endif // PCH_LEVEL >= 2

View file

@ -107,7 +107,6 @@
#include <vcl/font.hxx>
#include <vcl/mapmod.hxx>
#include <vcl/region.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/vclenum.hxx>
#include <vcl/vclptr.hxx>
#endif // PCH_LEVEL >= 2

View file

@ -4221,8 +4221,8 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
BitmapEx aBmpEx = pDevice->GetBitmapEx({ 0, 0 }, { nCanvasWidth, nCanvasHeight });
Bitmap aBmp = aBmpEx.GetBitmap();
AlphaMask aAlpha = aBmpEx.GetAlphaMask();
Bitmap::ScopedReadAccess sraBmp(aBmp);
AlphaMask::ScopedReadAccess sraAlpha(aAlpha);
BitmapScopedReadAccess sraBmp(aBmp);
BitmapScopedReadAccess sraAlpha(aAlpha);
assert(sraBmp->Height() == nCanvasHeight);
assert(sraBmp->Width() == nCanvasWidth);

View file

@ -21,6 +21,7 @@
#include <texture/texture.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/BitmapReadAccess.hxx>
namespace drawinglayer::primitive3d {
class HatchTexturePrimitive3D;
@ -53,9 +54,9 @@ namespace drawinglayer::texture
protected:
BitmapEx maBitmapEx;
Bitmap maBitmap; // Bitmap held within maBitmapEx, to exist during mpReadBitmap scope
Bitmap::ScopedReadAccess mpReadBitmap;
BitmapScopedReadAccess mpReadBitmap;
Bitmap maTransparence;
Bitmap::ScopedReadAccess mpReadTransparence;
BitmapScopedReadAccess mpReadTransparence;
basegfx::B2DPoint maTopLeft;
basegfx::B2DVector maSize;
double mfMulX;

View file

@ -133,7 +133,7 @@ public:
CPPUNIT_ASSERT(renderer->draw());
exportDevice("test-tdf136957", mVclDevice);
Bitmap bitmap = mVclDevice->GetBitmap(Point(), Size(1920, 1080));
Bitmap::ScopedReadAccess access(bitmap);
BitmapScopedReadAccess access(bitmap);
// There should be a dotted line, without the fix it wouldn't be there, so check
// there's a sufficient amount of non-white pixels and that's the line.
int nonWhiteCount = 0;

View file

@ -117,7 +117,7 @@ public:
exportDevice("test-tdf139000.png", device);
Bitmap bitmap = device->GetBitmap(Point(), device->GetOutputSizePixel());
Bitmap::ScopedReadAccess access(bitmap);
BitmapScopedReadAccess access(bitmap);
// The upper half should keep its red background color.
CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_RED), access->GetColor(Point(0, 99)));
// First line of the gradient should not be the start color, but something halfway.

View file

@ -174,8 +174,8 @@ std::vector<sal_uInt8> createBitmapData(const BitmapEx& rBitmapEx)
if (bAlpha)
{
Bitmap aSrcAlpha(rBitmapEx.GetAlphaMask().GetBitmap());
Bitmap::ScopedReadAccess pReadAccess(const_cast<Bitmap&>(rBitmapEx.GetBitmap()));
Bitmap::ScopedReadAccess pAlphaReadAccess(aSrcAlpha.AcquireReadAccess(), aSrcAlpha);
BitmapScopedReadAccess pReadAccess(rBitmapEx.GetBitmap());
BitmapScopedReadAccess pAlphaReadAccess(aSrcAlpha);
const tools::Long nHeight(pReadAccess->Height());
const tools::Long nWidth(pReadAccess->Width());
@ -198,7 +198,7 @@ std::vector<sal_uInt8> createBitmapData(const BitmapEx& rBitmapEx)
}
else
{
Bitmap::ScopedReadAccess pReadAccess(const_cast<Bitmap&>(rBitmapEx.GetBitmap()));
BitmapScopedReadAccess pReadAccess(rBitmapEx.GetBitmap());
const tools::Long nHeight(pReadAccess->Height());
const tools::Long nWidth(pReadAccess->Width());

View file

@ -399,8 +399,8 @@ sal::systools::COMReference<ID2D1Bitmap> createB2DBitmap(const BitmapEx& rBitmap
if (bAlpha)
{
Bitmap aSrcAlpha(rBitmapEx.GetAlphaMask().GetBitmap());
Bitmap::ScopedReadAccess pReadAccess(const_cast<Bitmap&>(rBitmapEx.GetBitmap()));
Bitmap::ScopedReadAccess pAlphaReadAccess(aSrcAlpha.AcquireReadAccess(), aSrcAlpha);
BitmapScopedReadAccess pReadAccess(rBitmapEx.GetBitmap());
BitmapScopedReadAccess pAlphaReadAccess(aSrcAlpha);
const tools::Long nHeight(pReadAccess->Height());
const tools::Long nWidth(pReadAccess->Width());
@ -421,7 +421,7 @@ sal::systools::COMReference<ID2D1Bitmap> createB2DBitmap(const BitmapEx& rBitmap
}
else
{
Bitmap::ScopedReadAccess pReadAccess(const_cast<Bitmap&>(rBitmapEx.GetBitmap()));
BitmapScopedReadAccess pReadAccess(const_cast<Bitmap&>(rBitmapEx.GetBitmap()));
const tools::Long nHeight(pReadAccess->Height());
const tools::Long nWidth(pReadAccess->Width());
@ -1076,7 +1076,7 @@ sal::systools::COMReference<ID2D1Bitmap> D2DPixelProcessor2D::implCreateAlpha_B2
std::unique_ptr<sal_uInt8[]> aData(new sal_uInt8[nPixelCount]);
sal_uInt8* pTarget = aData.get();
Bitmap aSrcAlpha(aAlpha.GetBitmap());
Bitmap::ScopedReadAccess pReadAccess(aSrcAlpha.AcquireReadAccess(), aSrcAlpha);
BitmapScopedReadAccess pReadAccess(aSrcAlpha);
const tools::Long nHeight(pReadAccess->Height());
const tools::Long nWidth(pReadAccess->Width());

View file

@ -76,11 +76,11 @@ namespace drawinglayer::texture
if(mbIsAlpha)
{
maTransparence = rBitmapEx.GetAlphaMask().GetBitmap();
mpReadTransparence = Bitmap::ScopedReadAccess(maTransparence);
mpReadTransparence = maTransparence;
}
if (!maBitmap.IsEmpty())
mpReadBitmap = Bitmap::ScopedReadAccess(maBitmap);
mpReadBitmap = maBitmap;
SAL_WARN_IF(!mpReadBitmap, "drawinglayer", "GeoTexSvxBitmapEx: Got no read access to Bitmap");
if (mpReadBitmap)
{

View file

@ -114,7 +114,6 @@
#include <vcl/mapmod.hxx>
#include <vcl/outdev.hxx>
#include <vcl/region.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/task.hxx>

View file

@ -1003,7 +1003,7 @@ namespace emfio
SAL_WARN( "emfio", "\tTODO Read DIB failed. Interrupting processing whole image. Please report bug report." );
if ( !aBmp.IsEmpty() )
{
Bitmap::ScopedReadAccess pBmp(aBmp);
BitmapScopedReadAccess pBmp(aBmp);
for ( tools::Long y = 0; y < pBmp->Height(); y++ )
{
for ( tools::Long x = 0; x < pBmp->Width(); x++ )

View file

@ -1430,7 +1430,7 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
// Create a bitmap for the pattern with expected colors
vcl::bitmap::RawBitmap aResult(Size(8, 8), 24);
{
Bitmap::ScopedReadAccess pRead(aBmp);
BitmapScopedReadAccess pRead(aBmp);
for (tools::Long y = 0; y < aResult.Height(); ++y)
{

View file

@ -5654,7 +5654,7 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, T
if ( aSize.Height() > 64 )
aSize.setHeight( 64 );
Bitmap::ScopedReadAccess pAcc(aBmp);
BitmapScopedReadAccess pAcc(aBmp);
if( pAcc )
{
sal_uLong nRt = 0, nGn = 0, nBl = 0;

View file

@ -361,13 +361,15 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic )
{
BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
Bitmap aBmp( aBmpEx.GetBitmap() );
BitmapReadAccess* pBmpAcc = aBmp.AcquireReadAccess();
BitmapScopedReadAccess pBmpAcc(aBmp);
if( !pBmpAcc )
return;
AlphaMask aMask( aBmpEx.GetAlphaMask() );
BitmapReadAccess* pMskAcc = !aMask.IsEmpty() ? aMask.AcquireReadAccess() : nullptr;
BitmapScopedReadAccess pMskAcc;
if (!aMask.IsEmpty())
pMskAcc = aMask;
const tools::Long nWidth = pBmpAcc->Width();
const tools::Long nHeight = pBmpAcc->Height();
const tools::Long nStartX = 0;
@ -381,7 +383,7 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic )
{
aMask = AlphaMask(aBmp.GetSizePixel());
aMask.Erase( 0 );
pMskAcc = aMask.AcquireReadAccess();
pMskAcc = aMask;
}
// create temporary list to hold interfaces
@ -464,9 +466,6 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic )
for (auto const& elem : aTmp)
elem->setPixelsByLongs( nStartX, nStartY, nPartWidth, nPartHeight, aData, 0UL, nPartWidth );
}
Bitmap::ReleaseAccess( pBmpAcc );
Bitmap::ReleaseAccess( pMskAcc );
}

View file

@ -109,7 +109,6 @@
#include <vcl/mapmod.hxx>
#include <vcl/region.hxx>
#include <vcl/rendercontext/RasterOp.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/task.hxx>

View file

@ -16,9 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_VCL_BITMAPINFOACCESS_HXX
#define INCLUDED_VCL_BITMAPINFOACCESS_HXX
#pragma once
#include <vcl/dllapi.h>
#include <vcl/bitmap.hxx>
@ -38,10 +36,13 @@ class VCL_DLLPUBLIC BitmapInfoAccess
friend class BitmapReadAccess;
public:
BitmapInfoAccess(Bitmap& rBitmap, BitmapAccessMode nMode = BitmapAccessMode::Info);
BitmapInfoAccess(const Bitmap& rBitmap, BitmapAccessMode nMode = BitmapAccessMode::Info);
BitmapInfoAccess(const AlphaMask& rBitmap, BitmapAccessMode nMode = BitmapAccessMode::Info);
virtual ~BitmapInfoAccess();
bool operator!() const { return mpBuffer == nullptr; }
explicit operator bool() const { return mpBuffer != nullptr; }
tools::Long Width() const { return mpBuffer ? mpBuffer->mnWidth : 0L; }
@ -152,6 +153,47 @@ protected:
BitmapAccessMode mnAccessMode;
};
#endif // INCLUDED_VCL_BITMAPINFOACCESS_HXX
class BitmapScopedInfoAccess
{
public:
BitmapScopedInfoAccess(const Bitmap& rBitmap)
: moAccess(rBitmap)
{
}
BitmapScopedInfoAccess(const AlphaMask& rBitmap)
: moAccess(rBitmap)
{
}
BitmapScopedInfoAccess() {}
BitmapScopedInfoAccess& operator=(const Bitmap& rBitmap)
{
moAccess.emplace(rBitmap);
return *this;
}
BitmapScopedInfoAccess& operator=(const AlphaMask& rBitmap)
{
moAccess.emplace(rBitmap);
return *this;
}
bool operator!() const { return !moAccess.has_value() || !*moAccess; }
explicit operator bool() const { return moAccess && bool(*moAccess); }
void reset() { moAccess.reset(); }
BitmapInfoAccess* get() { return moAccess ? &*moAccess : nullptr; }
const BitmapInfoAccess* get() const { return moAccess ? &*moAccess : nullptr; }
BitmapInfoAccess* operator->() { return &*moAccess; }
const BitmapInfoAccess* operator->() const { return &*moAccess; }
BitmapInfoAccess& operator*() { return *moAccess; }
const BitmapInfoAccess& operator*() const { return *moAccess; }
private:
std::optional<BitmapInfoAccess> moAccess;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -16,9 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_VCL_BITMAPREADACCESS_HXX
#define INCLUDED_VCL_BITMAPREADACCESS_HXX
#pragma once
#include <vcl/dllapi.h>
#include <vcl/bitmap.hxx>
@ -33,7 +31,9 @@ class SAL_DLLPUBLIC_RTTI BitmapReadAccess : public BitmapInfoAccess
friend class BitmapWriteAccess;
public:
VCL_DLLPUBLIC BitmapReadAccess(Bitmap& rBitmap,
VCL_DLLPUBLIC BitmapReadAccess(const Bitmap& rBitmap,
BitmapAccessMode nMode = BitmapAccessMode::Read);
VCL_DLLPUBLIC BitmapReadAccess(const AlphaMask& rBitmap,
BitmapAccessMode nMode = BitmapAccessMode::Read);
VCL_DLLPUBLIC virtual ~BitmapReadAccess() override;
@ -189,6 +189,47 @@ public:
static FncSetPixel SetPixelFunction(ScanlineFormat nFormat);
};
#endif // INCLUDED_VCL_BITMAPREADACCESS_HXX
class BitmapScopedReadAccess
{
public:
BitmapScopedReadAccess(const Bitmap& rBitmap)
: moAccess(rBitmap)
{
}
BitmapScopedReadAccess(const AlphaMask& rBitmap)
: moAccess(rBitmap)
{
}
BitmapScopedReadAccess() {}
BitmapScopedReadAccess& operator=(const Bitmap& rBitmap)
{
moAccess.emplace(rBitmap);
return *this;
}
BitmapScopedReadAccess& operator=(const AlphaMask& rBitmap)
{
moAccess.emplace(rBitmap);
return *this;
}
bool operator!() const { return !moAccess.has_value() || !*moAccess; }
explicit operator bool() const { return moAccess && bool(*moAccess); }
void reset() { moAccess.reset(); }
BitmapReadAccess* get() { return moAccess ? &*moAccess : nullptr; }
const BitmapReadAccess* get() const { return moAccess ? &*moAccess : nullptr; }
BitmapReadAccess* operator->() { return &*moAccess; }
const BitmapReadAccess* operator->() const { return &*moAccess; }
BitmapReadAccess& operator*() { return *moAccess; }
const BitmapReadAccess& operator*() const { return *moAccess; }
private:
std::optional<BitmapReadAccess> moAccess;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -7,25 +7,18 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
#ifndef INCLUDED_VCL_INC_BITMAP_BITMAPWRITEACCESS_HXX
#define INCLUDED_VCL_INC_BITMAP_BITMAPWRITEACCESS_HXX
#pragma once
#include <vcl/alpha.hxx>
#include <vcl/bitmap.hxx>
#include <vcl/BitmapReadAccess.hxx>
#include <optional>
typedef vcl::ScopedBitmapAccess<BitmapWriteAccess, Bitmap, &Bitmap::AcquireWriteAccess>
BitmapScopedWriteAccess;
typedef vcl::ScopedBitmapAccess<BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireAlphaWriteAccess>
AlphaScopedWriteAccess;
class VCL_DLLPUBLIC BitmapWriteAccess final : public BitmapReadAccess
{
public:
BitmapWriteAccess(Bitmap& rBitmap);
BitmapWriteAccess(AlphaMask& rBitmap);
virtual ~BitmapWriteAccess() override;
void CopyScanline(tools::Long nY, const BitmapReadAccess& rReadAcc);
@ -89,6 +82,47 @@ private:
BitmapWriteAccess& operator=(const BitmapWriteAccess&) = delete;
};
#endif
class BitmapScopedWriteAccess
{
public:
BitmapScopedWriteAccess(Bitmap& rBitmap)
: moAccess(rBitmap)
{
}
BitmapScopedWriteAccess(AlphaMask& rBitmap)
: moAccess(rBitmap)
{
}
BitmapScopedWriteAccess() {}
BitmapScopedWriteAccess& operator=(Bitmap& rBitmap)
{
moAccess.emplace(rBitmap);
return *this;
}
BitmapScopedWriteAccess& operator=(AlphaMask& rBitmap)
{
moAccess.emplace(rBitmap);
return *this;
}
bool operator!() const { return !moAccess.has_value() || !*moAccess; }
explicit operator bool() const { return moAccess && bool(*moAccess); }
void reset() { moAccess.reset(); }
BitmapWriteAccess* get() { return moAccess ? &*moAccess : nullptr; }
const BitmapWriteAccess* get() const { return moAccess ? &*moAccess : nullptr; }
BitmapWriteAccess* operator->() { return &*moAccess; }
const BitmapWriteAccess* operator->() const { return &*moAccess; }
BitmapWriteAccess& operator*() { return *moAccess; }
const BitmapWriteAccess& operator*() const { return *moAccess; }
private:
std::optional<BitmapWriteAccess> moAccess;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -62,13 +62,6 @@ public:
// check if alpha is used, returns true if at least one pixel has transparence
bool hasAlpha() const;
BitmapReadAccess* AcquireAlphaReadAccess() { return maBitmap.AcquireReadAccess(); }
BitmapWriteAccess* AcquireAlphaWriteAccess() { return maBitmap.AcquireWriteAccess(); }
static void ReleaseAccess( BitmapInfoAccess* pBitmapAccess ) { Bitmap::ReleaseAccess(pBitmapAccess); }
typedef vcl::ScopedBitmapAccess<BitmapReadAccess, AlphaMask, &AlphaMask::AcquireAlphaReadAccess> ScopedReadAccess;
typedef vcl::ScopedBitmapAccess<BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireAlphaWriteAccess> ScopedWriteAccess;
bool IsEmpty() const { return maBitmap.IsEmpty(); }
void SetEmpty() { maBitmap.SetEmpty(); }
@ -83,8 +76,6 @@ public:
void SetPrefMapMode( const MapMode& rMapMode ) { maBitmap.SetPrefMapMode(rMapMode); }
BitmapReadAccess* AcquireReadAccess() { return maBitmap.AcquireReadAccess(); }
BitmapChecksum GetChecksum() const { return maBitmap.GetChecksum(); }
bool Invert();

View file

@ -26,7 +26,6 @@
#include <vcl/dllapi.h>
#include <vcl/mapmod.hxx>
#include <vcl/region.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/bitmap/BitmapTypes.hxx>
#include <o3tl/typed_flags_set.hxx>
@ -605,16 +604,6 @@ public:
SAL_DLLPRIVATE bool ImplMakeGreyscales();
public:
BitmapInfoAccess* AcquireInfoAccess();
BitmapReadAccess* AcquireReadAccess();
BitmapWriteAccess* AcquireWriteAccess();
static void ReleaseAccess( BitmapInfoAccess* pAccess );
typedef vcl::ScopedBitmapAccess<BitmapReadAccess, Bitmap, &Bitmap::AcquireReadAccess> ScopedReadAccess;
typedef vcl::ScopedBitmapAccess<BitmapInfoAccess, Bitmap, &Bitmap::AcquireInfoAccess> ScopedInfoAccess;
private:
SAL_DLLPRIVATE bool ImplConvertUp(vcl::PixelFormat ePixelFormat, Color const* pExtColor = nullptr);
SAL_DLLPRIVATE bool ImplConvertDown8BPP(Color const* pExtColor = nullptr);

View file

@ -1,123 +0,0 @@
/* -*- 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/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_VCL_SCOPEDBITMAPACCESS_HXX
#define INCLUDED_VCL_SCOPEDBITMAPACCESS_HXX
#include <sal/types.h>
namespace vcl
{
/** This template handles BitmapAccess the RAII way.
Please don't use directly, but through the ready-made typedefs
ScopedReadAccess and ScopedWriteAccess in classes Bitmap and
AlphaMask.
Use as follows:
Bitmap aBitmap;
Bitmap::ScopedReadAccess pReadAccess( aBitmap );
pReadAccess->SetPixel()...
Bitmap aBitmap2;
BitmapScopedWriteAccess pWriteAccess( bCond ? aBitmap2.AcquireWriteAccess() : 0, aBitmap2 );
if ( pWriteAccess )...
@attention for practical reasons, ScopedBitmapAccess stores a
reference to the provided bitmap, thus, make sure that the bitmap
specified at construction time lives at least as long as the
ScopedBitmapAccess.
*/
template < class Access, class Bitmap, Access* (Bitmap::* Acquire)() > class ScopedBitmapAccess
{
public:
explicit ScopedBitmapAccess( Bitmap& rBitmap ) :
mpAccess( nullptr ),
mpBitmap( &rBitmap )
{
mpAccess = (mpBitmap->*Acquire)();
}
ScopedBitmapAccess( Access* pAccess, Bitmap& rBitmap ) :
mpAccess( pAccess ),
mpBitmap( &rBitmap )
{
}
ScopedBitmapAccess( ) :
mpAccess( nullptr ),
mpBitmap( nullptr )
{
}
// Move semantics
ScopedBitmapAccess &operator=(ScopedBitmapAccess&&other)
{
mpAccess=other.mpAccess;
mpBitmap=other.mpBitmap;
other.mpAccess = nullptr;
other.mpBitmap = nullptr;
return *this;
}
// Disable copy from lvalue.
ScopedBitmapAccess(const ScopedBitmapAccess&) = delete;
ScopedBitmapAccess &operator=(const ScopedBitmapAccess&) = delete;
~ScopedBitmapAccess() COVERITY_NOEXCEPT_FALSE
{
if (mpAccess)
mpBitmap->ReleaseAccess( mpAccess );
}
void reset()
{
if (mpAccess)
{
mpBitmap->ReleaseAccess( mpAccess );
mpAccess = nullptr;
}
}
bool operator!() const { return !mpAccess; }
explicit operator bool() const
{
return mpAccess;
}
Access* get() { return mpAccess; }
const Access* get() const { return mpAccess; }
Access* operator->() { return mpAccess; }
const Access* operator->() const { return mpAccess; }
Access& operator*() { return *mpAccess; }
const Access& operator*() const { return *mpAccess; }
private:
Access* mpAccess;
Bitmap* mpBitmap;
};
}
#endif // INCLUDED_VCL_SCOPEDBITMAPACCESS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -131,7 +131,6 @@
#include <vcl/rendercontext/State.hxx>
#include <vcl/rendercontext/SystemTextColorFlags.hxx>
#include <vcl/salnativewidgets.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/task.hxx>
#include <vcl/timer.hxx>

View file

@ -149,7 +149,6 @@
#include <vcl/rendercontext/State.hxx>
#include <vcl/rendercontext/SystemTextColorFlags.hxx>
#include <vcl/salnativewidgets.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/task.hxx>

View file

@ -143,7 +143,6 @@
#include <vcl/mapmod.hxx>
#include <vcl/outdev.hxx>
#include <vcl/region.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/syswin.hxx>

View file

@ -396,7 +396,7 @@ void XclExpImgData::Save( XclExpStream& rStrm )
if (aBmp.getPixelFormat() != vcl::PixelFormat::N24_BPP)
aBmp.Convert( BmpConversion::N24Bit );
Bitmap::ScopedReadAccess pAccess(aBmp);
BitmapScopedReadAccess pAccess(aBmp);
if( !pAccess )
return;

View file

@ -158,7 +158,6 @@
#include <vcl/rendercontext/SystemTextColorFlags.hxx>
#include <vcl/salgtype.hxx>
#include <vcl/salnativewidgets.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/scrollable.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>

View file

@ -75,7 +75,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf105998)
// use assertColorsAreSimilar since the color might differ a little bit on mac
Bitmap aBMP = aBMPEx.GetBitmap();
{
Bitmap::ScopedReadAccess pReadAccess(aBMP);
BitmapScopedReadAccess pReadAccess(aBMP);
for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
{
const Color aColorTop = pReadAccess->GetColor(0, nX);
@ -135,7 +135,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf126319)
// Check all borders are red or similar. Ignore the corners
Bitmap aBMP = aBMPEx.GetBitmap();
{
Bitmap::ScopedReadAccess pReadAccess(aBMP);
BitmapScopedReadAccess pReadAccess(aBMP);
for (tools::Long nX = 2; nX < aSize.Width() - 2; ++nX)
{
const Color aColorTop = pReadAccess->GetColor(0, nX);
@ -195,7 +195,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf136632)
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
AlphaMask aAlpha = aBMPEx.GetAlphaMask();
AlphaMask::ScopedReadAccess pReadAccess(aAlpha);
BitmapScopedReadAccess pReadAccess(aAlpha);
// Without the fix in place, this test would have failed here
CPPUNIT_ASSERT(!pReadAccess);
@ -234,7 +234,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157652)
Size aSize = aBMPEx.GetSizePixel();
CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize);
Bitmap aBMP = aBMPEx.GetBitmap();
Bitmap::ScopedReadAccess pReadAccess(aBMP);
BitmapScopedReadAccess pReadAccess(aBMP);
for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
{
for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY)
@ -282,7 +282,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf156808)
Size aSize = aBMPEx.GetSizePixel();
CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize);
Bitmap aBMP = aBMPEx.GetBitmap();
Bitmap::ScopedReadAccess pReadAccess(aBMP);
BitmapScopedReadAccess pReadAccess(aBMP);
int nBlackCount = 0;
for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
{
@ -334,7 +334,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157795)
Size aSize = aBMPEx.GetSizePixel();
CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize);
Bitmap aBMP = aBMPEx.GetBitmap();
Bitmap::ScopedReadAccess pReadAccess(aBMP);
BitmapScopedReadAccess pReadAccess(aBMP);
for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
{
for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY)
@ -383,7 +383,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf105362)
Size aSize = aBMPEx.GetSizePixel();
CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize);
Bitmap aBMP = aBMPEx.GetBitmap();
Bitmap::ScopedReadAccess pReadAccess(aBMP);
BitmapScopedReadAccess pReadAccess(aBMP);
for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
{
for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY)
@ -431,7 +431,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157636)
Size aSize = aBMPEx.GetSizePixel();
CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize);
Bitmap aBMP = aBMPEx.GetBitmap();
Bitmap::ScopedReadAccess pReadAccess(aBMP);
BitmapScopedReadAccess pReadAccess(aBMP);
int nBlackCount = 0;
for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
{
@ -482,7 +482,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157793)
Size aSize = aBMPEx.GetSizePixel();
CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize);
Bitmap aBMP = aBMPEx.GetBitmap();
Bitmap::ScopedReadAccess pReadAccess(aBMP);
BitmapScopedReadAccess pReadAccess(aBMP);
int nLightGrayCount = 0;
for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
{
@ -533,7 +533,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf157635)
Size aSize = aBMPEx.GetSizePixel();
CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize);
Bitmap aBMP = aBMPEx.GetBitmap();
Bitmap::ScopedReadAccess pReadAccess(aBMP);
BitmapScopedReadAccess pReadAccess(aBMP);
int nBlackCount = 0;
for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
{
@ -585,7 +585,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113163)
CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize);
Bitmap aBMP = aBMPEx.GetBitmap();
{
Bitmap::ScopedReadAccess pReadAccess(aBMP);
BitmapScopedReadAccess pReadAccess(aBMP);
for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
{
for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY)
@ -635,7 +635,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf147119)
CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize);
AlphaMask aAlpha = aBMPEx.GetAlphaMask();
{
AlphaMask::ScopedReadAccess pReadAccess(aAlpha);
BitmapScopedReadAccess pReadAccess(aAlpha);
for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
{
for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY)
@ -684,7 +684,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113197)
CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize);
Bitmap aBMP = aBMPEx.GetBitmap();
{
Bitmap::ScopedReadAccess pReadAccess(aBMP);
BitmapScopedReadAccess pReadAccess(aBMP);
for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
{
// Check the bottom half of the document is white
@ -734,7 +734,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf93124)
CPPUNIT_ASSERT_EQUAL(Size(320, 180), aBMPEx.GetSizePixel());
Bitmap aBMP = aBMPEx.GetBitmap();
{
Bitmap::ScopedReadAccess pReadAccess(aBMP);
BitmapScopedReadAccess pReadAccess(aBMP);
int nNonWhiteCount = 0;
// The word "Top" should be in rectangle 34,4 - 76,30. If text alignment is wrong, the rectangle will be white.
for (tools::Long nY = 4; nY < (4 + 26); ++nY)
@ -789,7 +789,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf99729)
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
Bitmap aBMP = aBMPEx.GetBitmap();
Bitmap::ScopedReadAccess pRead(aBMP);
BitmapScopedReadAccess pRead(aBMP);
for (tools::Long nX = 154; nX < (154 + 12); ++nX)
{
for (tools::Long nY = 16; nY < (16 + 96); ++nY)

View file

@ -647,7 +647,7 @@ bool checkPatternValues(std::vector<sal_uInt8>& rExpected, Bitmap& rBitmap)
const Color aFGColor(0xFF0000);
const Color aBGColor(0xFFFFFF);
Bitmap::ScopedReadAccess pAccess(rBitmap);
BitmapScopedReadAccess pAccess(rBitmap);
for (tools::Long y = 0; y < pAccess->Height(); ++y)
{
Scanline pScanline = pAccess->GetScanline(y);

View file

@ -2431,7 +2431,7 @@ static void assertTilePixelColor(SdXImpressDocument* pXImpressDocument, int nPix
pXImpressDocument->paintTile(*pDevice, nCanvasSize, nCanvasSize, 0, 0, 15360, 7680);
pDevice->EnableMapMode(false);
Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize));
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
Color aActualColor(pAccess->GetPixel(nPixelX, nPixelY));
CPPUNIT_ASSERT_EQUAL(aColor, aActualColor);
}

View file

@ -143,7 +143,7 @@ void SdVectorizeDlg::Calculate( Bitmap const & rBmp, GDIMetaFile& rMtf )
if (m_xCbFillHoles->get_active())
{
GDIMetaFile aNewMtf;
Bitmap::ScopedReadAccess pRAcc(aTmp);
BitmapScopedReadAccess pRAcc(aTmp);
if( pRAcc )
{

View file

@ -130,7 +130,6 @@
#include <vcl/rendercontext/State.hxx>
#include <vcl/rendercontext/SystemTextColorFlags.hxx>
#include <vcl/salnativewidgets.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/task.hxx>
#include <vcl/timer.hxx>

View file

@ -6335,7 +6335,6 @@ include/vcl/salctype.hxx
include/vcl/salgtype.hxx
include/vcl/salnativewidgets.hxx
include/vcl/scheduler.hxx
include/vcl/scopedbitmapaccess.hxx
include/vcl/seleng.hxx
include/vcl/settings.hxx
include/vcl/split.hxx

View file

@ -125,7 +125,6 @@
#include <vcl/ptrstyle.hxx>
#include <vcl/region.hxx>
#include <vcl/rendercontext/RasterOp.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/syswin.hxx>

View file

@ -137,7 +137,6 @@
#include <vcl/outdev.hxx>
#include <vcl/ptrstyle.hxx>
#include <vcl/region.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/syswin.hxx>

View file

@ -189,7 +189,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_NonUI)
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
Bitmap aBMP = aBMPEx.GetBitmap();
Bitmap::ScopedReadAccess pRead(aBMP);
BitmapScopedReadAccess pRead(aBMP);
Size aSize = aBMP.GetSizePixel();
// GetColor(Y,X)
Color aActualColor = pRead->GetColor(aSize.Height() / 2, aSize.Width() * 0.125);
@ -225,7 +225,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_FrontLightDim)
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
Bitmap aBMP = aBMPEx.GetBitmap();
Bitmap::ScopedReadAccess pRead(aBMP);
BitmapScopedReadAccess pRead(aBMP);
Size aSize = aBMP.GetSizePixel();
// GetColor(Y,X)
Color aActualColor = pRead->GetColor(aSize.Height() / 2, aSize.Width() * 0.4);
@ -252,7 +252,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_FirstLightHarsh)
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
Bitmap aBMP = aBMPEx.GetBitmap();
Bitmap::ScopedReadAccess pRead(aBMP);
BitmapScopedReadAccess pRead(aBMP);
Size aSize = aBMP.GetSizePixel();
// GetColor(Y,X)
const Color aActualColor = pRead->GetColor(aSize.Height() / 2, aSize.Width() / 2);
@ -1221,7 +1221,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf148501_OctagonBevel)
vcl::PngImageReader aPNGReader(aFileStream);
BitmapEx aBMPEx = aPNGReader.read();
Bitmap aBMP = aBMPEx.GetBitmap();
Bitmap::ScopedReadAccess pRead(aBMP);
BitmapScopedReadAccess pRead(aBMP);
Size aSize = aBMP.GetSizePixel();
// GetColor(Y,X). The chosen threshold for the ColorDistance can be adapted if necessary.

View file

@ -278,7 +278,7 @@ std::optional<Color> GetDraftFillColor(const SfxItemSet& rSet)
if (nWidth <= 0 || nHeight <= 0)
return {};
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
if (pAccess)
{

View file

@ -156,7 +156,6 @@
#include <vcl/rendercontext/State.hxx>
#include <vcl/rendercontext/SystemTextColorFlags.hxx>
#include <vcl/salnativewidgets.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/task.hxx>

View file

@ -154,7 +154,6 @@
#include <vcl/rendercontext/SystemTextColorFlags.hxx>
#include <vcl/salgtype.hxx>
#include <vcl/salnativewidgets.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/syswin.hxx>

View file

@ -136,7 +136,6 @@
#include <vcl/rendercontext/State.hxx>
#include <vcl/rendercontext/SystemTextColorFlags.hxx>
#include <vcl/salnativewidgets.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/task.hxx>

View file

@ -1159,7 +1159,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156078)
Graphic exported;
GraphicFilter::LoadGraphic(maTempFile.GetURL(), {}, exported);
Bitmap bmp = exported.GetBitmapEx().GetBitmap();
Bitmap::ScopedReadAccess pAccess(bmp);
BitmapScopedReadAccess pAccess(bmp);
// "1" must export to the top right corner; check its pixels
bool numberPixelsFound = false;

View file

@ -1739,7 +1739,7 @@ static void assertTilePixelColor(SwXTextDocument* pXTextDocument, int nPixelX, i
pXTextDocument->paintTile(*pDevice, nCanvasSize, nCanvasSize, 0, 0, 15360, 7680);
pDevice->EnableMapMode(false);
Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize));
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
Color aActualColor(pAccess->GetPixel(nPixelX, nPixelY));
CPPUNIT_ASSERT_EQUAL(aColor, aActualColor);
}
@ -2843,7 +2843,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testSemiTransparent)
/*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680);
pDevice->EnableMapMode(false);
Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize));
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
Color aColor(pAccess->GetPixel(255, 255));
// Without the accompanying fix in place, this test would have failed with 'Expected greater or
@ -2872,7 +2872,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testHighlightNumbering)
/*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680);
pDevice->EnableMapMode(false);
Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize));
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
// Yellow highlighting over numbering
Color aColor(pAccess->GetPixel(103, 148));
@ -2897,7 +2897,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testHighlightNumbering_shd)
/*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680);
pDevice->EnableMapMode(false);
Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize));
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
// No highlighting over numbering - w:shd does not apply to numbering.
Color aColor(pAccess->GetPixel(103, 148));
@ -2927,7 +2927,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testPilcrowRedlining)
/*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680);
pDevice->EnableMapMode(false);
Bitmap aBitmap = pDevice->GetBitmap(Point(100, 100), Size(nTileSize, nTileSize));
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
const char* aTexts[] = {
"Insert paragraph break",
@ -3008,7 +3008,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testDoubleUnderlineAndStrikeOut)
/*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680);
pDevice->EnableMapMode(false);
Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize));
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
bool bGreenLine = false;
size_t nGreenLine = 0;
// count green horizontal lines by tracking a column of pixels counting the
@ -3054,7 +3054,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testTdf43244_SpacesOnMargin)
/*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680);
pDevice->EnableMapMode(false);
Bitmap aBitmap = pDevice->GetBitmap(Point(730, 120), Size(nTileSize, nTileSize));
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
//Test if we see any spaces on the right margin in a 47x48 rectangle
bool bSpaceFound = false;
@ -3097,7 +3097,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testClipText)
/*nTilePosY=*/0, /*nTileWidth=*/15360, /*nTileHeight=*/7680);
pDevice->EnableMapMode(false);
Bitmap aBitmap = pDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize));
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
// check top margin, it's not white completely (i.e. showing top of letter "T")
bool bClipTop = true;

View file

@ -106,7 +106,6 @@
#include <vcl/rendercontext/State.hxx>
#include <vcl/rendercontext/SystemTextColorFlags.hxx>
#include <vcl/salnativewidgets.hxx>
#include <vcl/scopedbitmapaccess.hxx>
#include <vcl/settings.hxx>
#include <vcl/vclenum.hxx>
#include <vcl/vclptr.hxx>

View file

@ -11,7 +11,7 @@
#include <test/outputdevice.hxx>
#include <vcl/bitmapex.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
namespace vcl::test {
@ -104,7 +104,7 @@ Bitmap OutputDeviceTestBitmap::setupDrawBitmapExWithAlpha(vcl::PixelFormat aBitm
AlphaMask aAlpha(aBitmapSize);
{
AlphaScopedWriteAccess aWriteAccess(aAlpha);
BitmapScopedWriteAccess aWriteAccess(aAlpha);
aWriteAccess->Erase(COL_ALPHA_TRANSPARENT);
aWriteAccess->SetLineColor(Color(0xBB, 0xBB, 0xBB));
aWriteAccess->DrawRect(tools::Rectangle(0, 0, 8, 8));
@ -153,7 +153,7 @@ BitmapEx OutputDeviceTestBitmap::setupDrawBlend(vcl::PixelFormat aBitmapFormat)
AlphaMask aAlpha(aBitmapSize);
{
AlphaScopedWriteAccess aWriteAccess(aAlpha);
BitmapScopedWriteAccess aWriteAccess(aAlpha);
aWriteAccess->Erase(COL_ALPHA_TRANSPARENT);
aWriteAccess->SetLineColor(Color(0xBB, 0xBB, 0xBB));
aWriteAccess->DrawRect(tools::Rectangle(0, 0, 8, 8));

View file

@ -10,7 +10,7 @@
#include <test/outputdevice.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <salgdi.hxx>
#include <map>

View file

@ -26,6 +26,7 @@
#include <com/sun/star/rendering/XBitmapPalette.hpp>
#include <vcl/bitmapex.hxx>
#include <vcl/BitmapReadAccess.hxx>
namespace vcl::unotools
{
@ -38,10 +39,10 @@ namespace vcl::unotools
BitmapEx m_aBmpEx;
::Bitmap m_aBitmap;
::Bitmap m_aAlpha;
Bitmap::ScopedInfoAccess m_pBmpAcc;
Bitmap::ScopedInfoAccess m_pAlphaAcc;
std::optional<Bitmap::ScopedReadAccess> m_pBmpReadAcc;
std::optional<Bitmap::ScopedReadAccess> m_pAlphaReadAcc;
BitmapScopedInfoAccess m_pBmpAcc;
BitmapScopedInfoAccess m_pAlphaAcc;
std::optional<BitmapScopedReadAccess> m_pBmpReadAcc;
std::optional<BitmapScopedReadAccess> m_pAlphaReadAcc;
css::uno::Sequence<sal_Int8> m_aComponentTags;
css::uno::Sequence<sal_Int32> m_aComponentBitCounts;
css::rendering::IntegerBitmapLayout m_aLayout;
@ -55,8 +56,8 @@ namespace vcl::unotools
bool m_bPalette;
SAL_DLLPRIVATE void setComponentInfo( sal_uInt32 redShift, sal_uInt32 greenShift, sal_uInt32 blueShift );
Bitmap::ScopedReadAccess& getBitmapReadAccess();
Bitmap::ScopedReadAccess& getAlphaReadAccess();
BitmapScopedReadAccess& getBitmapReadAccess();
BitmapScopedReadAccess& getAlphaReadAccess();
virtual ~VclCanvasBitmap() override;

View file

@ -145,7 +145,7 @@
#include <basegfx/vector/b2enums.hxx>
#include <basegfx/vector/b2isize.hxx>
#include <basegfx/vector/b2ivector.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/datatransfer/XTransferable2.hpp>

View file

@ -14,7 +14,7 @@
#include <tools/stream.hxx>
#include <vcl/graphicfilter.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <svdata.hxx>
#include <salinst.hxx>
@ -1180,9 +1180,9 @@ public:
// as the alpha mask.
device->Erase();
alpha.Erase(255); // transparent
BitmapWriteAccess* alphaWrite = alpha.AcquireAlphaWriteAccess();
BitmapScopedWriteAccess alphaWrite(alpha);
alphaWrite->SetPixelIndex(0, 0, 255); // opaque
Bitmap::ReleaseAccess(alphaWrite);
alphaWrite.reset();
device->DrawBitmapEx(Point(2, 2), BitmapEx(bitmap, alpha));
exportDevice("blend_extended_04.png", device);
CPPUNIT_ASSERT_EQUAL(COL_BLUE, device->GetPixel(Point(2, 2)));

View file

@ -13,7 +13,7 @@
#include <vcl/bitmapex.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <svdata.hxx>
#include <salinst.hxx>
@ -47,7 +47,7 @@ void BitmapExTest::testGetPixelColor24_8()
}
AlphaMask aMask(Size(3, 3));
{
AlphaScopedWriteAccess pWriteAccess(aMask);
BitmapScopedWriteAccess pWriteAccess(aMask);
pWriteAccess->Erase(Color(ColorTransparency, 0x00, 0xAA, 0xAA, 0xAA));
}
@ -95,7 +95,7 @@ void BitmapExTest::testTransformBitmapEx()
aMatrix.rotate(M_PI / 2);
BitmapEx aTransformed = aBitmapEx.TransformBitmapEx(16, 16, aMatrix);
aBitmap = aTransformed.GetBitmap();
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
for (int i = 0; i < 16; ++i)
{
for (int j = 0; j < 16; ++j)
@ -126,49 +126,49 @@ void BitmapExTest::testAlphaBlendWith()
bitmap.Erase(64);
alpha.BlendWith(bitmap);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 112),
AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0));
BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0));
alpha.Erase(12);
bitmap.Erase(64);
alpha.BlendWith(bitmap);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 73),
AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0));
BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0));
alpha.Erase(12);
bitmap.Erase(12);
alpha.BlendWith(bitmap);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 24),
AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0));
BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0));
alpha.Erase(127);
bitmap.Erase(13);
alpha.BlendWith(bitmap);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 134),
AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0));
BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0));
alpha.Erase(255);
bitmap.Erase(255);
alpha.BlendWith(bitmap);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 255),
AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0));
BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0));
alpha.Erase(0);
bitmap.Erase(255);
alpha.BlendWith(bitmap);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 255),
AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0));
BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0));
alpha.Erase(255);
bitmap.Erase(0);
alpha.BlendWith(bitmap);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 255),
AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0));
BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0));
alpha.Erase(0);
bitmap.Erase(0);
alpha.BlendWith(bitmap);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255 - 0),
AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0));
BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0));
}
void BitmapExTest::testCreateMask()
@ -181,7 +181,7 @@ void BitmapExTest::testCreateMask()
pWriteAccess->SetPixel(i, i, COL_RED);
}
aBitmap = aBitmap.CreateMask(COL_RED, 1);
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
// the output is a greyscale palette bitmap
CPPUNIT_ASSERT_EQUAL(sal_uInt8(0xff), pAccess->GetPixelIndex(0, 0));
CPPUNIT_ASSERT_EQUAL(sal_uInt8(0x00), pAccess->GetPixelIndex(0, 1));
@ -205,7 +205,7 @@ void BitmapExTest::testCombineMaskOr()
}
AlphaMask aAlphaBitmap(Size(3, 3));
{
AlphaMask::ScopedWriteAccess pWriteAccess(aAlphaBitmap);
BitmapScopedWriteAccess pWriteAccess(aAlphaBitmap);
pWriteAccess->Erase(Color(0xff, 0xff, 0xff));
for (int i = 1; i < 3; ++i)
{
@ -217,7 +217,7 @@ void BitmapExTest::testCombineMaskOr()
{
AlphaMask aMask = aBitmap.CreateAlphaMask(COL_RED, 1);
AlphaMask::ScopedReadAccess pAccess(aMask);
BitmapScopedReadAccess pAccess(aMask);
// the output is a greyscale palette bitmap
CPPUNIT_ASSERT_EQUAL(sal_uInt8(0xff), pAccess->GetPixelIndex(0, 0));
CPPUNIT_ASSERT_EQUAL(sal_uInt8(0xff), pAccess->GetPixelIndex(0, 1));

View file

@ -10,7 +10,7 @@
#include <test/bootstrapfixture.hxx>
#include <vcl/bitmap.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <tools/stream.hxx>
#include <vcl/graphicfilter.hxx>
@ -130,7 +130,7 @@ void BitmapFilterTest::testBlurCorrectness()
CPPUNIT_ASSERT(BitmapSymmetryCheck::check(aBitmap24Bit));
{
Bitmap::ScopedReadAccess aReadAccess(aBitmap24Bit);
BitmapScopedReadAccess aReadAccess(aBitmap24Bit);
CPPUNIT_ASSERT_EQUAL(scanlineFormat, aReadAccess->GetScanlineFormat());
}
}

View file

@ -16,7 +16,7 @@
#include <vcl/alpha.hxx>
#include <bitmap/BitmapDisabledImageFilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
namespace
{
@ -42,7 +42,7 @@ void BitmapProcessorTest::testDisabledImage()
BitmapEx aDisabledBitmapEx(aDisabledImageFilter.execute(aBitmapEx));
Bitmap aDisabledBitmap(aDisabledBitmapEx.GetBitmap());
{
Bitmap::ScopedReadAccess pReadAccess(aDisabledBitmap);
BitmapScopedReadAccess pReadAccess(aDisabledBitmap);
Color aColor(pReadAccess->GetPixel(0, 0));
CPPUNIT_ASSERT_EQUAL(Color(0x00C5C5C5), aColor);
}
@ -56,7 +56,7 @@ void BitmapProcessorTest::testDisabledImage()
}
AlphaMask aMask(Size(3, 3));
{
AlphaScopedWriteAccess pWriteAccess(aMask);
BitmapScopedWriteAccess pWriteAccess(aMask);
pWriteAccess->Erase(Color(ColorTransparency, 0x00, 0xAA, 0xAA, 0xAA));
}
@ -66,13 +66,13 @@ void BitmapProcessorTest::testDisabledImage()
Bitmap aDisabledBitmap(aDisabledBitmapEx.GetBitmap());
{
Bitmap::ScopedReadAccess pReadAccess(aDisabledBitmap);
BitmapScopedReadAccess pReadAccess(aDisabledBitmap);
Color aColor(pReadAccess->GetPixel(0, 0));
CPPUNIT_ASSERT_EQUAL(Color(0x00C5C5C5), aColor);
}
AlphaMask aDisabledAlphaMask(aDisabledBitmapEx.GetAlphaMask());
{
AlphaMask::ScopedReadAccess pReadAccess(aDisabledAlphaMask);
BitmapScopedReadAccess pReadAccess(aDisabledAlphaMask);
Color aColor(pReadAccess->GetPixel(0, 0));
CPPUNIT_ASSERT_EQUAL(Color(0x0000AA), aColor);
}

View file

@ -17,7 +17,7 @@
#include <vcl/graphicfilter.hxx>
#include <BitmapSymmetryCheck.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
namespace
{
@ -38,7 +38,7 @@ bool checkBitmapColor(Bitmap const& rBitmap, Color const& rExpectedColor)
{
bool bResult = true;
Bitmap aBitmap(rBitmap);
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
BitmapScopedReadAccess pReadAccess(aBitmap);
tools::Long nHeight = pReadAccess->Height();
tools::Long nWidth = pReadAccess->Width();
for (tools::Long y = 0; y < nHeight; ++y)

View file

@ -21,7 +21,7 @@
#include <vcl/skia/SkiaHelper.hxx>
#include <vcl/BitmapMonochromeFilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <bitmap/Octree.hxx>
#include <salinst.hxx>
#include <svdata.hxx>
@ -271,7 +271,7 @@ void BitmapTest::testConvert()
CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, aBitmap.getPixelFormat());
{
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
BitmapScopedReadAccess pReadAccess(aBitmap);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(8), pReadAccess->GetBitCount());
#if defined MACOSX || defined IOS
if (SkiaHelper::isVCLSkiaEnabled())
@ -293,7 +293,7 @@ void BitmapTest::testConvert()
CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N24_BPP, aBitmap.getPixelFormat());
{
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
BitmapScopedReadAccess pReadAccess(aBitmap);
// 24 bit Bitmap on SVP backend can now use 24bit RGB everywhere.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(24), pReadAccess->GetBitCount());
@ -450,7 +450,7 @@ void BitmapTest::testCustom8BitPalette()
}
{
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
CPPUNIT_ASSERT_EQUAL(0, int(pAccess->GetPixelIndex(0, 0)));
CPPUNIT_ASSERT_EQUAL(BitmapColor(0x00, 0xCC, 0x22), pAccess->GetColor(0, 0));
@ -479,7 +479,7 @@ void BitmapTest::testErase()
pWriteAccess->Erase(Color(0x11, 0x22, 0x33));
}
{
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
BitmapScopedReadAccess pReadAccess(aBitmap);
BitmapColor aColor(pReadAccess->GetPixel(0, 0));
CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x11, 0x22, 0x33, 0x00), aColor);
}
@ -500,7 +500,7 @@ void BitmapTest::testBitmap32()
pWriteAccess->SetPixel(2, 2, BitmapColor(ColorTransparency, 0x99, 0x77, 0x66, 0x55));
}
{
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
BitmapScopedReadAccess pReadAccess(aBitmap);
BitmapColor aColor = pReadAccess->GetPixel(0, 0);
CPPUNIT_ASSERT_EQUAL(BitmapColor(ColorTransparency, 0x00, 0x00, 0x00, 0xFF), aColor);
@ -532,7 +532,7 @@ void BitmapTest::testOctree()
{
// Reduce to 1 color
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
Octree aOctree(*pAccess, 1);
auto aBitmapPalette = aOctree.GetPalette();
CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), aBitmapPalette.GetEntryCount());
@ -541,7 +541,7 @@ void BitmapTest::testOctree()
{
// Reduce to 4 color
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
Octree aOctree(*pAccess, 4);
auto aBitmapPalette = aOctree.GetPalette();
CPPUNIT_ASSERT_EQUAL(sal_uInt16(4), aBitmapPalette.GetEntryCount());
@ -553,7 +553,7 @@ void BitmapTest::testOctree()
{
// Reduce to 256 color
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
Octree aOctree(*pAccess, 256);
auto aBitmapPalette = aOctree.GetPalette();
CPPUNIT_ASSERT_EQUAL(sal_uInt16(74), aBitmapPalette.GetEntryCount());

View file

@ -123,7 +123,7 @@ bool checkBitmap(Graphic& rGraphic)
Bitmap aBitmap(rGraphic.GetBitmapEx().GetBitmap());
{
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
BitmapScopedReadAccess pReadAccess(aBitmap);
for (tools::Long y = 0; y < rGraphic.GetSizePixel().Height(); y++)
{
for (tools::Long x = 0; x < rGraphic.GetSizePixel().Width(); x++)

View file

@ -260,7 +260,7 @@ void BitmapRenderTest::testTdf116888()
Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap();
CPPUNIT_ASSERT(!aBitmap.IsEmpty());
aBitmap.Scale(0.8, 0.8); // This scaling discards mpUserData,
Bitmap::ScopedReadAccess pAccess(aBitmap); // forcing ReadTexture() here.
BitmapScopedReadAccess pAccess(aBitmap); // forcing ReadTexture() here.
// Check that there is mpUserBuffer content.
CPPUNIT_ASSERT(pAccess);
const ScanlineFormat eFormat = pAccess->GetScanlineFormat();

View file

@ -36,7 +36,7 @@
#include <vcl/bitmapex.hxx>
#include <canvasbitmap.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <algorithm>
@ -87,7 +87,7 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp,
int extraBpp = 0;
{
Bitmap::ScopedReadAccess pAcc( aContainedBmp );
BitmapScopedReadAccess pAcc( aContainedBmp );
nDepth = pAcc->GetBitCount();
if( pAcc->GetScanlineFormat() == ScanlineFormat::N32BitTcMask )
extraBpp = 8; // the format has 8 unused bits
@ -675,7 +675,7 @@ void CanvasBitmapTest::runTest()
AlphaMask aMask(Size(200,200));
aMask.Erase(255);
{
AlphaMask::ScopedWriteAccess pAcc(aMask);
BitmapScopedWriteAccess pAcc(aMask);
if( pAcc.get() )
{
pAcc->SetFillColor(COL_ALPHA_OPAQUE);
@ -693,7 +693,7 @@ void CanvasBitmapTest::runTest()
AlphaMask aAlpha(Size(200,200));
aAlpha.Erase(0);
{
BitmapWriteAccess* pAcc = aAlpha.AcquireAlphaWriteAccess();
BitmapScopedWriteAccess pAcc(aAlpha);
if( pAcc )
{
pAcc->SetFillColor(COL_ALPHA_OPAQUE);
@ -701,7 +701,6 @@ void CanvasBitmapTest::runTest()
pAcc->SetPixel(0,0,BitmapColor(0));
pAcc->SetPixel(0,1,BitmapColor(255));
pAcc->SetPixel(0,2,BitmapColor(0));
Bitmap::ReleaseAccess(pAcc);
}
}
@ -724,7 +723,7 @@ void CanvasBitmapTest::runTest()
vcl::PixelFormat::N8_BPP, aBmp.getPixelFormat());
{
Bitmap aBitmap = aBmp.GetBitmap();
BitmapReadAccess* pBmpAcc = aBitmap.AcquireReadAccess();
BitmapScopedReadAccess pBmpAcc(aBitmap);
CPPUNIT_ASSERT_MESSAGE( "Bitmap has invalid BitmapReadAccess",
pBmpAcc );
@ -735,8 +734,6 @@ void CanvasBitmapTest::runTest()
BitmapColor(2), pBmpAcc->GetPixel(2,2));
CPPUNIT_ASSERT_EQUAL_MESSAGE("(9,2) incorrect content",
BitmapColor(9), pBmpAcc->GetPixel(2,9));
Bitmap::ReleaseAccess(pBmpAcc);
}
xTestBmp.set( new TestBitmap( geometry::IntegerSize2D(10,10), false ));
@ -750,9 +747,9 @@ void CanvasBitmapTest::runTest()
vcl::PixelFormat::N24_BPP, aBmp.getPixelFormat());
{
Bitmap aBitmap = aBmp.GetBitmap();
BitmapReadAccess* pBmpAcc = aBitmap.AcquireReadAccess();
BitmapScopedReadAccess pBmpAcc(aBitmap);
AlphaMask aBitmapAlpha = aBmp.GetAlphaMask();
BitmapReadAccess* pAlphaAcc = aBitmapAlpha.AcquireReadAccess();
BitmapScopedReadAccess pAlphaAcc(aBitmapAlpha);
CPPUNIT_ASSERT_MESSAGE( "Bitmap has invalid BitmapReadAccess",
pBmpAcc);
@ -771,9 +768,6 @@ void CanvasBitmapTest::runTest()
BitmapColor(0,3,9), pBmpAcc->GetPixel(2,9));
CPPUNIT_ASSERT_EQUAL_MESSAGE("(9,2) correct alpha content",
BitmapColor(2), pAlphaAcc->GetPixel(2,9));
Bitmap::ReleaseAccess(pAlphaAcc);
Bitmap::ReleaseAccess(pBmpAcc);
}
}

View file

@ -63,7 +63,7 @@ public:
static tools::Long getCharacterTopWidth(VirtualDevice* device, const Point& start)
{
Bitmap bitmap = device->GetBitmap(Point(), device->GetOutputSizePixel());
Bitmap::ScopedReadAccess access(bitmap);
BitmapScopedReadAccess access(bitmap);
tools::Long y = start.Y();
while (y < bitmap.GetSizePixel().Height() && access->GetColor(y, start.X()) != COL_BLACK)
++y;
@ -82,7 +82,7 @@ static tools::Long getCharacterTopWidth(VirtualDevice* device, const Point& star
static tools::Long getCharacterRightSideHeight(VirtualDevice* device, const Point& start)
{
Bitmap bitmap = device->GetBitmap(Point(), device->GetOutputSizePixel());
Bitmap::ScopedReadAccess access(bitmap);
BitmapScopedReadAccess access(bitmap);
tools::Long x = start.X();
while (x >= 0 && access->GetColor(start.Y(), x) != COL_BLACK)
--x;

View file

@ -16,7 +16,7 @@
#include <vcl/metric.hxx>
#include <vcl/settings.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <drawmode.hxx>
class VclDrawModeTest : public test::BootstrapFixture
@ -340,7 +340,7 @@ void VclDrawModeTest::testDrawModeBitmapEx()
{
BitmapEx aResultBitmapEx(vcl::drawmode::GetBitmapEx(aBmpEx, DrawModeFlags::GrayBitmap));
Bitmap aResultBitmap(aResultBitmapEx.GetBitmap());
Bitmap::ScopedReadAccess pReadAccess(aResultBitmap);
BitmapScopedReadAccess pReadAccess(aResultBitmap);
const BitmapColor& rColor = pReadAccess->GetColor(0, 0);
CPPUNIT_ASSERT_EQUAL(BitmapColor(0x26, 0x26, 0x26), rColor);
@ -350,7 +350,7 @@ void VclDrawModeTest::testDrawModeBitmapEx()
{
BitmapEx aResultBitmapEx(vcl::drawmode::GetBitmapEx(aBmpEx, DrawModeFlags::NoFill));
Bitmap aResultBitmap(aResultBitmapEx.GetBitmap());
Bitmap::ScopedReadAccess pReadAccess(aResultBitmap);
BitmapScopedReadAccess pReadAccess(aResultBitmap);
const BitmapColor& rColor = pReadAccess->GetColor(0, 0);
CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_RED), rColor);

View file

@ -42,7 +42,7 @@ public:
CPPUNIT_TEST_FIXTURE(GenTest, testTdf121120)
{
Bitmap aBitmap = load("tdf121120.png");
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
const Size& rSize = aBitmap.GetSizePixel();
Color aColor(pAccess->GetPixel(rSize.getHeight() / 2, rSize.getWidth() / 2));
// Without the accompanying fix in place, this test would have failed with 'Expected: 255;
@ -79,7 +79,7 @@ CPPUNIT_TEST_FIXTURE(GenTest, testTdf107966)
// Make sure that the polygon is visible.
Bitmap aBitmap = pVirtualDevice->GetBitmap(Point(), Size(1350, 15));
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
Color aPixel(pAccess->GetPixel(0, 0));
// Without the accompanying fix in place, this test would have failed with 'Expected: 000000;
// Actual: ffffff', i.e. the top left pixel was white, not black.

View file

@ -26,7 +26,7 @@
#include <vcl/gdimtf.hxx>
#include <vcl/metaact.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <bufferdevice.hxx>
#include <window.h>

View file

@ -13,7 +13,7 @@
#include <tools/stream.hxx>
#include <vcl/graph.hxx>
#include <vcl/graphicfilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <graphic/GraphicFormatDetector.hxx>
#include <filter/TiffReader.hxx>
@ -165,7 +165,7 @@ void TiffFilterTest::testTdf74331()
CPPUNIT_ASSERT_EQUAL(tools::Long(200), aSize.Width());
CPPUNIT_ASSERT_EQUAL(tools::Long(200), aSize.Height());
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
BitmapScopedReadAccess pReadAccess(aBitmap);
// Check the image contains different kinds of grays
int nGrayCount = 0;
@ -223,7 +223,7 @@ void TiffFilterTest::testRoundtrip()
CPPUNIT_ASSERT_EQUAL(Size(2, 2), aResultBitmap.GetSizePixel());
{
Bitmap::ScopedReadAccess pAccess(aResultBitmap);
BitmapScopedReadAccess pAccess(aResultBitmap);
CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(pAccess->GetPixel(0, 0)));
CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(pAccess->GetPixel(0, 1)));
CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, Color(pAccess->GetPixel(1, 0)));
@ -262,7 +262,7 @@ void TiffFilterTest::testRGB8bits()
CPPUNIT_ASSERT_EQUAL(tools::Long(10), aSize.Width());
CPPUNIT_ASSERT_EQUAL(tools::Long(10), aSize.Height());
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
BitmapScopedReadAccess pReadAccess(aBitmap);
const Color aColor = pReadAccess->GetColor(5, 5);
if (rName == u"red8.tif")
@ -297,7 +297,7 @@ void TiffFilterTest::testRGB16bits()
CPPUNIT_ASSERT_EQUAL(tools::Long(10), aSize.Width());
CPPUNIT_ASSERT_EQUAL(tools::Long(10), aSize.Height());
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
BitmapScopedReadAccess pReadAccess(aBitmap);
const Color aColor = pReadAccess->GetColor(5, 5);
if (rName == u"red16.tif")

View file

@ -10,7 +10,7 @@
#include <unotest/filters-test.hxx>
#include <test/bootstrapfixture.hxx>
#include <vcl/FilterConfigItem.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <tools/stream.hxx>
#include <vcl/graph.hxx>
#include <vcl/graphicfilter.hxx>
@ -94,7 +94,7 @@ void WebpFilterTest::testRoundtrip(bool lossy)
pAccess->FillRect(tools::Rectangle(Point(0, 10), Size(10, 10)));
pAccess->SetFillColor(COL_BLUE);
pAccess->FillRect(tools::Rectangle(Point(10, 10), Size(10, 10)));
AlphaScopedWriteAccess pAccessAlpha(aAlpha);
BitmapScopedWriteAccess pAccessAlpha(aAlpha);
pAccessAlpha->SetFillColor(BitmapColor(0)); // opaque
pAccessAlpha->FillRect(tools::Rectangle(Point(0, 0), Size(10, 10)));
pAccessAlpha->FillRect(tools::Rectangle(Point(10, 0), Size(10, 10)));
@ -124,7 +124,7 @@ void WebpFilterTest::testRoundtrip(bool lossy)
{
Bitmap tmpBitmap = aResultBitmap.GetBitmap();
Bitmap::ScopedReadAccess pAccess(tmpBitmap);
BitmapScopedReadAccess pAccess(tmpBitmap);
// Note that x,y are swapped.
CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(pAccess->GetPixel(0, 0)));
CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(pAccess->GetPixel(0, 19)));
@ -140,7 +140,7 @@ void WebpFilterTest::testRoundtrip(bool lossy)
CPPUNIT_ASSERT_EQUAL(COL_BLUE, Color(pAccess->GetPixel(19, 19)));
}
AlphaMask tmpAlpha = aResultBitmap.GetAlphaMask();
AlphaMask::ScopedReadAccess pAccessAlpha(tmpAlpha);
BitmapScopedReadAccess pAccessAlpha(tmpAlpha);
CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), pAccessAlpha->GetPixelIndex(0, 0));
CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), pAccessAlpha->GetPixelIndex(0, 19));
CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), pAccessAlpha->GetPixelIndex(19, 0));
@ -181,7 +181,7 @@ void WebpFilterTest::testRead(std::u16string_view rName, bool lossy, bool alpha)
{
Bitmap tmpBitmap = aResultBitmap.GetBitmap();
Bitmap::ScopedReadAccess pAccess(tmpBitmap);
BitmapScopedReadAccess pAccess(tmpBitmap);
// Note that x,y are swapped.
if (lossy)
CPPUNIT_ASSERT_LESS(sal_uInt16(2), pAccess->GetPixel(0, 0).GetColorError(COL_LIGHTRED));
@ -191,7 +191,7 @@ void WebpFilterTest::testRead(std::u16string_view rName, bool lossy, bool alpha)
if (alpha)
{
AlphaMask tmpAlpha = aResultBitmap.GetAlphaMask();
AlphaMask::ScopedReadAccess pAccessAlpha(tmpAlpha);
BitmapScopedReadAccess pAccessAlpha(tmpAlpha);
CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), pAccessAlpha->GetPixelIndex(0, 0));
CPPUNIT_ASSERT_EQUAL(sal_uInt8(255), pAccessAlpha->GetPixelIndex(0, 9));
}

View file

@ -14,7 +14,7 @@
#include <unotest/bootstrapfixturebase.hxx>
#include <vcl/graphicfilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <tools/stream.hxx>
constexpr OUStringLiteral gaDataUrl(u"/vcl/qa/cppunit/jpeg/data/");
@ -176,7 +176,7 @@ void JpegReaderTest::testTdf138950()
CPPUNIT_ASSERT_EQUAL(tools::Long(720), aSize.Width());
CPPUNIT_ASSERT_EQUAL(tools::Long(1280), aSize.Height());
Bitmap::ScopedReadAccess pReadAccess(aBitmap);
BitmapScopedReadAccess pReadAccess(aBitmap);
int nBlackCount = 0;
for (tools::Long nY = 0; nY < aSize.Height(); ++nY)
{

View file

@ -79,7 +79,7 @@ BitmapEx JpegWriterTest::roundtripJPG(const BitmapEx& bitmap)
void JpegWriterTest::testWrite8BitGrayscale()
{
Bitmap bitmap = roundtripJPG(getFullUrl(u"8BitGrayscale.jpg")).GetBitmap();
Bitmap::ScopedReadAccess access(bitmap);
BitmapScopedReadAccess access(bitmap);
const ScanlineFormat format = access->GetScanlineFormat();
// Check that it's still 8bit grayscale.
CPPUNIT_ASSERT_EQUAL(ScanlineFormat::N8BitPal, format);
@ -95,7 +95,7 @@ void JpegWriterTest::testWrite8BitGrayscale()
void JpegWriterTest::testWrite8BitNonGrayscale()
{
Bitmap bitmap = roundtripJPG(getFullUrl(u"8BitNonGrayscale.gif")).GetBitmap();
Bitmap::ScopedReadAccess access(bitmap);
BitmapScopedReadAccess access(bitmap);
const ScanlineFormat format = access->GetScanlineFormat();
// Check that it's still 8bit grayscale.
CPPUNIT_ASSERT_EQUAL(ScanlineFormat::N8BitPal, format);

View file

@ -26,7 +26,7 @@
#include <vcl/gdimtf.hxx>
#include <vcl/metaact.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <bufferdevice.hxx>
#include <window.h>
@ -110,7 +110,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testVirtualDevice)
CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(30, 31)));
// Gotcha: y and x swap for BitmapReadAccess: deep joy.
Bitmap::ScopedReadAccess pAcc(aBmp);
BitmapScopedReadAccess pAcc(aBmp);
CPPUNIT_ASSERT_EQUAL(COL_WHITE, static_cast<Color>(pAcc->GetPixel(0, 0)));
#if !defined _WIN32 //TODO: various failures on Windows tinderboxes
CPPUNIT_ASSERT_EQUAL(COL_BLUE, static_cast<Color>(pAcc->GetPixel(2, 1)));
@ -204,7 +204,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawBlackBitmap)
// test to see if the color is black
Bitmap aBlackBmp(pVDev->GetBitmap(Point(0, 0), Size(10, 10)));
Bitmap::ScopedReadAccess pReadAccess(aBlackBmp);
BitmapScopedReadAccess pReadAccess(aBlackBmp);
const BitmapColor& rColor = pReadAccess->GetColor(0, 0);
CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_BLACK), rColor);
}
@ -248,7 +248,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawWhiteBitmap)
// test to see if the color is white
Bitmap aWhiteBmp(pVDev->GetBitmap(Point(0, 0), Size(10, 10)));
Bitmap::ScopedReadAccess pReadAccess(aWhiteBmp);
BitmapScopedReadAccess pReadAccess(aWhiteBmp);
const BitmapColor& rColor = pReadAccess->GetColor(0, 0);
CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_WHITE), rColor);
}
@ -319,7 +319,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGrayBitmap)
// check to ensure that the bitmap is red
{
Bitmap::ScopedReadAccess pReadAccess(aBmp);
BitmapScopedReadAccess pReadAccess(aBmp);
const BitmapColor& rColor = pReadAccess->GetColor(0, 0);
CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_RED), rColor);
}
@ -332,7 +332,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGrayBitmap)
// should be a grey
Bitmap aVDevBmp(pVDev->GetBitmap(Point(), Size(1, 1)));
{
Bitmap::ScopedReadAccess pReadAccess(aVDevBmp);
BitmapScopedReadAccess pReadAccess(aVDevBmp);
const BitmapColor& rColor = pReadAccess->GetColor(0, 0);
CPPUNIT_ASSERT_EQUAL(BitmapColor(0x26, 0x26, 0x26), rColor);
}
@ -379,7 +379,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawTransformedBitmapEx)
CPPUNIT_ASSERT_EQUAL(Size(16, 16), aTransformedSize);
aBitmap = rBitmapEx.GetBitmap();
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
for (int i = 0; i < 16; ++i)
{
for (int j = 0; j < 16; ++j)
@ -438,7 +438,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawTransformedBitmapExFlip)
const BitmapEx& rBitmapEx = pBitmapAction->GetBitmapEx();
aBitmap = rBitmapEx.GetBitmap();
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
int nX = 8 * 0.25;
int nY = 8 * 0.25;
BitmapColor aColor = pAccess->GetPixel(nY, nX);

View file

@ -27,7 +27,7 @@
#include <vcl/filter/PngImageWriter.hxx>
#include <vcl/BitmapReadAccess.hxx>
#include <vcl/BitmapMonochromeFilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <vcl/alpha.hxx>
#include <vcl/graphicfilter.hxx>
#include <unotools/tempfile.hxx>
@ -64,7 +64,7 @@ void checkImportExportPng(const OUString& sFilePath, const Case& aCase)
CPPUNIT_ASSERT_MESSAGE(OString("Failed to read png from: " + sFilePath.toUtf8()).getStr(),
bReadOk);
Bitmap aImportedBitmap = aImportedBitmapEx.GetBitmap();
Bitmap::ScopedInfoAccess pAccess(aImportedBitmap);
BitmapScopedInfoAccess pAccess(aImportedBitmap);
auto nActualWidth = aImportedBitmapEx.GetSizePixel().Width();
auto nActualHeight = aImportedBitmapEx.GetSizePixel().Height();
auto nActualBpp = vcl::pixelFormatBitCount(aImportedBitmapEx.GetBitmap().getPixelFormat());
@ -103,7 +103,7 @@ void checkImportExportPng(const OUString& sFilePath, const Case& aCase)
CPPUNIT_ASSERT_MESSAGE(
OString("Failed to read exported png: " + sFilePath.toUtf8()).getStr(), bReadOk);
Bitmap aExportedImportedBitmap = aExportedImportedBitmapEx.GetBitmap();
Bitmap::ScopedInfoAccess pAccess(aExportedImportedBitmap);
BitmapScopedInfoAccess pAccess(aExportedImportedBitmap);
auto nActualWidth = aExportedImportedBitmapEx.GetSizePixel().Width();
auto nActualHeight = aExportedImportedBitmapEx.GetSizePixel().Height();
auto nActualBpp
@ -208,7 +208,7 @@ void PngFilterTest::testPng()
Bitmap aBitmap = aBitmapEx.GetBitmap();
{
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Width());
CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Height());
@ -255,7 +255,7 @@ void PngFilterTest::testPng()
Bitmap aBitmap = aBitmapEx.GetBitmap();
{
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Width());
CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Height());
if (pAccess->GetBitCount() == 24 || pAccess->GetBitCount() == 32)
@ -294,7 +294,7 @@ void PngFilterTest::testPng()
Bitmap aBitmap = aBitmapEx.GetBitmap();
{
Bitmap::ScopedReadAccess pAccess(aBitmap);
BitmapScopedReadAccess pAccess(aBitmap);
CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Width());
CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAccess->Height());
@ -320,7 +320,7 @@ void PngFilterTest::testPng()
AlphaMask aAlpha = aBitmapEx.GetAlphaMask();
{
AlphaMask::ScopedReadAccess pAlphaAccess(aAlpha);
BitmapScopedReadAccess pAlphaAccess(aAlpha);
CPPUNIT_ASSERT_EQUAL(sal_uInt16(8), pAlphaAccess->GetBitCount());
CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAlphaAccess->Width());
CPPUNIT_ASSERT_EQUAL(tools::Long(4), pAlphaAccess->Height());
@ -1920,7 +1920,7 @@ void PngFilterTest::testPngRoundtrip24_8()
AlphaMask aAlpha(Size(16, 16));
{
BitmapScopedWriteAccess pWriteAccessBitmap(aBitmap);
AlphaScopedWriteAccess pWriteAccessAlpha(aAlpha);
BitmapScopedWriteAccess pWriteAccessAlpha(aAlpha);
pWriteAccessAlpha->Erase(Color(0xAA, 0xAA, 0xAA));
pWriteAccessBitmap->Erase(COL_BLACK);
for (int i = 0; i < 8; ++i)

View file

@ -18,7 +18,7 @@
#include <skia/salbmp.hxx>
#include <skia/utils.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
using namespace SkiaHelper;
@ -248,17 +248,17 @@ void SkiaTest::testAlphaBlendWith()
CPPUNIT_ASSERT(skiaAlpha->unittestHasEraseColor());
CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, alpha.getPixelFormat());
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(208),
AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0));
BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0));
// Test with images set.
alpha.Erase(64);
AlphaMask::ScopedReadAccess(alpha)->GetColor(0, 0); // Reading a pixel will create pixel data.
BitmapScopedReadAccess(alpha)->GetColor(0, 0); // Reading a pixel will create pixel data.
skiaAlpha = dynamic_cast<SkiaSalBitmap*>(alpha.GetBitmap().ImplGetSalBitmap().get());
skiaAlpha->GetSkImage();
CPPUNIT_ASSERT(!skiaAlpha->unittestHasEraseColor());
CPPUNIT_ASSERT(skiaAlpha->unittestHasImage());
bitmap.Erase(64);
AlphaMask::ScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel will create pixel data.
BitmapScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel will create pixel data.
skiaBitmap = dynamic_cast<SkiaSalBitmap*>(bitmap.GetBitmap().ImplGetSalBitmap().get());
skiaBitmap->GetSkImage();
CPPUNIT_ASSERT(!skiaBitmap->unittestHasEraseColor());
@ -268,14 +268,14 @@ void SkiaTest::testAlphaBlendWith()
CPPUNIT_ASSERT(skiaAlpha->unittestHasImage());
CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, alpha.getPixelFormat());
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(207),
AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0));
BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0));
// Test with erase color for alpha and image for other bitmap.
alpha.Erase(64);
skiaAlpha = dynamic_cast<SkiaSalBitmap*>(alpha.GetBitmap().ImplGetSalBitmap().get());
CPPUNIT_ASSERT(skiaAlpha->unittestHasEraseColor());
bitmap.Erase(64);
AlphaMask::ScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel will create pixel data.
BitmapScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel will create pixel data.
skiaBitmap = dynamic_cast<SkiaSalBitmap*>(bitmap.GetBitmap().ImplGetSalBitmap().get());
skiaBitmap->GetSkImage();
CPPUNIT_ASSERT(!skiaBitmap->unittestHasEraseColor());
@ -285,7 +285,7 @@ void SkiaTest::testAlphaBlendWith()
CPPUNIT_ASSERT(skiaAlpha->unittestHasImage());
CPPUNIT_ASSERT_EQUAL(vcl::PixelFormat::N8_BPP, alpha.getPixelFormat());
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(207),
AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 0));
BitmapScopedReadAccess(alpha)->GetPixelIndex(0, 0));
}
void SkiaTest::testBitmapCopyOnWrite()

View file

@ -28,7 +28,7 @@
#include <salhelper/simplereferenceobject.hxx>
#include <sal/log.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
@ -1126,7 +1126,7 @@ void SvmTest::testBitmapExs()
BitmapScopedWriteAccess pAccess(aBitmap);
pAccess->Erase(COL_MAGENTA);
AlphaScopedWriteAccess pAlphaAccess(aAlpha);
BitmapScopedWriteAccess pAlphaAccess(aAlpha);
pAlphaAccess->Erase(Color(127, 127, 127));
}
pVirtualDev->DrawBitmapEx(Point(6, 6), BitmapEx(aBitmap, aAlpha));

View file

@ -68,7 +68,7 @@ static bool isBlack(Color col)
static tools::Long getCharacterBaseWidth(VirtualDevice* device, const Point& start)
{
Bitmap bitmap = device->GetBitmap(Point(), device->GetOutputSizePixel());
Bitmap::ScopedReadAccess access(bitmap);
BitmapScopedReadAccess access(bitmap);
tools::Long y = start.Y();
while (y >= 0 && !isBlack(access->GetColor(y, start.X())))
--y;
@ -87,7 +87,7 @@ static tools::Long getCharacterBaseWidth(VirtualDevice* device, const Point& sta
static tools::Long getCharacterTopWidth(VirtualDevice* device, const Point& start)
{
Bitmap bitmap = device->GetBitmap(Point(), device->GetOutputSizePixel());
Bitmap::ScopedReadAccess access(bitmap);
BitmapScopedReadAccess access(bitmap);
tools::Long y = start.Y();
while (y < bitmap.GetSizePixel().Height() && !isBlack(access->GetColor(y, start.X())))
++y;
@ -108,7 +108,7 @@ static tools::Long getCharacterTopWidth(VirtualDevice* device, const Point& star
static tools::Long getCharacterLeftSideHeight(VirtualDevice* device, const Point& start)
{
Bitmap bitmap = device->GetBitmap(Point(), device->GetOutputSizePixel());
Bitmap::ScopedReadAccess access(bitmap);
BitmapScopedReadAccess access(bitmap);
tools::Long x = start.X();
while (x < bitmap.GetSizePixel().Width() && !isBlack(access->GetColor(start.Y(), x)))
++x;

View file

@ -10,8 +10,7 @@
#include <vcl/bitmapex.hxx>
#include <vcl/BitmapAlphaClampFilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
BitmapEx BitmapAlphaClampFilter::execute(BitmapEx const& rBitmapEx) const
{
@ -20,7 +19,7 @@ BitmapEx BitmapAlphaClampFilter::execute(BitmapEx const& rBitmapEx) const
AlphaMask aBitmapAlpha(rBitmapEx.GetAlphaMask());
{
AlphaScopedWriteAccess pWriteAlpha(aBitmapAlpha);
BitmapScopedWriteAccess pWriteAlpha(aBitmapAlpha);
const Size aSize(rBitmapEx.GetSizePixel());
for (sal_Int32 nY = 0; nY < sal_Int32(aSize.Height()); ++nY)

View file

@ -13,8 +13,7 @@
#include <comphelper/threadpool.hxx>
#include <sal/log.hxx>
#include <vcl/BitmapBasicMorphologyFilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <algorithm>
@ -26,16 +25,16 @@ namespace
{
struct FilterSharedData
{
BitmapReadAccess* mpReadAccess;
BitmapWriteAccess* mpWriteAccess;
BitmapScopedReadAccess& mpReadAccess;
BitmapScopedWriteAccess& mpWriteAccess;
sal_Int32 mnRadius;
sal_uInt8 mnOutsideVal;
Color maOutsideColor;
FilterSharedData(Bitmap::ScopedReadAccess& rReadAccess, BitmapScopedWriteAccess& rWriteAccess,
FilterSharedData(BitmapScopedReadAccess& rReadAccess, BitmapScopedWriteAccess& rWriteAccess,
sal_Int32 nRadius, sal_uInt8 nOutsideVal)
: mpReadAccess(rReadAccess.get())
, mpWriteAccess(rWriteAccess.get())
: mpReadAccess(rReadAccess)
, mpWriteAccess(rWriteAccess)
, mnRadius(nRadius)
, mnOutsideVal(nOutsideVal)
, maOutsideColor(ColorTransparency, nOutsideVal, nOutsideVal, nOutsideVal, nOutsideVal)
@ -73,14 +72,14 @@ template <typename MorphologyOp, int nComponentWidth> struct Value
bLookOutside ? rShared.mnOutsideVal : MorphologyOp::initVal);
}
void apply(const BitmapReadAccess* pReadAccess, sal_Int32 x, sal_Int32 y,
void apply(BitmapScopedReadAccess& pReadAccess, sal_Int32 x, sal_Int32 y,
sal_uInt8* pHint = nullptr)
{
sal_uInt8* pSource = (pHint ? pHint : pReadAccess->GetScanline(y)) + nWidthBytes * x;
std::transform(pSource, pSource + nWidthBytes, aResult, aResult, MorphologyOp::apply);
}
void copy(const BitmapWriteAccess* pWriteAccess, sal_Int32 x, sal_Int32 y,
void copy(BitmapScopedWriteAccess& pWriteAccess, sal_Int32 x, sal_Int32 y,
sal_uInt8* pHint = nullptr)
{
sal_uInt8* pDest = (pHint ? pHint : pWriteAccess->GetScanline(y)) + nWidthBytes * x;
@ -104,7 +103,7 @@ template <typename MorphologyOp> struct Value<MorphologyOp, 0>
{
}
void apply(const BitmapReadAccess* pReadAccess, sal_Int32 x, sal_Int32 y,
void apply(const BitmapScopedReadAccess& pReadAccess, sal_Int32 x, sal_Int32 y,
sal_uInt8* /*pHint*/ = nullptr)
{
const auto& rSource = pReadAccess->GetColor(y, x);
@ -114,7 +113,7 @@ template <typename MorphologyOp> struct Value<MorphologyOp, 0>
MorphologyOp::apply(rSource.GetBlue(), aResult.GetBlue()));
}
void copy(BitmapWriteAccess* pWriteAccess, sal_Int32 x, sal_Int32 y,
void copy(BitmapScopedWriteAccess& pWriteAccess, sal_Int32 x, sal_Int32 y,
sal_uInt8* /*pHint*/ = nullptr)
{
pWriteAccess->SetPixel(y, x, aResult);
@ -145,8 +144,8 @@ template <typename MorphologyOp, int nComponentWidth> struct pass
static void Horizontal(FilterSharedData const& rShared, const sal_Int32 nStart,
const sal_Int32 nEnd)
{
BitmapReadAccess* pReadAccess = rShared.mpReadAccess;
BitmapWriteAccess* pWriteAccess = rShared.mpWriteAccess;
BitmapScopedReadAccess& pReadAccess = rShared.mpReadAccess;
BitmapScopedWriteAccess& pWriteAccess = rShared.mpWriteAccess;
const sal_Int32 nLastIndex = pReadAccess->Width() - 1;
@ -173,8 +172,8 @@ template <typename MorphologyOp, int nComponentWidth> struct pass
static void Vertical(FilterSharedData const& rShared, const sal_Int32 nStart,
const sal_Int32 nEnd)
{
BitmapReadAccess* pReadAccess = rShared.mpReadAccess;
BitmapWriteAccess* pWriteAccess = rShared.mpWriteAccess;
BitmapScopedReadAccess& pReadAccess = rShared.mpReadAccess;
BitmapScopedWriteAccess& pWriteAccess = rShared.mpWriteAccess;
const sal_Int32 nLastIndex = pReadAccess->Height() - 1;
@ -235,7 +234,7 @@ void runFilter(Bitmap& rBitmap, const sal_Int32 nRadius, const bool bParallel,
auto pTag = comphelper::ThreadPool::createThreadTaskTag();
{
Bitmap::ScopedReadAccess pReadAccess(rBitmap);
BitmapScopedReadAccess pReadAccess(rBitmap);
BitmapScopedWriteAccess pWriteAccess(rBitmap);
FilterSharedData aSharedData(pReadAccess, pWriteAccess, nRadius, nOutsideVal);
@ -253,7 +252,7 @@ void runFilter(Bitmap& rBitmap, const sal_Int32 nRadius, const bool bParallel,
rShared.waitUntilDone(pTag);
}
{
Bitmap::ScopedReadAccess pReadAccess(rBitmap);
BitmapScopedReadAccess pReadAccess(rBitmap);
BitmapScopedWriteAccess pWriteAccess(rBitmap);
FilterSharedData aSharedData(pReadAccess, pWriteAccess, nRadius, nOutsideVal);
@ -279,7 +278,7 @@ void runFilter(Bitmap& rBitmap, const sal_Int32 nRadius, const bool bParallel,
else
{
{
Bitmap::ScopedReadAccess pReadAccess(rBitmap);
BitmapScopedReadAccess pReadAccess(rBitmap);
BitmapScopedWriteAccess pWriteAccess(rBitmap);
FilterSharedData aSharedData(pReadAccess, pWriteAccess, nRadius, nOutsideVal);
sal_Int32 nFirstIndex = 0;
@ -287,7 +286,7 @@ void runFilter(Bitmap& rBitmap, const sal_Int32 nRadius, const bool bParallel,
myPass::Horizontal(aSharedData, nFirstIndex, nLastIndex);
}
{
Bitmap::ScopedReadAccess pReadAccess(rBitmap);
BitmapScopedReadAccess pReadAccess(rBitmap);
BitmapScopedWriteAccess pWriteAccess(rBitmap);
FilterSharedData aSharedData(pReadAccess, pWriteAccess, nRadius, nOutsideVal);
sal_Int32 nFirstIndex = 0;
@ -341,7 +340,7 @@ Bitmap BitmapBasicMorphologyFilter::filter(Bitmap const& rBitmap) const
Bitmap bitmapCopy(rBitmap);
ScanlineFormat nScanlineFormat;
{
Bitmap::ScopedReadAccess pReadAccess(bitmapCopy);
BitmapScopedReadAccess pReadAccess(bitmapCopy);
nScanlineFormat = pReadAccess ? pReadAccess->GetScanlineFormat() : ScanlineFormat::NONE;
}

View file

@ -13,8 +13,7 @@
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/BitmapColorQuantizationFilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <algorithm>
#include <cstdlib>
@ -26,7 +25,7 @@ BitmapEx BitmapColorQuantizationFilter::execute(BitmapEx const& aBitmapEx) const
if (vcl::numberOfColors(aBitmap.getPixelFormat()) <= sal_Int64(mnNewColorCount))
return BitmapEx(aBitmap);
Bitmap::ScopedReadAccess pRAcc(aBitmap);
BitmapScopedReadAccess pRAcc(aBitmap);
if (!pRAcc)
return BitmapEx();

View file

@ -11,7 +11,7 @@
#include <tools/color.hxx>
#include <tools/helpers.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <bitmap/BitmapColorizeFilter.hxx>
BitmapEx BitmapColorizeFilter::execute(BitmapEx const& rBitmapEx) const

View file

@ -14,8 +14,7 @@
#include <vcl/bitmapex.hxx>
#include <vcl/BitmapConvolutionMatrixFilter.hxx>
#include <vcl/BitmapSharpenFilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <array>
@ -24,7 +23,7 @@ BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx const& rBitmapEx) const
Bitmap aBitmap(rBitmapEx.GetBitmap());
const sal_Int32 nDivisor = 8;
Bitmap::ScopedReadAccess pReadAcc(aBitmap);
BitmapScopedReadAccess pReadAcc(aBitmap);
if (!pReadAcc)
return BitmapEx();

View file

@ -8,7 +8,7 @@
*
*/
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <bitmap/BitmapDisabledImageFilter.hxx>
BitmapEx BitmapDisabledImageFilter::execute(BitmapEx const& rBitmapEx) const
@ -28,7 +28,7 @@ BitmapEx BitmapDisabledImageFilter::execute(BitmapEx const& rBitmapEx) const
BitmapEx aReturnBitmap;
Bitmap aReadBitmap(rBitmapEx.GetBitmap());
Bitmap::ScopedReadAccess pRead(aReadBitmap);
BitmapScopedReadAccess pRead(aReadBitmap);
if (pRead && pGrey)
{
for (sal_Int32 nY = 0; nY < sal_Int32(aSize.Height()); ++nY)

View file

@ -11,8 +11,7 @@
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/BitmapDuoToneFilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
static sal_uInt8 lcl_getDuotoneColorComponent(sal_uInt8 base, sal_uInt16 color1, sal_uInt16 color2)
{
@ -30,7 +29,7 @@ BitmapEx BitmapDuoToneFilter::execute(BitmapEx const& rBitmapEx) const
const sal_Int32 nHeight = aBitmap.GetSizePixel().Height();
Bitmap aResultBitmap(aBitmap.GetSizePixel(), vcl::PixelFormat::N24_BPP);
Bitmap::ScopedReadAccess pReadAcc(aBitmap);
BitmapScopedReadAccess pReadAcc(aBitmap);
BitmapScopedWriteAccess pWriteAcc(aResultBitmap);
const BitmapColor aColorOne(mnColorOne);
const BitmapColor aColorTwo(mnColorTwo);

View file

@ -15,8 +15,7 @@
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/BitmapEmbossGreyFilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <algorithm>
@ -27,7 +26,7 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& rBitmapEx) const
if (!aBitmap.ImplMakeGreyscales())
return BitmapEx();
Bitmap::ScopedReadAccess pReadAcc(aBitmap);
BitmapScopedReadAccess pReadAcc(aBitmap);
if (!pReadAcc)
return BitmapEx();

View file

@ -38,7 +38,7 @@
#include <salbmp.hxx>
#include <salinst.hxx>
#include <svdata.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <bitmap/BitmapMaskToAlphaFilter.hxx>
#include <o3tl/any.hxx>
@ -578,7 +578,7 @@ sal_uInt8 BitmapEx::GetAlpha(sal_Int32 nX, sal_Int32 nY) const
}
else
{
AlphaMask::ScopedReadAccess pRead(const_cast<AlphaMask&>(maAlphaMask));
BitmapScopedReadAccess pRead(maAlphaMask);
if(pRead)
{
const BitmapColor aBitmapColor(pRead->GetPixel(nY, nX));
@ -591,7 +591,7 @@ sal_uInt8 BitmapEx::GetAlpha(sal_Int32 nX, sal_Int32 nY) const
Color BitmapEx::GetPixelColor(sal_Int32 nX, sal_Int32 nY) const
{
Bitmap::ScopedReadAccess pReadAccess( const_cast<Bitmap&>(maBitmap) );
BitmapScopedReadAccess pReadAccess( maBitmap );
assert(pReadAccess);
BitmapColor aColor = pReadAccess->GetColor(nY, nX);
@ -599,7 +599,7 @@ Color BitmapEx::GetPixelColor(sal_Int32 nX, sal_Int32 nY) const
if (IsAlpha())
{
AlphaMask aAlpha = GetAlphaMask();
AlphaMask::ScopedReadAccess pAlphaReadAccess(aAlpha);
BitmapScopedReadAccess pAlphaReadAccess(aAlpha);
aColor.SetAlpha(pAlphaReadAccess->GetPixel(nY, nX).GetIndex());
}
else if (maBitmap.getPixelFormat() != vcl::PixelFormat::N32_BPP)
@ -664,7 +664,7 @@ namespace
if(xWrite)
{
Bitmap::ScopedReadAccess xRead(const_cast< Bitmap& >(rSource));
BitmapScopedReadAccess xRead(rSource);
if (xRead)
{
@ -873,7 +873,7 @@ BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorMod
// For e.g. 8bit Bitmaps, the nearest color to the given erase color is
// determined and used -> this may be different from what is wanted here.
// Better create a new bitmap with the needed color explicitly.
Bitmap::ScopedReadAccess xReadAccess(aChangedBitmap);
BitmapScopedReadAccess xReadAccess(aChangedBitmap);
OSL_ENSURE(xReadAccess, "Got no Bitmap ReadAccess ?!?");
if(xReadAccess)
@ -1062,7 +1062,7 @@ BitmapEx createBlendFrame(
aContent.Erase(COL_BLACK);
BitmapScopedWriteAccess pContent(aContent);
AlphaScopedWriteAccess pAlpha(aAlpha);
BitmapScopedWriteAccess pAlpha(aAlpha);
if(pContent && pAlpha)
{
@ -1191,7 +1191,7 @@ static Bitmap DetectEdges( const Bitmap& rBmp )
ScopedVclPtr<VirtualDevice> pVirDev(VclPtr<VirtualDevice>::Create());
pVirDev->SetOutputSizePixel(aSize);
Bitmap::ScopedReadAccess pReadAcc(aWorkBmp);
BitmapScopedReadAccess pReadAcc(aWorkBmp);
if( !pReadAcc )
return rBmp;
@ -1282,7 +1282,7 @@ tools::Polygon BitmapEx::GetContour( bool bContourEdgeDetect,
else
aWorkBmp = maBitmap;
BitmapReadAccess* pAcc = aWorkBmp.AcquireReadAccess();
BitmapScopedReadAccess pAcc(aWorkBmp);
const tools::Long nWidth = pAcc ? pAcc->Width() : 0;
const tools::Long nHeight = pAcc ? pAcc->Height() : 0;
@ -1351,8 +1351,6 @@ tools::Polygon BitmapEx::GetContour( bool bContourEdgeDetect,
if( ( fFactorX != 0. ) && ( fFactorY != 0. ) )
aRetPoly.Scale( fFactorX, fFactorY );
}
Bitmap::ReleaseAccess(pAcc);
}
return aRetPoly;
@ -1361,8 +1359,8 @@ tools::Polygon BitmapEx::GetContour( bool bContourEdgeDetect,
void BitmapEx::ChangeColorAlpha( sal_uInt8 cIndexFrom, sal_Int8 nAlphaTo )
{
AlphaMask aAlphaMask(GetAlphaMask());
AlphaMask::ScopedWriteAccess pAlphaWriteAccess(aAlphaMask);
Bitmap::ScopedReadAccess pReadAccess(maBitmap);
BitmapScopedWriteAccess pAlphaWriteAccess(aAlphaMask);
BitmapScopedReadAccess pReadAccess(maBitmap);
assert( pReadAccess.get() && pAlphaWriteAccess.get() );
if ( !(pReadAccess.get() && pAlphaWriteAccess.get()) )
return;
@ -1392,7 +1390,7 @@ void BitmapEx::AdjustTransparency(sal_uInt8 cTrans)
else
{
aAlpha = GetAlphaMask();
AlphaMask::ScopedWriteAccess pA(aAlpha);
BitmapScopedWriteAccess pA(aAlpha);
assert(pA);
if( !pA )
@ -1453,7 +1451,7 @@ void BitmapEx::GetColorModel(css::uno::Sequence< sal_Int32 >& rRGBPalette,
sal_uInt32& rnRedMask, sal_uInt32& rnGreenMask, sal_uInt32& rnBlueMask, sal_uInt32& rnAlphaMask, sal_uInt32& rnTransparencyIndex,
sal_uInt32& rnWidth, sal_uInt32& rnHeight, sal_uInt8& rnBitCount)
{
Bitmap::ScopedReadAccess pReadAccess( maBitmap );
BitmapScopedReadAccess pReadAccess( maBitmap );
assert( pReadAccess );
if( pReadAccess->HasPalette() )

View file

@ -21,8 +21,8 @@
#include <tools/helpers.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <bitmap/BitmapFastScaleFilter.hxx>
BitmapEx BitmapFastScaleFilter::execute(BitmapEx const& rBitmapEx) const
@ -40,7 +40,7 @@ BitmapEx BitmapFastScaleFilter::execute(BitmapEx const& rBitmapEx) const
if (nNewWidth > 0 && nNewHeight > 0)
{
Bitmap::ScopedReadAccess pReadAcc(aBitmap);
BitmapScopedReadAccess pReadAcc(aBitmap);
if (pReadAcc)
{

View file

@ -9,7 +9,7 @@
*/
#include <vcl/BitmapFilterStackBlur.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <sal/log.hxx>
#include <comphelper/threadpool.hxx>
@ -484,7 +484,7 @@ void runStackBlur(Bitmap& rBitmap, const sal_Int32 nRadius, const sal_Int32 nCom
auto pTag = comphelper::ThreadPool::createThreadTaskTag();
{
Bitmap::ScopedReadAccess pReadAccess(rBitmap);
BitmapScopedReadAccess pReadAccess(rBitmap);
BitmapScopedWriteAccess pWriteAccess(rBitmap);
BlurSharedData aSharedData(pReadAccess.get(), pWriteAccess.get(), nRadius,
nComponentWidth, nColorChannels);
@ -507,7 +507,7 @@ void runStackBlur(Bitmap& rBitmap, const sal_Int32 nRadius, const sal_Int32 nCom
rShared.waitUntilDone(pTag);
}
{
Bitmap::ScopedReadAccess pReadAccess(rBitmap);
BitmapScopedReadAccess pReadAccess(rBitmap);
BitmapScopedWriteAccess pWriteAccess(rBitmap);
BlurSharedData aSharedData(pReadAccess.get(), pWriteAccess.get(), nRadius,
nComponentWidth, nColorChannels);
@ -539,7 +539,7 @@ void runStackBlur(Bitmap& rBitmap, const sal_Int32 nRadius, const sal_Int32 nCom
else
{
{
Bitmap::ScopedReadAccess pReadAccess(rBitmap);
BitmapScopedReadAccess pReadAccess(rBitmap);
BitmapScopedWriteAccess pWriteAccess(rBitmap);
BlurSharedData aSharedData(pReadAccess.get(), pWriteAccess.get(), nRadius,
nComponentWidth, nColorChannels);
@ -548,7 +548,7 @@ void runStackBlur(Bitmap& rBitmap, const sal_Int32 nRadius, const sal_Int32 nCom
pBlurHorizontalFn(aSharedData, nFirstIndex, nLastIndex);
}
{
Bitmap::ScopedReadAccess pReadAccess(rBitmap);
BitmapScopedReadAccess pReadAccess(rBitmap);
BitmapScopedWriteAccess pWriteAccess(rBitmap);
BlurSharedData aSharedData(pReadAccess.get(), pWriteAccess.get(), nRadius,
nComponentWidth, nColorChannels);
@ -629,7 +629,7 @@ Bitmap BitmapFilterStackBlur::filter(Bitmap const& rBitmap) const
Bitmap bitmapCopy(rBitmap);
ScanlineFormat nScanlineFormat;
{
Bitmap::ScopedReadAccess pReadAccess(bitmapCopy);
BitmapScopedReadAccess pReadAccess(bitmapCopy);
nScanlineFormat = pReadAccess ? pReadAccess->GetScanlineFormat() : ScanlineFormat::NONE;
}

View file

@ -13,8 +13,7 @@
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/BitmapGaussianSeparableBlurFilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
BitmapEx BitmapGaussianSeparableBlurFilter::execute(BitmapEx const& rBitmapEx) const
{
@ -33,7 +32,7 @@ BitmapEx BitmapGaussianSeparableBlurFilter::execute(BitmapEx const& rBitmapEx) c
// Do horizontal filtering
blurContributions(nWidth, aNumberOfContributions, aBlurVector, aWeights, aPixels, aCounts);
Bitmap::ScopedReadAccess pReadAcc(aBitmap);
BitmapScopedReadAccess pReadAcc(aBitmap);
// switch coordinates as convolution pass transposes result
Bitmap aNewBitmap(Size(nHeight, nWidth), vcl::PixelFormat::N24_BPP);
@ -59,7 +58,7 @@ BitmapEx BitmapGaussianSeparableBlurFilter::execute(BitmapEx const& rBitmapEx) c
// Do vertical filtering
blurContributions(nHeight, aNumberOfContributions, aBlurVector, aWeights, aPixels, aCounts);
pReadAcc = Bitmap::ScopedReadAccess(aBitmap);
pReadAcc = aBitmap;
aNewBitmap = Bitmap(Size(nWidth, nHeight), vcl::PixelFormat::N24_BPP);
bResult = convolutionPass(aBitmap, aNewBitmap, pReadAcc.get(), aNumberOfContributions,
aWeights.data(), aPixels.data(), aCounts.data());

View file

@ -23,7 +23,12 @@
#include <svdata.hxx>
#include <salinst.hxx>
BitmapInfoAccess::BitmapInfoAccess(Bitmap& rBitmap, BitmapAccessMode nMode)
BitmapInfoAccess::BitmapInfoAccess(const AlphaMask& rBitmap, BitmapAccessMode nMode)
: BitmapInfoAccess(rBitmap.GetBitmap(), nMode)
{
}
BitmapInfoAccess::BitmapInfoAccess(const Bitmap& rBitmap, BitmapAccessMode nMode)
: mpBuffer(nullptr)
, mnAccessMode(nMode)
{
@ -39,7 +44,7 @@ BitmapInfoAccess::BitmapInfoAccess(Bitmap& rBitmap, BitmapAccessMode nMode)
if (xImpBmp.use_count() > 2)
{
xImpBmp.reset();
rBitmap.ImplMakeUnique();
const_cast<Bitmap&>(rBitmap).ImplMakeUnique();
xImpBmp = rBitmap.ImplGetSalBitmap();
}
}
@ -52,7 +57,7 @@ BitmapInfoAccess::BitmapInfoAccess(Bitmap& rBitmap, BitmapAccessMode nMode)
if (xNewImpBmp->Create(*xImpBmp, rBitmap.getPixelFormat()))
{
xImpBmp = xNewImpBmp;
rBitmap.ImplSetSalBitmap(xImpBmp);
const_cast<Bitmap&>(rBitmap).ImplSetSalBitmap(xImpBmp);
mpBuffer = xImpBmp->AcquireBuffer(mnAccessMode);
}
}

View file

@ -22,7 +22,7 @@
#include <vcl/bitmapex.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <bitmap/BitmapFastScaleFilter.hxx>
#include <bitmap/BitmapInterpolateScaleFilter.hxx>
@ -37,7 +37,7 @@ BitmapEx BitmapInterpolateScaleFilter::execute(BitmapEx const& rBitmapEx) const
if ((nNewWidth > 1) && (nNewHeight > 1))
{
Bitmap::ScopedReadAccess pReadAcc(aBitmap);
BitmapScopedReadAccess pReadAcc(aBitmap);
if (pReadAcc)
{
sal_Int32 nWidth = pReadAcc->Width();
@ -143,8 +143,8 @@ BitmapEx BitmapInterpolateScaleFilter::execute(BitmapEx const& rBitmapEx) const
const Bitmap aOriginal(aBitmap);
aBitmap = aNewBmp;
aNewBmp = Bitmap(Size(nNewWidth, nNewHeight), vcl::PixelFormat::N24_BPP);
pReadAcc = Bitmap::ScopedReadAccess(aBitmap);
pWriteAcc = BitmapScopedWriteAccess(aNewBmp);
pReadAcc = aBitmap;
pWriteAcc = aNewBmp;
if (pReadAcc && pWriteAcc)
{

View file

@ -10,7 +10,7 @@
#include <basegfx/color/bcolortools.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <bitmap/BitmapLightenFilter.hxx>
BitmapEx BitmapLightenFilter::execute(BitmapEx const& rBitmapEx) const
@ -20,7 +20,7 @@ BitmapEx BitmapLightenFilter::execute(BitmapEx const& rBitmapEx) const
Bitmap aBitmap(rBitmapEx.GetBitmap());
Bitmap aDarkBitmap(aSize, vcl::PixelFormat::N24_BPP);
Bitmap::ScopedReadAccess pRead(aBitmap);
BitmapScopedReadAccess pRead(aBitmap);
BitmapScopedWriteAccess pWrite(aDarkBitmap);
if (pRead && pWrite)

View file

@ -10,7 +10,7 @@
#include <basegfx/color/bcolortools.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <bitmap/BitmapMaskToAlphaFilter.hxx>
/**
@ -23,7 +23,7 @@ BitmapEx BitmapMaskToAlphaFilter::execute(BitmapEx const& rBitmapEx) const
Bitmap aBitmap(rBitmapEx.GetBitmap());
Bitmap aOutBitmap(aSize, vcl::PixelFormat::N8_BPP, &Bitmap::GetGreyPalette(256));
Bitmap::ScopedReadAccess pRead(aBitmap);
BitmapScopedReadAccess pRead(aBitmap);
BitmapScopedWriteAccess pWrite(aOutBitmap);
if (pRead && pWrite)

View file

@ -11,8 +11,7 @@
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/BitmapMedianFilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#define S2(a, b) \
{ \
@ -53,7 +52,7 @@ BitmapEx BitmapMedianFilter::execute(BitmapEx const& rBitmapEx) const
{
Bitmap aBitmap(rBitmapEx.GetBitmap());
Bitmap::ScopedReadAccess pReadAcc(aBitmap);
BitmapScopedReadAccess pReadAcc(aBitmap);
if (!pReadAcc)
return BitmapEx();

View file

@ -11,13 +11,12 @@
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/BitmapMonochromeFilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
BitmapEx BitmapMonochromeFilter::execute(BitmapEx const& aBitmapEx) const
{
Bitmap aBitmap = aBitmapEx.GetBitmap();
Bitmap::ScopedReadAccess pReadAcc(aBitmap);
BitmapScopedReadAccess pReadAcc(aBitmap);
if (!pReadAcc)
return BitmapEx();

View file

@ -11,8 +11,7 @@
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/BitmapMosaicFilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
BitmapEx BitmapMosaicFilter::execute(BitmapEx const& rBitmapEx) const
{
@ -23,18 +22,19 @@ BitmapEx BitmapMosaicFilter::execute(BitmapEx const& rBitmapEx) const
if (mnTileWidth > 1 || mnTileHeight > 1)
{
std::optional<Bitmap> pNewBmp;
BitmapReadAccess* pReadAcc;
BitmapWriteAccess* pWriteAcc;
BitmapScopedReadAccess pReadAcc;
BitmapScopedWriteAccess pWriteAcc;
if (!isPalettePixelFormat(aBitmap.getPixelFormat()))
{
pReadAcc = pWriteAcc = aBitmap.AcquireWriteAccess();
pReadAcc = aBitmap;
pWriteAcc = aBitmap;
}
else
{
pNewBmp.emplace(aBitmap.GetSizePixel(), vcl::PixelFormat::N24_BPP);
pReadAcc = aBitmap.AcquireReadAccess();
pWriteAcc = pNewBmp->AcquireWriteAccess();
pReadAcc = aBitmap;
pWriteAcc = *pNewBmp;
}
bool bConditionsMet = false;
@ -156,10 +156,8 @@ BitmapEx BitmapMosaicFilter::execute(BitmapEx const& rBitmapEx) const
bRet = true;
}
if (pWriteAcc == pReadAcc)
pWriteAcc = nullptr;
Bitmap::ReleaseAccess(pReadAcc);
Bitmap::ReleaseAccess(pWriteAcc);
pReadAcc.reset();
pWriteAcc.reset();
if (pNewBmp)
{

View file

@ -12,8 +12,7 @@
#include <vcl/bitmap.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/BitmapPopArtFilter.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
BitmapEx BitmapPopArtFilter::execute(BitmapEx const& rBitmapEx) const
{

View file

@ -24,7 +24,12 @@
#include <svdata.hxx>
#include <salinst.hxx>
BitmapReadAccess::BitmapReadAccess(Bitmap& rBitmap, BitmapAccessMode nMode)
BitmapReadAccess::BitmapReadAccess(const AlphaMask& rBitmap, BitmapAccessMode nMode)
: BitmapReadAccess(rBitmap.GetBitmap(), nMode)
{
}
BitmapReadAccess::BitmapReadAccess(const Bitmap& rBitmap, BitmapAccessMode nMode)
: BitmapInfoAccess(rBitmap, nMode)
, mFncGetPixel(nullptr)
, mFncSetPixel(nullptr)

View file

@ -20,7 +20,7 @@
#include <osl/diagnose.h>
#include <tools/helpers.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
#include <vcl/BitmapWriteAccess.hxx>
#include <bitmap/BitmapScaleConvolutionFilter.hxx>
#include <algorithm>
@ -97,7 +97,7 @@ bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& rSc
return true;
}
Bitmap::ScopedReadAccess pReadAcc(rSource);
BitmapScopedReadAccess pReadAcc(rSource);
if(pReadAcc)
{
@ -187,7 +187,7 @@ bool ImplScaleConvolutionVer(Bitmap& rSource, Bitmap& rTarget, const double& rSc
return true;
}
Bitmap::ScopedReadAccess pReadAcc(rSource);
BitmapScopedReadAccess pReadAcc(rSource);
if(!pReadAcc)
return false;

Some files were not shown because too many files have changed in this diff Show more