Make CFX_ImageTransformer::CalcData's bitmap non-const. Change-Id: I1d5e3e73804efb0a8ed467d29777d017935a8824 Reviewed-on: https://pdfium-review.googlesource.com/39833 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp index 37f56b5..c41ac2b 100644 --- a/core/fxge/dib/cfx_imagetransformer.cpp +++ b/core/fxge/dib/cfx_imagetransformer.cpp
@@ -480,7 +480,7 @@ std::function<void(const BilinearData&, uint8_t*)> func) { CFX_BilinearMatrix matrix_fix(cdata.matrix); for (int row = 0; row < m_result.Height(); row++) { - const uint8_t* dest = cdata.bitmap->GetScanline(row); + uint8_t* dest = cdata.bitmap->GetWritableScanline(row); for (int col = 0; col < m_result.Width(); col++) { BilinearData d; d.res_x = 0; @@ -496,7 +496,7 @@ AdjustCoords(&d.src_col_r, &d.src_row_r); d.row_offset_l = d.src_row_l * cdata.pitch; d.row_offset_r = d.src_row_r * cdata.pitch; - func(d, const_cast<uint8_t*>(dest)); + func(d, dest); } dest += increment; } @@ -509,7 +509,7 @@ std::function<void(const BicubicData&, uint8_t*)> func) { CFX_BilinearMatrix matrix_fix(cdata.matrix); for (int row = 0; row < m_result.Height(); row++) { - const uint8_t* dest = cdata.bitmap->GetScanline(row); + uint8_t* dest = cdata.bitmap->GetWritableScanline(row); for (int col = 0; col < m_result.Width(); col++) { BicubicData d; d.res_x = 0; @@ -523,7 +523,7 @@ bicubic_get_pos_weight(d.pos_pixel, d.u_w, d.v_w, d.src_col_l, d.src_row_l, d.res_x, d.res_y, stretch_width(), stretch_height()); - func(d, const_cast<uint8_t*>(dest)); + func(d, dest); } dest += increment; } @@ -536,7 +536,7 @@ std::function<void(const DownSampleData&, uint8_t*)> func) { CPDF_FixedMatrix matrix_fix(cdata.matrix); for (int row = 0; row < m_result.Height(); row++) { - const uint8_t* dest = cdata.bitmap->GetScanline(row); + uint8_t* dest = cdata.bitmap->GetWritableScanline(row); for (int col = 0; col < m_result.Width(); col++) { DownSampleData d; d.src_col = 0; @@ -544,7 +544,7 @@ matrix_fix.Transform(col, row, &d.src_col, &d.src_row); if (LIKELY(InStretchBounds(d.src_col, d.src_row))) { AdjustCoords(&d.src_col, &d.src_row); - func(d, const_cast<uint8_t*>(dest)); + func(d, dest); } dest += increment; }
diff --git a/core/fxge/dib/cfx_imagetransformer.h b/core/fxge/dib/cfx_imagetransformer.h index 97dd61f..a5b8841 100644 --- a/core/fxge/dib/cfx_imagetransformer.h +++ b/core/fxge/dib/cfx_imagetransformer.h
@@ -61,7 +61,7 @@ }; struct CalcData { - const CFX_DIBitmap* bitmap; + CFX_DIBitmap* bitmap; const CFX_Matrix& matrix; const uint8_t* buf; uint32_t pitch;