[Libreoffice-commits] core.git: vcl/inc vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Sun Apr 14 23:58:05 UTC 2019
vcl/inc/bitmap/impoctree.hxx | 35 -------------------------
vcl/source/bitmap/Octree.cxx | 60 +++++++++++++++++++++++++++++++------------
2 files changed, 44 insertions(+), 51 deletions(-)
New commits:
commit 36679103fb538f514416768027636c9d484866b1
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Apr 14 23:33:43 2019 +0900
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Apr 15 01:57:07 2019 +0200
move ImpNodeCache into Octree.cxx and clean-up
ImpNodeCache is specific to Octree so it's best that it lives
near the source.
Change-Id: I35e937343312b0ab18ed1a4dcaa067ea01a0191f
Reviewed-on: https://gerrit.libreoffice.org/70736
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/vcl/inc/bitmap/impoctree.hxx b/vcl/inc/bitmap/impoctree.hxx
index 727551123c5c..06fbd69249d0 100644
--- a/vcl/inc/bitmap/impoctree.hxx
+++ b/vcl/inc/bitmap/impoctree.hxx
@@ -104,41 +104,6 @@ inline BitmapColor ImpErrorQuad::ImplGetColor()
std::clamp(nBlue, 0L, 8160L) >> 5);
}
-class ImpNodeCache
-{
- OctreeNode* pActNode;
-
-public:
- ImpNodeCache(const sal_uLong nInitSize);
- ~ImpNodeCache();
-
- inline OctreeNode* ImplGetFreeNode();
- inline void ImplReleaseNode(OctreeNode* pNode);
-};
-
-inline OctreeNode* ImpNodeCache::ImplGetFreeNode()
-{
- OctreeNode* pNode;
-
- if (!pActNode)
- {
- pActNode = new OctreeNode;
- pActNode->pNextInCache = nullptr;
- }
-
- pNode = pActNode;
- pActNode = pNode->pNextInCache;
- memset(pNode, 0, sizeof(OctreeNode));
-
- return pNode;
-}
-
-inline void ImpNodeCache::ImplReleaseNode(OctreeNode* pNode)
-{
- pNode->pNextInCache = pActNode;
- pActNode = pNode;
-}
-
#endif // INCLUDED_VCL_INC_IMPOCTREE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/bitmap/Octree.cxx b/vcl/source/bitmap/Octree.cxx
index 5f291e6ab8fb..592d17c1d469 100644
--- a/vcl/source/bitmap/Octree.cxx
+++ b/vcl/source/bitmap/Octree.cxx
@@ -23,7 +23,6 @@
#include <vcl/bitmapaccess.hxx>
#include <bitmap/Octree.hxx>
-#include <bitmap/impoctree.hxx>
namespace
{
@@ -34,30 +33,59 @@ constexpr sal_uLong gnBits = 8 - OCTREE_BITS;
} // end anonymous namespace
-ImpNodeCache::ImpNodeCache(const sal_uLong nInitSize)
- : pActNode(nullptr)
+class ImpNodeCache
{
- const sal_uLong nSize = nInitSize + 4;
+private:
+ OctreeNode* mpActNode;
- for (sal_uLong i = 0; i < nSize; i++)
+public:
+ ImpNodeCache(const sal_uLong nInitSize)
+ : mpActNode(nullptr)
{
- OctreeNode* pNewNode = new OctreeNode;
+ const sal_uLong nSize = nInitSize + 4;
- pNewNode->pNextInCache = pActNode;
- pActNode = pNewNode;
+ for (sal_uLong i = 0; i < nSize; i++)
+ {
+ OctreeNode* pNewNode = new OctreeNode;
+
+ pNewNode->pNextInCache = mpActNode;
+ mpActNode = pNewNode;
+ }
}
-}
-ImpNodeCache::~ImpNodeCache()
-{
- while (pActNode)
+ ~ImpNodeCache()
{
- OctreeNode* pNode = pActNode;
+ while (mpActNode)
+ {
+ OctreeNode* pNode = mpActNode;
- pActNode = pNode->pNextInCache;
- delete pNode;
+ mpActNode = pNode->pNextInCache;
+ delete pNode;
+ }
}
-}
+
+ OctreeNode* ImplGetFreeNode()
+ {
+ OctreeNode* pNode;
+
+ if (!mpActNode)
+ {
+ mpActNode = new OctreeNode;
+ mpActNode->pNextInCache = nullptr;
+ }
+
+ pNode = mpActNode;
+ mpActNode = pNode->pNextInCache;
+ memset(pNode, 0, sizeof(OctreeNode));
+
+ return pNode;
+ }
+ void ImplReleaseNode(OctreeNode* pNode)
+ {
+ pNode->pNextInCache = mpActNode;
+ mpActNode = pNode;
+ }
+};
Octree::Octree(const BitmapReadAccess& rReadAcc, sal_uLong nColors)
: mnLeafCount(0)
More information about the Libreoffice-commits
mailing list