Set projection matrix for systems with OpenGL 3.1

The projection matrix should also be set for systems
running OpenGL 3.1 with GL_ARB_compatibility extension.

Task-number: QTBUG-28284

This fix is based on Commit 9514422eeecb468fbf0a60604f5699f9caba3f39
from qt/qtbase project.

Change-Id: Iadc5bf3a0e73e401e5c8c5b220fb9bd0ace3970f
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Fix drawing of 0-width polylines from outside the devicerect.

This was broken by a previous fix which aimed to fix gaps in
polylines with tiny line segments. The result was that we
skipped updating the origin point when stroke() didn't produce
pixels which accidentally included the case of the line
being completely outside the deviceRect. I fixed this
by returning the value of clipLine in drawLine to the caller
so we could still update the origin for this case.

Task-number: QTBUG-31579
Change-Id: Iac29436f042da7658bbeaf9370351dc6f2c95065
(cherry picked from qtbase/900cccfd459fcbdbc4aa3d313afe12cfbf68fd87)
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
can show the Cocoa color panel repeatedly

Task-number: QTBUG-11188
Change-Id: I8491985dd6f04971a7aae2ccf7a53fd7294b799b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>