summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-11-21 22:04:27 -0500
committerAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-12-05 07:44:56 -0500
commit77006b579ab1f05099883d63be9d214050304a02 (patch)
tree150583d3f5eeeeebe380365f76e973e3672c8ae3
parentbcff1e08212f60d7bd38f357636cf6e12d006932 (diff)
LOK: tilebench improvements
Minor improvements from cd-5.3 Reviewed-on: https://gerrit.libreoffice.org/45090 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com> (cherry picked from commit 84db465fdf9314b4a775d7cfb6558bd91bae7ab9) Change-Id: If8439834cef9b0a2988a6d2c25d63b2b5bc6087f
-rw-r--r--libreofficekit/qa/tilebench/tilebench.cxx34
1 files changed, 17 insertions, 17 deletions
diff --git a/libreofficekit/qa/tilebench/tilebench.cxx b/libreofficekit/qa/tilebench/tilebench.cxx
index 08cf8abff6ab..e326bd9220bd 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -67,7 +67,7 @@ int main( int argc, char* argv[] )
long nTileTwipWidth = 3840;
long nTileTwipHeight = 3840;
- aTimes.push_back(TimeRecord("initialization"));
+ aTimes.emplace_back("initialization");
// coverity[tainted_string] - build time test tool
Office *pOffice = lok_cpp_init(argv[1]);
aTimes.push_back(TimeRecord());
@@ -77,19 +77,19 @@ int main( int argc, char* argv[] )
if (argv[2] != nullptr)
{
- aTimes.push_back(TimeRecord("load document"));
+ aTimes.emplace_back("load document");
Document *pDocument(pOffice->documentLoad(argv[2]));
- aTimes.push_back(TimeRecord());
+ aTimes.emplace_back();
- aTimes.push_back(TimeRecord("getparts"));
+ aTimes.emplace_back("getparts");
const int nOriginalPart = pDocument->getPart();
// Writer really has 1 part (the full doc).
const int nTotalParts = (pDocument->getDocumentType() == LOK_DOCTYPE_TEXT ? 1 : pDocument->getParts());
const int nParts = (max_parts < 0 ? nTotalParts : std::min(max_parts, nTotalParts));
fprintf(stderr, "Parts to render: %d, Total Parts: %d, Max parts: %d, Max tiles: %d\n", nParts, nTotalParts, max_parts, max_tiles);
- aTimes.push_back(TimeRecord());
+ aTimes.emplace_back();
- aTimes.push_back(TimeRecord("get size of parts"));
+ aTimes.emplace_back("get size of parts");
for (int n = 0; n < nParts; ++n)
{
const int nPart = (nOriginalPart + n) % nTotalParts;
@@ -100,7 +100,7 @@ int main( int argc, char* argv[] )
fprintf (stderr, " '%s' -> %ld, %ld\n", pName, nWidth, nHeight);
free (pName);
}
- aTimes.push_back(TimeRecord());
+ aTimes.emplace_back();
std::vector<unsigned char> vBuffer(nTilePixelWidth * nTilePixelHeight * 4);
unsigned char* pPixels = &vBuffer[0];
@@ -117,17 +117,17 @@ int main( int argc, char* argv[] )
if (pDocument->getDocumentType() != LOK_DOCTYPE_TEXT)
{ // whole part; meaningful only for non-writer documents.
- aTimes.push_back(TimeRecord("render whole part"));
+ aTimes.emplace_back(TimeRecord("render whole part"));
pDocument->paintTile(pPixels, nTilePixelWidth, nTilePixelHeight,
0, 0, nWidth, nHeight); // not square
- aTimes.push_back(TimeRecord());
+ aTimes.emplace_back();
}
{ // 1:1
- aTimes.push_back(TimeRecord("render sub-region at 1:1"));
+ aTimes.emplace_back("render sub-region at 1:1");
// Estimate the maximum tiles based on the number of parts requested, if Writer.
int nMaxTiles = max_tiles;
- if (pDocument->getDocumentType() == LOK_DOCTYPE_TEXT && nMaxTiles < 0)
+ if (pDocument->getDocumentType() == LOK_DOCTYPE_TEXT)
nMaxTiles = (int)ceil(max_parts * 16128. / nTilePixelHeight) * ceil((double)nWidth / nTilePixelWidth);
int nTiles = 0;
for (int nY = 0; nY < nHeight - 1; nY += nTilePixelHeight)
@@ -147,14 +147,14 @@ int main( int argc, char* argv[] )
nTiles, nX, nY);
}
}
- aTimes.push_back(TimeRecord());
+ aTimes.emplace_back();
}
{ // scaled
- aTimes.push_back(TimeRecord("render sub-regions at scale"));
+ aTimes.emplace_back("render sub-regions at scale");
// Estimate the maximum tiles based on the number of parts requested, if Writer.
int nMaxTiles = max_tiles;
- if (pDocument->getDocumentType() == LOK_DOCTYPE_TEXT && nMaxTiles < 0)
+ if (pDocument->getDocumentType() == LOK_DOCTYPE_TEXT)
nMaxTiles = (int)ceil(max_parts * 16128. / nTileTwipHeight) * ceil((double)nWidth / nTileTwipWidth);
int nTiles = 0;
for (int nY = 0; nY < nHeight - 1; nY += nTileTwipHeight)
@@ -174,13 +174,13 @@ int main( int argc, char* argv[] )
nTiles, nX, nY);
}
}
- aTimes.push_back(TimeRecord());
+ aTimes.emplace_back();
}
}
- aTimes.push_back(TimeRecord("destroy document"));
+ aTimes.emplace_back("destroy document");
delete pDocument;
- aTimes.push_back(TimeRecord());
+ aTimes.emplace_back();
}
delete pOffice;