diff options
7 files changed, 51 insertions, 6 deletions
diff --git a/src/quick/scenegraph/shaders/outlinedtext.vert b/src/quick/scenegraph/shaders/outlinedtext.vert index ced8afd034..9df832de3c 100644 --- a/src/quick/scenegraph/shaders/outlinedtext.vert +++ b/src/quick/scenegraph/shaders/outlinedtext.vert @@ -1,6 +1,7 @@ uniform highp mat4 matrix; uniform highp vec2 textureScale; uniform highp vec2 shift; +uniform highp float dpr; attribute highp vec4 vCoord; attribute highp vec2 tCoord; @@ -18,5 +19,6 @@ void main() sCoordDown = (tCoord - vec2(0.0, 1.0)) * textureScale; sCoordLeft = (tCoord - vec2(-1.0, 0.0)) * textureScale; sCoordRight = (tCoord - vec2(1.0, 0.0)) * textureScale; - gl_Position = matrix * vCoord; + vec3 dprSnapPos = floor(vCoord.xyz * dpr + 0.5) / dpr; + gl_Position = matrix * vec4(dprSnapPos, vCoord.w); }
\ No newline at end of file diff --git a/src/quick/scenegraph/shaders/outlinedtext_core.vert b/src/quick/scenegraph/shaders/outlinedtext_core.vert index 4aa13101fd..ae945b013a 100644 --- a/src/quick/scenegraph/shaders/outlinedtext_core.vert +++ b/src/quick/scenegraph/shaders/outlinedtext_core.vert @@ -12,6 +12,7 @@ out vec2 sCoordRight; uniform mat4 matrix; uniform vec2 textureScale; uniform vec2 shift; +uniform float dpr; void main() { @@ -20,5 +21,6 @@ void main() sCoordDown = (tCoord - vec2(0.0, 1.0)) * textureScale; sCoordLeft = (tCoord - vec2(-1.0, 0.0)) * textureScale; sCoordRight = (tCoord - vec2(1.0, 0.0)) * textureScale; - gl_Position = matrix * vCoord; + vec3 dprSnapPos = round(vCoord.xyz * dpr + 0.5) / dpr; + gl_Position = matrix * vec4(dprSnapPos, vCoord.w); }
\ No newline at end of file diff --git a/src/quick/scenegraph/shaders/styledtext.vert b/src/quick/scenegraph/shaders/styledtext.vert index 7001bbc262..29c9902609 100644 --- a/src/quick/scenegraph/shaders/styledtext.vert +++ b/src/quick/scenegraph/shaders/styledtext.vert @@ -13,5 +13,6 @@ void main() { sampleCoord = tCoord * textureScale; shiftedSampleCoord = (tCoord - shift) * textureScale; - gl_Position = matrix * floor(vCoord * dpr + 0.5) / dpr; + vec3 dprSnapPos = floor(vCoord.xyz * dpr + 0.5) / dpr; + gl_Position = matrix * vec4(dprSnapPos, vCoord.w); } diff --git a/src/quick/scenegraph/shaders/styledtext_core.vert b/src/quick/scenegraph/shaders/styledtext_core.vert index c522877bb3..7e313eb797 100644 --- a/src/quick/scenegraph/shaders/styledtext_core.vert +++ b/src/quick/scenegraph/shaders/styledtext_core.vert @@ -15,5 +15,6 @@ void main() { sampleCoord = tCoord * textureScale; shiftedSampleCoord = (tCoord - shift) * textureScale; - gl_Position = matrix * round(vCoord * dpr) / dpr; + vec3 dprSnapPos = round(vCoord.xyz * dpr + 0.5) / dpr; + gl_Position = matrix * vec4(dprSnapPos, vCoord.w); } diff --git a/src/quick/scenegraph/shaders/textmask.vert b/src/quick/scenegraph/shaders/textmask.vert index 4c678270d0..1692159d2c 100644 --- a/src/quick/scenegraph/shaders/textmask.vert +++ b/src/quick/scenegraph/shaders/textmask.vert @@ -10,5 +10,6 @@ varying highp vec2 sampleCoord; void main() { sampleCoord = tCoord * textureScale; - gl_Position = matrix * floor(vCoord * dpr + 0.5) / dpr; + vec3 dprSnapPos = floor(vCoord.xyz * dpr + 0.5) / dpr; + gl_Position = matrix * vec4(dprSnapPos, vCoord.w); } diff --git a/src/quick/scenegraph/shaders/textmask_core.vert b/src/quick/scenegraph/shaders/textmask_core.vert index f996040f70..5c510a2d23 100644 --- a/src/quick/scenegraph/shaders/textmask_core.vert +++ b/src/quick/scenegraph/shaders/textmask_core.vert @@ -12,5 +12,6 @@ uniform float dpr; void main() { sampleCoord = tCoord * textureScale; - gl_Position = matrix * round(vCoord * dpr) / dpr; + vec3 dprSnapPos = round(vCoord.xyz * dpr + 0.5) / dpr; + gl_Position = matrix * vec4(dprSnapPos, vCoord.w); } diff --git a/tests/manual/scenegraph_lancelot/data/text/text_style2.qml b/tests/manual/scenegraph_lancelot/data/text/text_style2.qml new file mode 100644 index 0000000000..984ca6a1ed --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/text/text_style2.qml @@ -0,0 +1,37 @@ +import QtQuick 2.0 + +//vary font style + +Item { + width: 320 + height: 480 + + Column { + anchors.fill: parent + Repeater { + model: [Text.Normal, Text.Outline, Text.Raised, Text.Sunken] + Text { + renderType: Text.QtRendering + width: parent.width + wrapMode: Text.Wrap + font.pointSize: 10 + style: modelData + styleColor: "green" + text: "The quick fox jumps in style " + modelData + } + } + + Repeater { + model: [Text.Normal, Text.Outline, Text.Raised, Text.Sunken] + Text { + renderType: Text.NativeRendering + width: parent.width + wrapMode: Text.Wrap + font.pointSize: 10 + style: modelData + styleColor: "green" + text: "The quick fox jumps in style " + modelData + } + } + } +} |