From a7e8b400d1ca6cf4e23b02564812ea3ff0bb9015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 2 Apr 2014 08:20:54 +0200 Subject: Cocoa: Make backing store flush accurate. Flush the individual rects that make up the region instead of the bounding rect. This is required for correctness since then areas not included in the region might not have valid backing store content. The bondingRect() usage here had its roots in an optimization in Qt 4, where it was observed that flushing the bounding rect was more efficient than flushing (many) individual rects. Task-number: QTBUG-37918 Change-Id: Ib805f6713523f9895be24c48466870efaaf89c02 Reviewed-by: Liang Qi Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qnsview.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 1197aa9148..e17cd0a4cc 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -371,8 +371,9 @@ static QTouchDevice *touchDevice = 0; { m_backingStore = backingStore; m_backingStoreOffset = offset * m_backingStore->getBackingStoreDevicePixelRatio(); - QRect br = region.boundingRect(); - [self setNeedsDisplayInRect:NSMakeRect(br.x(), br.y(), br.width(), br.height())]; + foreach (QRect rect, region.rects()) { + [self setNeedsDisplayInRect:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())]; + } } - (BOOL) hasMask -- cgit v1.2.3