no need for shared_ptr here
avoid an allocation and some pointer chasing Signed-off-by: Noel Grandin <noel.grandin@collabora.co.uk> Change-Id: I29711075d4bf840c2ef992341a6dadeeb87c6edd
This commit is contained in:
parent
a7359becd5
commit
6cb5570b87
1 changed files with 7 additions and 7 deletions
|
@ -293,8 +293,8 @@ namespace RenderTiles
|
|||
pngPool.pushWork([=,&output,&pixmap,&tiles,&renderedTiles,
|
||||
&pngMutex,&deltaGen]()
|
||||
{
|
||||
auto data = std::shared_ptr<std::vector< char >>(new std::vector< char >());
|
||||
data->reserve(pixmapWidth * pixmapHeight * 1);
|
||||
std::vector< char > data;
|
||||
data.reserve(pixmapWidth * pixmapHeight * 1);
|
||||
|
||||
// FIXME: don't try to store & create deltas for read-only documents.
|
||||
if (tiles[tileIndex].getId() < 0) // not a preview
|
||||
|
@ -311,14 +311,14 @@ namespace RenderTiles
|
|||
tileCombined.getPart(),
|
||||
canonicalViewId
|
||||
),
|
||||
*data, wireId, forceKeyframe);
|
||||
data, wireId, forceKeyframe);
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME: write our own trivial PNG encoding code using deflate.
|
||||
LOG_TRC("Encode a new png for tile #" << tileIndex);
|
||||
if (!Png::encodeSubBufferToPNG(pixmap.data(), offsetX, offsetY, pixelWidth, pixelHeight,
|
||||
pixmapWidth, pixmapHeight, *data, mode))
|
||||
pixmapWidth, pixmapHeight, data, mode))
|
||||
{
|
||||
// FIXME: Return error.
|
||||
// sendTextFrameAndLogError("error: cmd=tile kind=failure");
|
||||
|
@ -327,10 +327,10 @@ namespace RenderTiles
|
|||
}
|
||||
}
|
||||
|
||||
LOG_TRC("Tile " << tileIndex << " is " << data->size() << " bytes.");
|
||||
LOG_TRC("Tile " << tileIndex << " is " << data.size() << " bytes.");
|
||||
std::unique_lock<std::mutex> pngLock(pngMutex);
|
||||
output.insert(output.end(), data->begin(), data->end());
|
||||
pushRendered(renderedTiles, tiles[tileIndex], wireId, data->size());
|
||||
output.insert(output.end(), data.begin(), data.end());
|
||||
pushRendered(renderedTiles, tiles[tileIndex], wireId, data.size());
|
||||
});
|
||||
}
|
||||
tileIndex++;
|
||||
|
|
Loading…
Reference in a new issue