Mercurial > hg > svgui
changeset 953:fe46201414c8 osx-retina
Fix rendering of selections
author | Chris Cannam |
---|---|
date | Wed, 29 Apr 2015 12:37:23 +0100 |
parents | b1aa74ce697e |
children | 17cb48115d22 |
files | view/View.cpp |
diffstat | 1 files changed, 37 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/view/View.cpp Mon Apr 27 11:38:01 2015 +0100 +++ b/view/View.cpp Wed Apr 29 12:37:23 2015 +0100 @@ -1704,6 +1704,8 @@ QRect nonCacheRect(cacheRect); + int dpratio = devicePixelRatio(); + // If not all layers are scrollable, but some of the back layers // are, we should store only those in the cache. @@ -1715,25 +1717,34 @@ // If all the non-scrollable layers are non-opaque, then we draw // the selection rectangle behind them and cache it. If any are - // opaque, however, we can't cache. + // opaque, however, or if our device-pixel ratio is not 1 (so we + // need to paint direct to the widget), then we can't cache. // - if (!selectionCacheable) { - selectionCacheable = true; - for (LayerList::const_iterator i = nonScrollables.begin(); - i != nonScrollables.end(); ++i) { - if ((*i)->isLayerOpaque()) { - selectionCacheable = false; - break; - } - } - } - - if (selectionCacheable) { - QPoint localPos; - bool closeToLeft, closeToRight; - if (shouldIlluminateLocalSelection(localPos, closeToLeft, closeToRight)) { - selectionCacheable = false; - } + if (dpratio == 1) { + + if (!selectionCacheable) { + selectionCacheable = true; + for (LayerList::const_iterator i = nonScrollables.begin(); + i != nonScrollables.end(); ++i) { + if ((*i)->isLayerOpaque()) { + selectionCacheable = false; + break; + } + } + } + + if (selectionCacheable) { + QPoint localPos; + bool closeToLeft, closeToRight; + if (shouldIlluminateLocalSelection + (localPos, closeToLeft, closeToRight)) { + selectionCacheable = false; + } + } + + } else { + + selectionCacheable = false; } #ifdef DEBUG_VIEW_WIDGET_PAINT @@ -1751,8 +1762,6 @@ m_selectionCached = false; } - int dpratio = devicePixelRatio(); - QSize scaledCacheSize(scaledSize(size(), dpratio)); QRect scaledCacheRect(scaledRect(cacheRect, dpratio)); @@ -1924,10 +1933,15 @@ } paint.end(); - - paint.begin(m_buffer); + + paint.begin(this); + QRect finalPaintRect = e ? e->rect() : rect(); + paint.drawPixmap(finalPaintRect, *m_buffer, scaledRect(finalPaintRect, dpratio)); + paint.end(); + + paint.begin(this); setPaintFont(paint); - if (e) paint.setClipRect(scaledRect(e->rect(), dpratio)); + if (e) paint.setClipRect(e->rect()); if (!m_selectionCached) { drawSelections(paint); } @@ -1949,11 +1963,6 @@ } } - paint.begin(this); - QRect finalPaintRect = e ? e->rect() : rect(); - paint.drawPixmap(finalPaintRect, *m_buffer, scaledRect(finalPaintRect, dpratio)); - paint.end(); - if (showPlayPointer) { paint.begin(this);