Project

General

Profile

p2j.screen_diff_2.txt

Sergey Ivanovskiy, 08/26/2015 07:29 PM

Download (8.47 KB)

 
1
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js'
2
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2015-08-26 22:39:14 +0000
3
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2015-08-26 23:04:07 +0000
4
@@ -925,6 +925,7 @@
5
                var y1 =  p2j.socket.readInt32BinaryMessage(message, idx + 5);
6
                var x2 =  p2j.socket.readInt32BinaryMessage(message, idx + 9);
7
                var y2 =  p2j.socket.readInt32BinaryMessage(message, idx + 13);
8
+               extra = " x1 = " + x1 +"; y1 = " + y1 + "; x2 = " + x2 + "; y2 = " + y2;
9
                path = this.drawLine(this.ctx, x1, y1, x2, y2, this.rawColor);
10
                
11
                strokesManager.applyStrokeToPath(this.ctx,
12
@@ -932,7 +933,6 @@
13
                                                 this.strokeWidth,
14
                                                 this.rawColor,
15
                                                 path);
16
-               this.ctx.stroke();
17
                break;
18
             case ops.DRAW_RECT:
19
                x      = p2j.socket.readInt32BinaryMessage(message, idx + 1);
20
@@ -954,6 +954,7 @@
21
                width    = p2j.socket.readInt32BinaryMessage(message, idx + 9);
22
                height   = p2j.socket.readInt32BinaryMessage(message, idx + 13);
23
                diameter = p2j.socket.readInt32BinaryMessage(message, idx + 17);
24
+               extra = " x = " + x +"; y = " + y + "; width = " + width + "; height = " + height + "; diameter = " + diameter;
25
                this.drawRoundRect(ctx, x, y, width, height, diameter, this.rawColor, false);
26
                break;
27
             case ops.DRAW_IMAGE:
28
@@ -1014,7 +1015,13 @@
29
                   yPoints[j] = p2j.socket.readInt32BinaryMessage(message, offset);
30
                }
31
                
32
-               this.drawPolygon(this.ctx, xPoints, yPoints, numPoints, this.rawColor, true);
33
+               var path = this.drawPolygon(this.ctx, xPoints, yPoints, numPoints, this.rawColor, true);
34
+               strokesManager.applyStrokeToPath(this.ctx,
35
+                     this.strokeStyleId,
36
+                     this.strokeWidth,
37
+                     this.rawColor,
38
+                     path);
39
+
40
                break;
41
             case ops.DRAW_3D_RECT:
42
             case ops.FILL_3D_RECT:
43
@@ -1090,6 +1097,7 @@
44
                y =  p2j.socket.readInt32BinaryMessage(message, idx + 5);
45
                this.canvas.style.left = x.toString() + "px";
46
                this.canvas.style.top  = y.toString() + "px";
47
+               extra = " x = " + x +"; y = " + y;
48
                break;
49
             case ops.RESIZE_WINDOW:
50
                width  = p2j.socket.readInt32BinaryMessage(message, idx + 1);
51
@@ -1128,7 +1136,6 @@
52
          }
53
          
54
          logstack.push("PaintPrimitives." + ops[type] + " " + extra);
55
-         
56
          idx += sz;
57
       }
58
       
59
@@ -1546,23 +1553,25 @@
60
          ctx.beginPath();
61
          ctx.rect(x, y, width - inset, height - inset);
62
          renderClosedPath(ctx, fill);
63
-      }
64
-      
65
-      // now overdraw the stroked portion to eliminate anti-aliasing, we draw in a
66
-      // clockwise direction (since we are not using paths, this is not strictly necessary)
67
-      var path = this.drawLine(ctx, x, y, x + width - inset, y, color);
68
-      
69
-      var more = this.drawLine(ctx, x + width - inset, y + 1, x + width - inset, y + height - inset, color);
70
-      Array.prototype.push.apply(path, more);
71
-      
72
-      more = this.drawLine(ctx, x + width - 1 - inset, y + height - inset, x + 1, y + height - inset, color);
73
-      Array.prototype.push.apply(path, more);
74
-      
75
-      // close the path
76
-      more = this.drawLine(ctx, x, y + height - inset, x, y + 1, color);
77
-      Array.prototype.push.apply(path, more);
78
-      
79
-      return path;
80
+         return [];
81
+      }
82
+      else
83
+      {
84
+         // now overdraw the stroked portion to eliminate anti-aliasing, we draw in a
85
+         // clockwise direction (since we are not using paths, this is not strictly necessary)
86
+         var path = this.drawLine(ctx, x, y, x + width - inset, y, color);
87
+         
88
+         var more = this.drawLine(ctx, x + width - inset, y + 1, x + width - inset, y + height - inset, color);
89
+         Array.prototype.push.apply(path, more);
90
+         
91
+         more = this.drawLine(ctx, x + width - 1 - inset, y + height - inset, x + 1, y + height - inset, color);
92
+         Array.prototype.push.apply(path, more);
93
+         
94
+         // close the path
95
+         more = this.drawLine(ctx, x, y + height - inset, x, y + 1, color);
96
+         Array.prototype.push.apply(path, more);
97
+         return path;
98
+      }
99
    };
100
    
101
    /**
102
@@ -1842,10 +1851,19 @@
103
       renderClosedPath(ctx, fill);
104
       
105
       // overdraw the anti-aliased line segments              
106
-      this.drawLine(ctx, topLeftX, topLeftY, topRightX, topRightY, color);
107
-      this.drawLine(ctx, rightUpX, rightUpY, rightDownX, rightDownY, color);
108
-      this.drawLine(ctx, bottomLeftX, bottomLeftY, bottomRightX, bottomRightY, color);
109
-      this.drawLine(ctx, leftUpX, leftUpY, leftDownX, leftDownY, color);
110
+      
111
+      var path = this.drawLine(ctx, topLeftX, topLeftY, topRightX, topRightY, color);
112
+      var more = this.drawLine(ctx, rightUpX, rightUpY, rightDownX, rightDownY, color);
113
+      Array.prototype.push.apply(path, more);
114
+      more = this.drawLine(ctx, bottomLeftX, bottomLeftY, bottomRightX, bottomRightY, color);
115
+      Array.prototype.push.apply(path, more);
116
+      more = this.drawLine(ctx, leftUpX, leftUpY, leftDownX, leftDownY, color);
117
+      Array.prototype.push.apply(path, more);
118
+      strokesManager.applyStrokeToPath(this.ctx,
119
+            this.strokeStyleId,
120
+            this.strokeWidth,
121
+            color,
122
+            path);
123
    };
124
    
125
    /**
126
@@ -1887,8 +1905,8 @@
127
       ctx.save();
128
       
129
       // the Java implementation draws 1 pixel larger in each dimension
130
-      width  = width + 1;
131
-      height = height + 1;
132
+      //width  = width + 1;
133
+      //height = height + 1;
134
       
135
       // setup our clipping region, this is needed because the line width (1 pixel wide) is
136
       // drawn half on one side of hte path and half on the other side; this makes paths a
137
@@ -1905,10 +1923,9 @@
138
       // fill the rectangle with the original color (raised mode) or the darker color otherwise
139
       if (fill)
140
       {
141
-         inset = 1;
142
          ctx.fillStyle = createColorString(current);
143
          ctx.beginPath();
144
-         ctx.rect(x, y, width - 2, height - 2);
145
+         ctx.rect(x, y, width - 1, height - 1);
146
          renderClosedPath(ctx, fill);
147
       }
148
       
149
@@ -1916,14 +1933,26 @@
150
       
151
       // draw the top and left sides in the contrasting color (raised mode) or the darker color
152
       // otherwise
153
-      this.drawLine(ctx, x, y, x + width - 2 - inset, y, current);
154
-      this.drawLine(ctx, x, y + 1, x, y + height - 1 - inset, current);
155
-      
156
+      var path = this.drawLine(ctx, x, y, x + width - 1, y, current);
157
+      var more = this.drawLine(ctx, x, y + 1, x, y + height - 1, current);
158
+      Array.prototype.push.apply(path, more);
159
+      strokesManager.applyStrokeToPath(this.ctx,
160
+            this.strokeStyleId,
161
+            this.strokeWidth,
162
+            current,
163
+            path);
164
+
165
       // draw the bottom and right sides in the darker color (raised mode) or the contrasting
166
       // color otherwise
167
       current = raised ? darker : lighter;
168
-      this.drawLine(ctx, x + 1, y + height - 1 - inset, x + width - 1 - inset, y + height - 1 - inset, current);
169
-      this.drawLine(ctx, x + width - 1 - inset, y, x + width - 1 - inset, y + height - 2, current);
170
+      path = this.drawLine(ctx, x + 1, y + height - 1, x + width -1, y + height - 1, current);
171
+      more = this.drawLine(ctx, x + width - 1, y, x + width -1, y + height - 1, current);
172
+      Array.prototype.push.apply(path, more);
173
+      strokesManager.applyStrokeToPath(this.ctx,
174
+            this.strokeStyleId,
175
+            this.strokeWidth,
176
+            current,
177
+            path);
178
       
179
       // clear the clipping region
180
       ctx.restore();
181
@@ -1966,12 +1995,14 @@
182
          ctx.closePath();
183
          renderClosedPath(ctx, fill);
184
       }
185
-      
186
+      var path = [];
187
       // now overdraw the stroked portion
188
       for (i = 0; i < (num - 1); i++)
189
       {
190
-         this.drawLine(ctx, xPoints[i], yPoints[i], xPoints[i + 1], yPoints[i + 1], color);
191
+         var more = this.drawLine(ctx, xPoints[i], yPoints[i], xPoints[i + 1], yPoints[i + 1], color);
192
+         Array.prototype.push.apply(path, more);
193
       }
194
+      return path;
195
    };
196
    
197
    /**
198