From 4174b5ab6ac9024acb9b42acbb61d628a2a679e3 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 10 Aug 2018 00:13:37 +0000 Subject: Add CFX_DIBSource::GetWritableScanline(). Remove a bunch of const_cast or equivalent. This will also help when we convert to span<>, since casting spans is a nuisance. Change-Id: I330e5041cbaf33a84425fc4242a3dfacf5ca8011 Reviewed-on: https://pdfium-review.googlesource.com/39831 Commit-Queue: Lei Zhang Reviewed-by: Lei Zhang --- core/fxge/dib/cfx_bitmapcomposer.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'core/fxge/dib/cfx_bitmapcomposer.cpp') diff --git a/core/fxge/dib/cfx_bitmapcomposer.cpp b/core/fxge/dib/cfx_bitmapcomposer.cpp index 3854949207..22e1bc9b65 100644 --- a/core/fxge/dib/cfx_bitmapcomposer.cpp +++ b/core/fxge/dib/cfx_bitmapcomposer.cpp @@ -112,13 +112,11 @@ void CFX_BitmapComposer::ComposeScanline(int line, m_pClipMask->GetPitch() + (m_DestLeft - m_pClipRgn->GetBox().left); } - uint8_t* dest_scan = - const_cast(m_pBitmap->GetScanline(line + m_DestTop)) + - m_DestLeft * m_pBitmap->GetBPP() / 8; + uint8_t* dest_scan = m_pBitmap->GetWritableScanline(line + m_DestTop) + + m_DestLeft * m_pBitmap->GetBPP() / 8; uint8_t* dest_alpha_scan = m_pBitmap->m_pAlphaMask - ? const_cast( - m_pBitmap->m_pAlphaMask->GetScanline(line + m_DestTop)) + + ? m_pBitmap->m_pAlphaMask->GetWritableScanline(line + m_DestTop) + m_DestLeft : nullptr; DoCompose(dest_scan, scanline, m_DestWidth, clip_scan, scan_extra_alpha, -- cgit v1.2.3