Mercurial > hg > svgui
comparison layer/ScrollableImageCache.cpp @ 1036:bc9b4a163926 spectrogram-minor-refactor
Fix cache validity boundary condition
author | Chris Cannam |
---|---|
date | Tue, 02 Feb 2016 14:28:00 +0000 |
parents | 6d084d6d5015 |
children | 25b035362c44 |
comparison
equal
deleted
inserted
replaced
1035:6d084d6d5015 | 1036:bc9b4a163926 |
---|---|
98 | 98 |
99 void | 99 void |
100 ScrollableImageCache::adjustToTouchValidArea(int &left, int &width, | 100 ScrollableImageCache::adjustToTouchValidArea(int &left, int &width, |
101 bool &isLeftOfValidArea) const | 101 bool &isLeftOfValidArea) const |
102 { | 102 { |
103 #ifdef DEBUG_SCROLLABLE_IMAGE_CACHE | |
104 cerr << "ScrollableImageCache::adjustToTouchValidArea: left " << left | |
105 << ", width " << width << endl; | |
106 cerr << "ScrollableImageCache: my left " << m_left | |
107 << ", width " << m_width << " so right " << (m_left + m_width) << endl; | |
108 #endif | |
103 if (left < m_left) { | 109 if (left < m_left) { |
104 isLeftOfValidArea = true; | 110 isLeftOfValidArea = true; |
105 if (left + width < m_left + m_width) { | 111 if (left + width <= m_left + m_width) { |
106 width = m_left - left; | 112 width = m_left - left; |
107 } | 113 } |
114 #ifdef DEBUG_SCROLLABLE_IMAGE_CACHE | |
115 cerr << "ScrollableImageCache: we're left of valid area, adjusted width to " << width << endl; | |
116 #endif | |
108 } else { | 117 } else { |
109 isLeftOfValidArea = false; | 118 isLeftOfValidArea = false; |
110 width = left + width - (m_left + m_width); | 119 width = left + width - (m_left + m_width); |
111 left = m_left + m_width; | 120 left = m_left + m_width; |
112 if (width < 0) width = 0; | 121 if (width < 0) width = 0; |
122 #ifdef DEBUG_SCROLLABLE_IMAGE_CACHE | |
123 cerr << "ScrollableImageCache: we're right of valid area, adjusted left to " << left << ", width to " << width << endl; | |
124 #endif | |
113 } | 125 } |
114 } | 126 } |
115 | 127 |
116 void | 128 void |
117 ScrollableImageCache::drawImage(int left, | 129 ScrollableImageCache::drawImage(int left, |