From 696a5293bb771d17c5f23b8ef73c0f961045ef30 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 10 Aug 2018 16:48:37 +0000 Subject: Make CFX_ImageTransformer::CalcData's bitmap non-const. Change-Id: I1d5e3e73804efb0a8ed467d29777d017935a8824 Reviewed-on: https://pdfium-review.googlesource.com/39833 Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- core/fxge/dib/cfx_imagetransformer.cpp | 12 ++++++------ core/fxge/dib/cfx_imagetransformer.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp index 37f56b57dc..c41ac2bdf2 100644 --- a/core/fxge/dib/cfx_imagetransformer.cpp +++ b/core/fxge/dib/cfx_imagetransformer.cpp @@ -480,7 +480,7 @@ void CFX_ImageTransformer::DoBilinearLoop( std::function 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 @@ void CFX_ImageTransformer::DoBilinearLoop( 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(dest)); + func(d, dest); } dest += increment; } @@ -509,7 +509,7 @@ void CFX_ImageTransformer::DoBicubicLoop( std::function 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 @@ void CFX_ImageTransformer::DoBicubicLoop( 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(dest)); + func(d, dest); } dest += increment; } @@ -536,7 +536,7 @@ void CFX_ImageTransformer::DoDownSampleLoop( std::function 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 @@ void CFX_ImageTransformer::DoDownSampleLoop( 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(dest)); + func(d, dest); } dest += increment; } diff --git a/core/fxge/dib/cfx_imagetransformer.h b/core/fxge/dib/cfx_imagetransformer.h index 97dd61f9e1..a5b8841611 100644 --- a/core/fxge/dib/cfx_imagetransformer.h +++ b/core/fxge/dib/cfx_imagetransformer.h @@ -61,7 +61,7 @@ class CFX_ImageTransformer { }; struct CalcData { - const CFX_DIBitmap* bitmap; + CFX_DIBitmap* bitmap; const CFX_Matrix& matrix; const uint8_t* buf; uint32_t pitch; -- cgit v1.2.3