mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Improves Rectangle tool performance.
This commit is contained in:
parent
74d8aa8c9c
commit
f8b77403cd
@ -20,10 +20,19 @@
|
|||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
ns.Rectangle.prototype.draw = function (col, row, color, targetFrame, penSize) {
|
ns.Rectangle.prototype.draw = function (col, row, color, targetFrame, penSize) {
|
||||||
var rectanglePixels = pskl.PixelUtils.getBoundRectanglePixels(this.startCol, this.startRow, col, row);
|
var rectangle = pskl.PixelUtils.getOrderedRectangleCoordinates(this.startCol, this.startRow, col, row);
|
||||||
|
|
||||||
pskl.PixelUtils.resizePixels(rectanglePixels, penSize).forEach(function (point) {
|
for (var x = rectangle.x0; x <= rectangle.x1; x++) {
|
||||||
targetFrame.setPixel(point[0], point[1], color);
|
for (var y = rectangle.y0; y <= rectangle.y1; y++) {
|
||||||
});
|
if (
|
||||||
|
x > rectangle.x1 - penSize ||
|
||||||
|
x < rectangle.x0 + penSize ||
|
||||||
|
y > rectangle.y1 - penSize ||
|
||||||
|
y < rectangle.y0 + penSize
|
||||||
|
) {
|
||||||
|
targetFrame.setPixel(x, y, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user