summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/impgraph.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-12-30 17:13:35 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-01-20 09:06:23 +0100
commitc36cef138a840af013cf85d33ea3d3d27aeb001a (patch)
tree900cae430b5e000add7278285540effdba14dc22 /vcl/source/gdi/impgraph.cxx
parentbca1b74c0753f2305a5e234293df88aa3e1d9af0 (diff)
vcl: Improve graphic manager swapping allocation
This improves the counting of the used space by graphics and makes the manager loop faster. Change-Id: Ifebe5fe52722d0f22dae0d1bdef02f65afb036ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109595 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source/gdi/impgraph.cxx')
-rw-r--r--vcl/source/gdi/impgraph.cxx18
1 files changed, 11 insertions, 7 deletions
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 1e56e57a8226..30db3e932bb9 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1276,6 +1276,8 @@ bool ImpGraphic::swapOut()
bool bResult = false;
+ sal_Int64 nByteSize = getSizeBytes();
+
// We have GfxLink so we have the source available
if (mpGfxLink && mpGfxLink->IsNative())
{
@@ -1289,9 +1291,6 @@ bool ImpGraphic::swapOut()
// mark as swapped out
mbSwapOut = true;
- // Signal to manager that we have swapped out
- vcl::graphic::Manager::get().swappedOut(this);
-
bResult = true;
}
else
@@ -1331,12 +1330,15 @@ bool ImpGraphic::swapOut()
mpSwapFile = std::move(pSwapFile);
mbSwapOut = true;
-
- // Signal to manager that we have swapped out
- vcl::graphic::Manager::get().swappedOut(this);
}
}
+ if (bResult)
+ {
+ // Signal to manager that we have swapped out
+ vcl::graphic::Manager::get().swappedOut(this, nByteSize);
+ }
+
return bResult;
}
@@ -1480,7 +1482,9 @@ bool ImpGraphic::swapIn()
}
if (bReturn)
- vcl::graphic::Manager::get().swappedIn(this);
+ {
+ vcl::graphic::Manager::get().swappedIn(this, getSizeBytes());
+ }
return bReturn;
}