summaryrefslogtreecommitdiff
path: root/core/fxge/dib/cfx_dibitmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxge/dib/cfx_dibitmap.cpp')
-rw-r--r--core/fxge/dib/cfx_dibitmap.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp
index f17ca52095..3d642c2e76 100644
--- a/core/fxge/dib/cfx_dibitmap.cpp
+++ b/core/fxge/dib/cfx_dibitmap.cpp
@@ -372,7 +372,7 @@ bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
int srcBytes = pSrcClone->GetBPP() / 8;
int destBytes = pDst->GetBPP() / 8;
for (int row = 0; row < m_Height; row++) {
- uint8_t* dest_pos = (uint8_t*)pDst->GetScanline(row) + destOffset;
+ uint8_t* dest_pos = pDst->GetWritableScanline(row) + destOffset;
const uint8_t* src_pos = pSrcClone->GetScanline(row) + srcOffset;
for (int col = 0; col < m_Width; col++) {
*dest_pos = *src_pos;
@@ -923,7 +923,7 @@ bool CFX_DIBitmap::CompositeBitmap(int dest_left,
: nullptr;
uint8_t* dst_scan_extra_alpha =
m_pAlphaMask
- ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left
+ ? m_pAlphaMask->GetWritableScanline(dest_top + row) + dest_left
: nullptr;
const uint8_t* clip_scan = nullptr;
if (pClipMask) {
@@ -995,7 +995,7 @@ bool CFX_DIBitmap::CompositeMask(int dest_left,
const uint8_t* src_scan = pMask->GetScanline(src_top + row);
uint8_t* dst_scan_extra_alpha =
m_pAlphaMask
- ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left
+ ? m_pAlphaMask->GetWritableScanline(dest_top + row) + dest_left
: nullptr;
const uint8_t* clip_scan = nullptr;
if (pClipMask) {
@@ -1084,10 +1084,8 @@ bool CFX_DIBitmap::CompositeRect(int left,
index = (static_cast<uint8_t>(color) == 0xff) ? 1 : 0;
}
for (int row = rect.top; row < rect.bottom; row++) {
- uint8_t* dest_scan_top =
- const_cast<uint8_t*>(GetScanline(row)) + rect.left / 8;
- uint8_t* dest_scan_top_r =
- const_cast<uint8_t*>(GetScanline(row)) + rect.right / 8;
+ uint8_t* dest_scan_top = GetWritableScanline(row) + rect.left / 8;
+ uint8_t* dest_scan_top_r = GetWritableScanline(row) + rect.right / 8;
uint8_t left_flag = *dest_scan_top & (255 << (8 - left_shift));
uint8_t right_flag = *dest_scan_top_r & (255 >> right_shift);
if (new_width) {
@@ -1126,7 +1124,7 @@ bool CFX_DIBitmap::CompositeRect(int left,
for (int row = rect.top; row < rect.bottom; row++) {
uint8_t* dest_scan = m_pBuffer.Get() + row * m_Pitch + rect.left * Bpp;
uint8_t* dest_scan_alpha =
- m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left
+ m_pAlphaMask ? m_pAlphaMask->GetWritableScanline(row) + rect.left
: nullptr;
if (dest_scan_alpha) {
memset(dest_scan_alpha, 0xff, width);
@@ -1171,7 +1169,7 @@ bool CFX_DIBitmap::CompositeRect(int left,
}
} else {
uint8_t* dest_scan_alpha =
- (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left;
+ m_pAlphaMask->GetWritableScanline(row) + rect.left;
for (int col = 0; col < width; col++) {
uint8_t back_alpha = *dest_scan_alpha;
if (back_alpha == 0) {