From 0a2328e0eff7a11aa49b7da8f013e658153a7b1a Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Fri, 17 Aug 2018 18:38:19 +0000 Subject: Optimize rendering of 2D barcodes: create Rect only on black regions. This is a ~2x improvement in rendering time, taking my example down from ~390ms per barcode to ~190ms. Bug: 872907 Change-Id: Iecddc30edf92ad943765d4382b332e00d493c320 Reviewed-on: https://pdfium-review.googlesource.com/40533 Reviewed-by: Lei Zhang Commit-Queue: Henrique Nakashima --- fxbarcode/BC_TwoDimWriter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fxbarcode') diff --git a/fxbarcode/BC_TwoDimWriter.cpp b/fxbarcode/BC_TwoDimWriter.cpp index 6852fee35c..09f39c2443 100644 --- a/fxbarcode/BC_TwoDimWriter.cpp +++ b/fxbarcode/BC_TwoDimWriter.cpp @@ -42,11 +42,11 @@ void CBC_TwoDimWriter::RenderDeviceResult(CFX_RenderDevice* device, } for (int32_t x = 0; x < m_output->GetWidth(); x++) { for (int32_t y = 0; y < m_output->GetHeight(); y++) { - CFX_PathData rect; - rect.AppendRect((float)leftPos + x, (float)topPos + y, - (float)(leftPos + x + 1), (float)(topPos + y + 1)); if (m_output->Get(x, y)) { CFX_GraphStateData data; + CFX_PathData rect; + rect.AppendRect((float)leftPos + x, (float)topPos + y, + (float)(leftPos + x + 1), (float)(topPos + y + 1)); device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING); } } -- cgit v1.2.3