mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[escher] Optimize drawing in scroll view
Change-Id: Ibb3d3a30f6a51df5a410e9040884f8f20e27ee4c
This commit is contained in:
@@ -58,9 +58,16 @@ void ScrollView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
if (!m_colorBackground) {
|
||||
return;
|
||||
}
|
||||
ctx->fillRect(bounds(), m_backgroundColor);
|
||||
// Future optimization: avoid drawing behind the content view/
|
||||
//ctx->fillRect(KDRect(m_leftMargin, m_contentView->bounds().height()+m_topMargin, width-m_leftMargin-m_rightMargin, height- m_contentView->bounds().height())-m_topMargin, m_backgroundColor);
|
||||
KDCoordinate height = bounds().height();
|
||||
KDCoordinate width = bounds().width();
|
||||
KDCoordinate offsetX = m_offset.x();
|
||||
KDCoordinate offsetY = m_offset.y();
|
||||
KDCoordinate contentHeight = m_contentView->bounds().height();
|
||||
KDCoordinate contentWidth = m_contentView->bounds().width();
|
||||
ctx->fillRect(KDRect(0, 0, width, m_topMargin-offsetY), m_backgroundColor);
|
||||
ctx->fillRect(KDRect(0, contentHeight+m_topMargin-offsetY, width, height - contentHeight - m_topMargin + offsetY), m_backgroundColor);
|
||||
ctx->fillRect(KDRect(0, 0, m_leftMargin-offsetX, height), m_backgroundColor);
|
||||
ctx->fillRect(KDRect(contentWidth + m_leftMargin - offsetX, 0, width - contentWidth - m_leftMargin + offsetX, height), m_backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user