=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js' --- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js 2015-08-26 22:39:14 +0000 +++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js 2015-08-26 23:04:07 +0000 @@ -925,6 +925,7 @@ var y1 = p2j.socket.readInt32BinaryMessage(message, idx + 5); var x2 = p2j.socket.readInt32BinaryMessage(message, idx + 9); var y2 = p2j.socket.readInt32BinaryMessage(message, idx + 13); + extra = " x1 = " + x1 +"; y1 = " + y1 + "; x2 = " + x2 + "; y2 = " + y2; path = this.drawLine(this.ctx, x1, y1, x2, y2, this.rawColor); strokesManager.applyStrokeToPath(this.ctx, @@ -932,7 +933,6 @@ this.strokeWidth, this.rawColor, path); - this.ctx.stroke(); break; case ops.DRAW_RECT: x = p2j.socket.readInt32BinaryMessage(message, idx + 1); @@ -954,6 +954,7 @@ width = p2j.socket.readInt32BinaryMessage(message, idx + 9); height = p2j.socket.readInt32BinaryMessage(message, idx + 13); diameter = p2j.socket.readInt32BinaryMessage(message, idx + 17); + extra = " x = " + x +"; y = " + y + "; width = " + width + "; height = " + height + "; diameter = " + diameter; this.drawRoundRect(ctx, x, y, width, height, diameter, this.rawColor, false); break; case ops.DRAW_IMAGE: @@ -1014,7 +1015,13 @@ yPoints[j] = p2j.socket.readInt32BinaryMessage(message, offset); } - this.drawPolygon(this.ctx, xPoints, yPoints, numPoints, this.rawColor, true); + var path = this.drawPolygon(this.ctx, xPoints, yPoints, numPoints, this.rawColor, true); + strokesManager.applyStrokeToPath(this.ctx, + this.strokeStyleId, + this.strokeWidth, + this.rawColor, + path); + break; case ops.DRAW_3D_RECT: case ops.FILL_3D_RECT: @@ -1090,6 +1097,7 @@ y = p2j.socket.readInt32BinaryMessage(message, idx + 5); this.canvas.style.left = x.toString() + "px"; this.canvas.style.top = y.toString() + "px"; + extra = " x = " + x +"; y = " + y; break; case ops.RESIZE_WINDOW: width = p2j.socket.readInt32BinaryMessage(message, idx + 1); @@ -1128,7 +1136,6 @@ } logstack.push("PaintPrimitives." + ops[type] + " " + extra); - idx += sz; } @@ -1546,23 +1553,25 @@ ctx.beginPath(); ctx.rect(x, y, width - inset, height - inset); renderClosedPath(ctx, fill); - } - - // now overdraw the stroked portion to eliminate anti-aliasing, we draw in a - // clockwise direction (since we are not using paths, this is not strictly necessary) - var path = this.drawLine(ctx, x, y, x + width - inset, y, color); - - var more = this.drawLine(ctx, x + width - inset, y + 1, x + width - inset, y + height - inset, color); - Array.prototype.push.apply(path, more); - - more = this.drawLine(ctx, x + width - 1 - inset, y + height - inset, x + 1, y + height - inset, color); - Array.prototype.push.apply(path, more); - - // close the path - more = this.drawLine(ctx, x, y + height - inset, x, y + 1, color); - Array.prototype.push.apply(path, more); - - return path; + return []; + } + else + { + // now overdraw the stroked portion to eliminate anti-aliasing, we draw in a + // clockwise direction (since we are not using paths, this is not strictly necessary) + var path = this.drawLine(ctx, x, y, x + width - inset, y, color); + + var more = this.drawLine(ctx, x + width - inset, y + 1, x + width - inset, y + height - inset, color); + Array.prototype.push.apply(path, more); + + more = this.drawLine(ctx, x + width - 1 - inset, y + height - inset, x + 1, y + height - inset, color); + Array.prototype.push.apply(path, more); + + // close the path + more = this.drawLine(ctx, x, y + height - inset, x, y + 1, color); + Array.prototype.push.apply(path, more); + return path; + } }; /** @@ -1842,10 +1851,19 @@ renderClosedPath(ctx, fill); // overdraw the anti-aliased line segments - this.drawLine(ctx, topLeftX, topLeftY, topRightX, topRightY, color); - this.drawLine(ctx, rightUpX, rightUpY, rightDownX, rightDownY, color); - this.drawLine(ctx, bottomLeftX, bottomLeftY, bottomRightX, bottomRightY, color); - this.drawLine(ctx, leftUpX, leftUpY, leftDownX, leftDownY, color); + + var path = this.drawLine(ctx, topLeftX, topLeftY, topRightX, topRightY, color); + var more = this.drawLine(ctx, rightUpX, rightUpY, rightDownX, rightDownY, color); + Array.prototype.push.apply(path, more); + more = this.drawLine(ctx, bottomLeftX, bottomLeftY, bottomRightX, bottomRightY, color); + Array.prototype.push.apply(path, more); + more = this.drawLine(ctx, leftUpX, leftUpY, leftDownX, leftDownY, color); + Array.prototype.push.apply(path, more); + strokesManager.applyStrokeToPath(this.ctx, + this.strokeStyleId, + this.strokeWidth, + color, + path); }; /** @@ -1887,8 +1905,8 @@ ctx.save(); // the Java implementation draws 1 pixel larger in each dimension - width = width + 1; - height = height + 1; + //width = width + 1; + //height = height + 1; // setup our clipping region, this is needed because the line width (1 pixel wide) is // drawn half on one side of hte path and half on the other side; this makes paths a @@ -1905,10 +1923,9 @@ // fill the rectangle with the original color (raised mode) or the darker color otherwise if (fill) { - inset = 1; ctx.fillStyle = createColorString(current); ctx.beginPath(); - ctx.rect(x, y, width - 2, height - 2); + ctx.rect(x, y, width - 1, height - 1); renderClosedPath(ctx, fill); } @@ -1916,14 +1933,26 @@ // draw the top and left sides in the contrasting color (raised mode) or the darker color // otherwise - this.drawLine(ctx, x, y, x + width - 2 - inset, y, current); - this.drawLine(ctx, x, y + 1, x, y + height - 1 - inset, current); - + var path = this.drawLine(ctx, x, y, x + width - 1, y, current); + var more = this.drawLine(ctx, x, y + 1, x, y + height - 1, current); + Array.prototype.push.apply(path, more); + strokesManager.applyStrokeToPath(this.ctx, + this.strokeStyleId, + this.strokeWidth, + current, + path); + // draw the bottom and right sides in the darker color (raised mode) or the contrasting // color otherwise current = raised ? darker : lighter; - this.drawLine(ctx, x + 1, y + height - 1 - inset, x + width - 1 - inset, y + height - 1 - inset, current); - this.drawLine(ctx, x + width - 1 - inset, y, x + width - 1 - inset, y + height - 2, current); + path = this.drawLine(ctx, x + 1, y + height - 1, x + width -1, y + height - 1, current); + more = this.drawLine(ctx, x + width - 1, y, x + width -1, y + height - 1, current); + Array.prototype.push.apply(path, more); + strokesManager.applyStrokeToPath(this.ctx, + this.strokeStyleId, + this.strokeWidth, + current, + path); // clear the clipping region ctx.restore(); @@ -1966,12 +1995,14 @@ ctx.closePath(); renderClosedPath(ctx, fill); } - + var path = []; // now overdraw the stroked portion for (i = 0; i < (num - 1); i++) { - this.drawLine(ctx, xPoints[i], yPoints[i], xPoints[i + 1], yPoints[i + 1], color); + var more = this.drawLine(ctx, xPoints[i], yPoints[i], xPoints[i + 1], yPoints[i + 1], color); + Array.prototype.push.apply(path, more); } + return path; }; /**