OSDN Git Service

optimize QWidgetPrivate::mapToWS() and QWidgetPrivate::mapFromWS()
authorIvailo Monev <xakepa10@gmail.com>
Sat, 24 Oct 2020 20:13:56 +0000 (23:13 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Sat, 24 Oct 2020 20:13:56 +0000 (23:13 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/kernel/qwidget_p.h

index 4b9c303..6f6772d 100644 (file)
@@ -516,10 +516,10 @@ public:
     { return p + data.wrect.topLeft(); }
 
     inline QRect mapToWS(const QRect &r) const
-    { QRect rr(r); rr.translate(-data.wrect.topLeft()); return rr; }
+    { return r.translated(-data.wrect.topLeft()); }
 
     inline QRect mapFromWS(const QRect &r) const
-    { QRect rr(r); rr.translate(data.wrect.topLeft()); return rr; }
+    { return r.translated(data.wrect.topLeft()); }
 
     // Variables.
     // Regular pointers (keep them together to avoid gaps on 64 bit architectures).