diff options
Diffstat (limited to 'fxbarcode')
-rw-r--r-- | fxbarcode/BC_TwoDimWriter.cpp | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/fxbarcode/BC_TwoDimWriter.cpp b/fxbarcode/BC_TwoDimWriter.cpp index 36e554c6cf..bff37dfb89 100644 --- a/fxbarcode/BC_TwoDimWriter.cpp +++ b/fxbarcode/BC_TwoDimWriter.cpp @@ -19,49 +19,6 @@ CBC_TwoDimWriter::CBC_TwoDimWriter() : m_iCorrectLevel(1), m_bFixedSize(true) {} CBC_TwoDimWriter::~CBC_TwoDimWriter() {} -void CBC_TwoDimWriter::RenderDeviceResult(CFX_RenderDevice* device, - const CFX_Matrix* matrix) { - ASSERT(m_output); - - CFX_GraphStateData stateData; - CFX_PathData path; - path.AppendRect(0, 0, (float)m_Width, (float)m_Height); - device->DrawPath(&path, matrix, &stateData, m_backgroundColor, - m_backgroundColor, FXFILL_ALTERNATE); - int32_t leftPos = m_leftPadding; - int32_t topPos = m_topPadding; - - CFX_Matrix matri = *matrix; - if (m_Width < m_outputWidth && m_Height < m_outputHeight) { - CFX_Matrix matriScale(static_cast<float>(m_Width) / m_outputWidth, 0.0, 0.0, - static_cast<float>(m_Height) / m_outputHeight, 0.0, - 0.0); - matriScale.Concat(*matrix); - matri = matriScale; - } - - CFX_GraphStateData data; - for (int32_t x = 0; x < m_inputWidth; x++) { - for (int32_t y = 0; y < m_inputHeight; y++) { - if (m_output->Get(x, y)) { - // In the output, each module is shifted by 1 due to the one module - // padding added to create quiet areas. - int start_x_output = x + 1; - int end_x_output = x + 2; - int start_y_output = y + 1; - int end_y_output = y + 2; - - CFX_PathData rect; - rect.AppendRect(leftPos + start_x_output * m_multiX, - topPos + start_y_output * m_multiY, - leftPos + end_x_output * m_multiX, - topPos + end_y_output * m_multiY); - device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING); - } - } - } -} - int32_t CBC_TwoDimWriter::GetErrorCorrectionLevel() const { return m_iCorrectLevel; } @@ -123,3 +80,46 @@ bool CBC_TwoDimWriter::RenderResult(uint8_t* code, } return true; } + +void CBC_TwoDimWriter::RenderDeviceResult(CFX_RenderDevice* device, + const CFX_Matrix* matrix) { + ASSERT(m_output); + + CFX_GraphStateData stateData; + CFX_PathData path; + path.AppendRect(0, 0, (float)m_Width, (float)m_Height); + device->DrawPath(&path, matrix, &stateData, m_backgroundColor, + m_backgroundColor, FXFILL_ALTERNATE); + int32_t leftPos = m_leftPadding; + int32_t topPos = m_topPadding; + + CFX_Matrix matri = *matrix; + if (m_Width < m_outputWidth && m_Height < m_outputHeight) { + CFX_Matrix matriScale(static_cast<float>(m_Width) / m_outputWidth, 0.0, 0.0, + static_cast<float>(m_Height) / m_outputHeight, 0.0, + 0.0); + matriScale.Concat(*matrix); + matri = matriScale; + } + + CFX_GraphStateData data; + for (int32_t x = 0; x < m_inputWidth; x++) { + for (int32_t y = 0; y < m_inputHeight; y++) { + if (m_output->Get(x, y)) { + // In the output, each module is shifted by 1 due to the one module + // padding added to create quiet areas. + int start_x_output = x + 1; + int end_x_output = x + 2; + int start_y_output = y + 1; + int end_y_output = y + 2; + + CFX_PathData rect; + rect.AppendRect(leftPos + start_x_output * m_multiX, + topPos + start_y_output * m_multiY, + leftPos + end_x_output * m_multiX, + topPos + end_y_output * m_multiY); + device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING); + } + } + } +} |