# HG changeset patch # User Chris Cannam # Date 1454423280 0 # Node ID bc9b4a163926ac15a8f1ed2a264f4225bd203990 # Parent 6d084d6d50151dabe6f0b076dbedab840e95df90 Fix cache validity boundary condition diff -r 6d084d6d5015 -r bc9b4a163926 layer/ScrollableImageCache.cpp --- a/layer/ScrollableImageCache.cpp Tue Feb 02 10:44:07 2016 +0000 +++ b/layer/ScrollableImageCache.cpp Tue Feb 02 14:28:00 2016 +0000 @@ -100,16 +100,28 @@ ScrollableImageCache::adjustToTouchValidArea(int &left, int &width, bool &isLeftOfValidArea) const { +#ifdef DEBUG_SCROLLABLE_IMAGE_CACHE + cerr << "ScrollableImageCache::adjustToTouchValidArea: left " << left + << ", width " << width << endl; + cerr << "ScrollableImageCache: my left " << m_left + << ", width " << m_width << " so right " << (m_left + m_width) << endl; +#endif if (left < m_left) { isLeftOfValidArea = true; - if (left + width < m_left + m_width) { + if (left + width <= m_left + m_width) { width = m_left - left; } +#ifdef DEBUG_SCROLLABLE_IMAGE_CACHE + cerr << "ScrollableImageCache: we're left of valid area, adjusted width to " << width << endl; +#endif } else { isLeftOfValidArea = false; width = left + width - (m_left + m_width); left = m_left + m_width; if (width < 0) width = 0; +#ifdef DEBUG_SCROLLABLE_IMAGE_CACHE + cerr << "ScrollableImageCache: we're right of valid area, adjusted left to " << left << ", width to " << width << endl; +#endif } }