summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/dib/cstretchengine.cpp7
-rw-r--r--core/fxge/dib/cstretchengine.h8
2 files changed, 11 insertions, 4 deletions
diff --git a/core/fxge/dib/cstretchengine.cpp b/core/fxge/dib/cstretchengine.cpp
index 9d3923adab..ad9a356f34 100644
--- a/core/fxge/dib/cstretchengine.cpp
+++ b/core/fxge/dib/cstretchengine.cpp
@@ -206,10 +206,11 @@ bool CStretchEngine::CWeightTable::Calc(int dest_len,
return true;
}
-PixelWeight* CStretchEngine::CWeightTable::GetPixelWeight(int pixel) const {
+const PixelWeight* CStretchEngine::CWeightTable::GetPixelWeight(
+ int pixel) const {
ASSERT(pixel >= m_DestMin);
- return reinterpret_cast<PixelWeight*>(const_cast<uint8_t*>(
- m_WeightTables.data() + (pixel - m_DestMin) * m_ItemSize));
+ return reinterpret_cast<const PixelWeight*>(
+ &m_WeightTables[(pixel - m_DestMin) * m_ItemSize]);
}
int* CStretchEngine::CWeightTable::GetValueFromPixelWeight(PixelWeight* pWeight,
diff --git a/core/fxge/dib/cstretchengine.h b/core/fxge/dib/cstretchengine.h
index fa298f5376..c9f11d6006 100644
--- a/core/fxge/dib/cstretchengine.h
+++ b/core/fxge/dib/cstretchengine.h
@@ -46,7 +46,13 @@ class CStretchEngine {
int src_min,
int src_max,
int flags);
- PixelWeight* GetPixelWeight(int pixel) const;
+
+ const PixelWeight* GetPixelWeight(int pixel) const;
+ PixelWeight* GetPixelWeight(int pixel) {
+ return const_cast<PixelWeight*>(
+ static_cast<const CWeightTable*>(this)->GetPixelWeight(pixel));
+ }
+
int* GetValueFromPixelWeight(PixelWeight* pWeight, int index) const;
size_t GetPixelWeightSize() const;