Juicy.Pixels icon indicating copy to clipboard operation
Juicy.Pixels copied to clipboard

Addition of `paletteSize`, while removing private field of `Palette'`

Open lehins opened this issue 4 years ago • 2 comments

From what I gather _paletteSize is an unnecessary field in Palette', since it can be deduced from the size of _paletteData and the type of pixel, which is exactly the way that the newly added paletteSize is implemented. Couple benefits that come from this change:

  • Palette' is now a newtype around Vector, hence slight reduction to memory usage and overall improvement to performance
  • Safety improvement: Exposing private _paletteSize that is coupled to the actual data allows construction of incorrect Palette', which opens a possibility of a segfault when using images converted from such palettes by palettedAsImage

lehins avatar Jan 05 '20 20:01 lehins

At this point, while this is a worthwhile enhancement, I wouldn't break compatibility for such "low" issue, has to keep it in mind in case of bigger breaking change

Twinside avatar Feb 24 '20 08:02 Twinside

@Twinside I agree, that bundling this together with a bigger breaking change is a good idea.

lehins avatar Feb 24 '20 09:02 lehins