summaryrefslogtreecommitdiff
path: root/fxbarcode/common
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-08-21 19:50:17 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-21 19:50:17 +0000
commitdc2bb9ad21a10550fb451d7c842c63cbce98045b (patch)
treecced6e8df7fdbd424dcc6a4dd9c4f145645fc31c /fxbarcode/common
parentaa58fb5759b937760464a2e63f19f464cd1cfe52 (diff)
downloadpdfium-dc2bb9ad21a10550fb451d7c842c63cbce98045b.tar.xz
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 <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'fxbarcode/common')
-rw-r--r--fxbarcode/common/BC_CommonBitMatrix.cpp4
1 files changed, 2 insertions, 2 deletions
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);
}