summaryrefslogtreecommitdiff
path: root/fxbarcode/oned/BC_OneDimWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fxbarcode/oned/BC_OneDimWriter.cpp')
-rw-r--r--fxbarcode/oned/BC_OneDimWriter.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp
index 14c5911f95..71f440faf1 100644
--- a/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -268,21 +268,39 @@ bool CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
CFX_GraphStateData stateData;
CFX_PathData path;
- path.AppendRect(0, 0, (float)m_Width, (float)m_Height);
+ path.AppendRect(0, 0, static_cast<float>(m_Width),
+ static_cast<float>(m_Height));
device->DrawPath(&path, matrix, &stateData, m_backgroundColor,
m_backgroundColor, FXFILL_ALTERNATE);
- CFX_Matrix matri(m_outputHScale, 0.0, 0.0, (float)m_Height, 0.0, 0.0);
+ CFX_Matrix matri(m_outputHScale, 0.0, 0.0, static_cast<float>(m_Height), 0.0,
+ 0.0);
matri.Concat(*matrix);
for (int32_t x = 0; x < m_output->GetWidth(); x++) {
+ int32_t yStart = 0;
+ bool drawing = false;
for (int32_t y = 0; y < m_output->GetHeight(); y++) {
- CFX_PathData rect;
- rect.AppendRect((float)x, (float)y, (float)(x + 1), (float)(y + 1));
- if (m_output->Get(x, y)) {
- CFX_GraphStateData data;
- device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING);
+ bool draw = m_output->Get(x, y);
+ if (!drawing) {
+ if (draw) {
+ drawing = true;
+ yStart = y;
+ }
+ continue;
}
+
+ if (draw && y != m_output->GetHeight() - 1)
+ continue;
+
+ drawing = false;
+ int32_t yEnd = draw ? y + 1 : y;
+ CFX_PathData rect;
+ rect.AppendRect(static_cast<float>(x), static_cast<float>(yStart),
+ static_cast<float>((x + 1)), static_cast<float>(yEnd));
+ CFX_GraphStateData data;
+ device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING);
}
}
+
return m_locTextLoc == BC_TEXT_LOC_NONE || contents.Find(' ') == -1 ||
ShowChars(contents, device, matrix, m_barWidth, m_multiple);
}