Cocoa: reimplement QPlatformBackingStore::scroll()
Use qt_scrollImageInRect() from QtGui to accelerate scrolling in the Cocoa plugin. Change-Id: I8ad1377ed3307345f72d17c72049cec5472c97d3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>bb10
parent
b2363a935c
commit
eac97c5830
|
|
@ -60,6 +60,7 @@ public:
|
|||
QPaintDevice *paintDevice();
|
||||
void flush(QWindow *widget, const QRegion ®ion, const QPoint &offset);
|
||||
void resize (const QSize &size, const QRegion &);
|
||||
bool scroll(const QRegion &area, int dx, int dy);
|
||||
|
||||
private:
|
||||
QCocoaWindow *m_cocoaWindow;
|
||||
|
|
|
|||
|
|
@ -97,4 +97,16 @@ void QCocoaBackingStore::resize(const QSize &size, const QRegion &)
|
|||
[static_cast<QNSView *>(m_cocoaWindow->m_contentView) setImage:m_image];
|
||||
}
|
||||
|
||||
bool QCocoaBackingStore::scroll(const QRegion &area, int dx, int dy)
|
||||
{
|
||||
extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset);
|
||||
QPoint qpoint(dx, dy);
|
||||
const QVector<QRect> qrects = area.rects();
|
||||
for (int i = 0; i < qrects.count(); ++i) {
|
||||
const QRect &qrect = qrects.at(i);
|
||||
qt_scrollRectInImage(*m_image, qrect, qpoint);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
Loading…
Reference in New Issue