Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 96:095916d7ed4d
* tuning tweaks
author | Chris Cannam |
---|---|
date | Tue, 09 May 2006 20:39:23 +0000 |
parents | 1b3996a86cfa |
children | a0e7edf9703a |
comparison
equal
deleted
inserted
replaced
95:1b3996a86cfa | 96:095916d7ed4d |
---|---|
1895 y1 = rect.bottom() + 1; | 1895 y1 = rect.bottom() + 1; |
1896 } | 1896 } |
1897 */ | 1897 */ |
1898 | 1898 |
1899 if (recreateWholePixmapCache) { | 1899 if (recreateWholePixmapCache) { |
1900 | |
1901 x0 = 0; | 1900 x0 = 0; |
1902 x1 = v->width(); | 1901 x1 = v->width(); |
1903 // cache.validArea = QRect(x0, 0, x1, v->height()); | 1902 } |
1904 } | 1903 |
1905 | 1904 int paintBlockWidth = (300000 / zoomLevel); |
1906 if (1) {//!!! | 1905 if (paintBlockWidth < 20) paintBlockWidth = 20; |
1907 | 1906 |
1908 int paintBlockWidth = (500000 / zoomLevel); | 1907 if (cache.validArea.width() > 0) { |
1909 if (paintBlockWidth < 20) paintBlockWidth = 20; | 1908 |
1910 | 1909 int vx0 = 0, vx1 = 0; |
1911 if (cache.validArea.width() > 0) { | 1910 vx0 = cache.validArea.x(); |
1912 | 1911 vx1 = cache.validArea.x() + cache.validArea.width(); |
1913 int vx0 = 0, vx1 = 0; | 1912 |
1914 vx0 = cache.validArea.x(); | 1913 #ifdef DEBUG_SPECTROGRAM_REPAINT |
1915 vx1 = cache.validArea.x() + cache.validArea.width(); | 1914 std::cerr << "x0 " << x0 << ", x1 " << x1 << ", vx0 " << vx0 << ", vx1 " << vx1 << ", paintBlockWidth " << paintBlockWidth << std::endl; |
1915 #endif | |
1916 if (x0 < vx0) { | |
1917 if (x0 + paintBlockWidth < vx0) { | |
1918 x0 = vx0 - paintBlockWidth; | |
1919 } else { | |
1920 x0 = 0; | |
1921 } | |
1922 } else if (x0 > vx1) { | |
1923 x0 = vx1; | |
1924 } | |
1916 | 1925 |
1917 #ifdef DEBUG_SPECTROGRAM_REPAINT | 1926 if (x1 < vx0) { |
1918 std::cerr << "x0 " << x0 << ", x1 " << x1 << ", vx0 " << vx0 << ", vx1 " << vx1 << ", paintBlockWidth " << paintBlockWidth << std::endl; | 1927 x1 = vx0; |
1919 #endif | 1928 } else if (x1 > vx1) { |
1920 if (x0 < vx0) { | 1929 if (vx1 + paintBlockWidth < x1) { |
1921 if (x0 + paintBlockWidth < vx0) { | 1930 x1 = vx1 + paintBlockWidth; |
1922 x0 = vx0 - paintBlockWidth; | 1931 } else { |
1923 } else { | 1932 x1 = v->width(); |
1924 x0 = 0; | |
1925 } | |
1926 } else if (x0 > vx1) { | |
1927 x0 = vx1; | |
1928 } | 1933 } |
1934 } | |
1929 | 1935 |
1930 if (x1 < vx0) { | 1936 cache.validArea = QRect |
1931 x1 = vx0; | 1937 (std::min(vx0, x0), cache.validArea.y(), |
1932 } else if (x1 > vx1) { | 1938 std::max(vx1 - std::min(vx0, x0), |
1933 if (vx1 + paintBlockWidth < x1) { | 1939 x1 - std::min(vx0, x0)), |
1934 x1 = vx1 + paintBlockWidth; | 1940 cache.validArea.height()); |
1935 } else { | |
1936 x1 = v->width(); | |
1937 } | |
1938 } | |
1939 | 1941 |
1940 cache.validArea = QRect | 1942 } else { |
1941 (std::min(vx0, x0), cache.validArea.y(), | 1943 if (x1 > x0 + paintBlockWidth) { |
1942 std::max(vx1 - std::min(vx0, x0), | 1944 x1 = x0 + paintBlockWidth; |
1943 x1 - std::min(vx0, x0)), | |
1944 cache.validArea.height()); | |
1945 | |
1946 } else { | |
1947 if (x1 > x0 + paintBlockWidth) { | |
1948 x1 = x0 + paintBlockWidth; | |
1949 } | |
1950 cache.validArea = QRect(x0, 0, x1 - x0, v->height()); | |
1951 } | 1945 } |
1946 cache.validArea = QRect(x0, 0, x1 - x0, v->height()); | |
1952 } | 1947 } |
1953 | 1948 |
1954 int w = x1 - x0; | 1949 int w = x1 - x0; |
1955 int h = y1 - y0; | 1950 int h = y1 - y0; |
1956 | 1951 |