mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
fix #621 : allow color worker to detect up to 256 colors
This commit is contained in:
parent
dc149f88d6
commit
ba779a97a6
@ -13,6 +13,9 @@ var Constants = {
|
||||
MAX_WIDTH : 1024,
|
||||
|
||||
MAX_PALETTE_COLORS : 100,
|
||||
// allow current colors service to get up to 256 colors.
|
||||
// GIF generation is different if the color count goes over 256.
|
||||
MAX_WORKER_COLORS : 256,
|
||||
|
||||
PREVIEW_FILM_SIZE : 96,
|
||||
ANIMATED_PREVIEW_WIDTH : 200,
|
||||
|
@ -15,7 +15,7 @@
|
||||
ns.FrameColors.prototype.process = function () {
|
||||
this.worker.postMessage([
|
||||
pskl.utils.colorToInt(Constants.TRANSPARENT_COLOR),
|
||||
Constants.MAX_PALETTE_COLORS, this.pixels
|
||||
Constants.MAX_WORKER_COLORS, this.pixels
|
||||
]);
|
||||
};
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
||||
var frameColors = {};
|
||||
var transparentColorInt = this.TRANSPARENT_COLOR;
|
||||
var colors = 0;
|
||||
for (var i = 0, length = frame.length; i < length && colors < this.MAX_PALETTE_COLORS; i++) {
|
||||
for (var i = 0, length = frame.length; i < length && colors < this.MAX_WORKER_COLORS; i++) {
|
||||
var color = frame[i];
|
||||
if (color !== transparentColorInt) {
|
||||
if (!frameColors[color]) {
|
||||
@ -64,7 +64,7 @@
|
||||
this.onmessage = function(event) {
|
||||
try {
|
||||
this.TRANSPARENT_COLOR = event.data[0];
|
||||
this.MAX_PALETTE_COLORS = event.data[1];
|
||||
this.MAX_WORKER_COLORS = event.data[1];
|
||||
var frame = event.data[2];
|
||||
var colors = getFrameColors(frame);
|
||||
this.postMessage({
|
||||
|
Loading…
Reference in New Issue
Block a user