Project

General

Profile

imageio-bmp-3.10.2-mask-memory-fix.diff

Tomasz Domin, 02/22/2024 06:52 AM

Download (2.11 KB)

View differences:

imageio/imageio-bmp/src/main/java/com/twelvemonkeys/imageio/plugins/bmp/BitmapIndexed.java
42 42
    final int[] bits;
43 43
    final int[] colors;
44 44

  
45
    public BitmapIndexed(final DirectoryEntry entry, final DIBHeader header) {
46
        super(entry, header);
45
    public BitmapIndexed(final DirectoryEntry entry, final DIBHeader header, boolean isMask) {
46
       super(entry, header);
47 47

  
48
        bits = new int[getWidth() * getHeight()];
48
       bits = new int[getWidth() * getHeight()];
49 49

  
50
        // NOTE: We're adding space for one extra color, for transparency
51
        colors = new int[getColorCount() + 1];
50
       if (isMask)
51
          colors = new int[1];
52
       else
53
          // NOTE: We're adding space for one extra color, for transparency
54
          colors = new int[getColorCount() + 1];
55
    }
56
    
57
    public BitmapIndexed(final DirectoryEntry entry, final DIBHeader header) {
58
       this(entry, header, false);
52 59
    }
53 60

  
54 61
    public BufferedImage createImageIndexed() {
imageio/imageio-bmp/src/main/java/com/twelvemonkeys/imageio/plugins/bmp/BitmapMask.java
44 44

  
45 45
    public BitmapMask(final DirectoryEntry parent, final DIBHeader header) {
46 46
        super(parent, header);
47
        bitMask = new BitmapIndexed(parent, header);
47
        bitMask = new BitmapIndexed(parent, header, true);
48 48
    }
49 49

  
50 50
    boolean isTransparent(final int x, final int y) {