From dc2bb9ad21a10550fb451d7c842c63cbce98045b Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Tue, 21 Aug 2018 19:50:17 +0000 Subject: Optimize rendering of two dimensional barcodes: defer upscale. Defer upscaling as late as possible so that intermediary data structures are smaller. Made a couple of changes along the way to preserve the barcode correctness and fix some padding issues. For my example, this is a ~21x improvement in rendering time, down from ~190ms per barcode to ~9ms. Bug: 872907, pdfium:1135 Change-Id: If532e0f168f02fea9c31d473f34c0009da4f4612 Reviewed-on: https://pdfium-review.googlesource.com/40010 Reviewed-by: Lei Zhang Commit-Queue: Henrique Nakashima --- fxbarcode/common/BC_CommonBitMatrix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fxbarcode/common') diff --git a/fxbarcode/common/BC_CommonBitMatrix.cpp b/fxbarcode/common/BC_CommonBitMatrix.cpp index a8a6e53bc1..54b1affa71 100644 --- a/fxbarcode/common/BC_CommonBitMatrix.cpp +++ b/fxbarcode/common/BC_CommonBitMatrix.cpp @@ -59,8 +59,8 @@ bool CBC_CommonBitMatrix::Get(int32_t x, int32_t y) const { void CBC_CommonBitMatrix::Set(int32_t x, int32_t y) { int32_t offset = y * m_rowSize + (x >> 5); - if (offset >= m_rowSize * m_height || offset < 0) - return; + ASSERT(offset >= 0); + ASSERT(offset < m_rowSize * m_height); m_bits[offset] |= 1 << (x & 0x1f); } -- cgit v1.2.3