Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Furnadjiev2016-08-09 13:50:51 +0000
committerGerrit Code Review @ Eclipse.org2016-08-29 08:38:11 +0000
commit207a53c0dd9a06343285cc85398b7f867d0e7f75 (patch)
tree398e4f291f5091441b903655ee35964d9adab46f /bundles
parent2142f2bee2a2ba282d1ce30831c902b20b8c795b (diff)
downloadorg.eclipse.rap-207a53c0dd9a06343285cc85398b7f867d0e7f75.tar.gz
org.eclipse.rap-207a53c0dd9a06343285cc85398b7f867d0e7f75.tar.xz
org.eclipse.rap-207a53c0dd9a06343285cc85398b7f867d0e7f75.zip
Fix save/restore graphics context when arc is drawn
Restoring graphics context state on the client in GC.js#_ellipse, before fill/stroke operation may lead to a wrong shape - the transformation set by translate/scale is restored. 499417: [GC] Draw arc is not correct in some cases https://bugs.eclipse.org/bugs/show_bug.cgi?id=499417 Change-Id: I345939a4a060ff1fedc89469539df64b4b116caa
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/widgets/GC.js2
-rw-r--r--bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/canvaskit/GCOperationWriter.java4
2 files changed, 3 insertions, 3 deletions
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/GC.js b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/GC.js
index e01281dc94..a7224940a5 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/GC.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/GC.js
@@ -171,12 +171,10 @@ rwt.qx.Class.define( "rwt.widgets.GC", {
var endAngle = operation[ 7 ];
var dir = operation[ 8 ];
if( rx > 0 && ry > 0 ) {
- this._context.save();
this._context.translate( cx, cy );
// TODO [tb] : using scale here changes the stroke-width also, looks wrong
this._context.scale( 1, ry / rx );
this._context.arc( 0, 0, rx, startAngle, endAngle, dir );
- this._context.restore();
}
},
diff --git a/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/canvaskit/GCOperationWriter.java b/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/canvaskit/GCOperationWriter.java
index be502a27d0..a27fd7dd8a 100644
--- a/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/canvaskit/GCOperationWriter.java
+++ b/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/canvaskit/GCOperationWriter.java
@@ -223,6 +223,7 @@ final class GCOperationWriter {
float cy = operation.y + ry + offset;
float startAngle = round( operation.startAngle * factor * -1, 4 );
float arcAngle = round( operation.arcAngle * factor * -1, 4 );
+ addClientOperation( "save" );
addClientOperation( "beginPath" );
operations.add( new JsonArray()
.add( "ellipse" )
@@ -236,9 +237,10 @@ final class GCOperationWriter {
.add( arcAngle < 0 )
);
if( operation.fill ) {
- addClientOperation( "lineTo", cx, cy );
+ addClientOperation( "closePath" );
}
addClientOperation( operation.fill ? "fill" : "stroke" );
+ addClientOperation( "restore" );
}
private void drawPolyline( DrawPolyline operation ) {

Back to the top