From ce6a1cc587a7d5db7655a915dd18b1c1f0ef2de2 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Thu, 23 Aug 2018 19:02:30 +0000 Subject: Reorder RenderResult and RenderDeviceResult in CBC_TwoDimWriter. They should appear in the order that they are necessarily called. Change-Id: I6901d384122003f72b0c43bf1df6260e2e196a7d Reviewed-on: https://pdfium-review.googlesource.com/41050 Commit-Queue: Henrique Nakashima Reviewed-by: Ryan Harrison --- fxbarcode/BC_TwoDimWriter.cpp | 86 +++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'fxbarcode') 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(m_Width) / m_outputWidth, 0.0, 0.0, - static_cast(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(m_Width) / m_outputWidth, 0.0, 0.0, + static_cast(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); + } + } + } +} -- cgit v1.2.3