View | Details | Raw Unified | Return to bug 39991
Collapse All | Expand All

(-)src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java (+1 lines)
Lines 671-676 Link Here
671
        pict.setUID(uid);
671
        pict.setUID(uid);
672
        pict.setData(data);
672
        pict.setData(data);
673
        pict.setType(format);
673
        pict.setType(format);
674
        pict.setOffset(offset);
674
675
675
        _hslfSlideShow.addPicture(pict);
676
        _hslfSlideShow.addPicture(pict);
676
677
(-)src/scratchpad/src/org/apache/poi/hslf/usermodel/PictureData.java (+22 lines)
Lines 49-54 Link Here
49
	*/
49
	*/
50
	protected byte[] header;
50
	protected byte[] header;
51
51
52
    protected int offset;
53
52
    public PictureData(){
54
    public PictureData(){
53
        header = new byte[PictureData.HEADER_SIZE];
55
        header = new byte[PictureData.HEADER_SIZE];
54
    }
56
    }
Lines 76-81 Link Here
76
78
77
		// Save the picture data
79
		// Save the picture data
78
		pictdata = new byte[size];
80
		pictdata = new byte[size];
81
        this.offset = offset;
79
		System.arraycopy(pictstream, startPos, pictdata, 0, pictdata.length);
82
		System.arraycopy(pictstream, startPos, pictdata, 0, pictdata.length);
80
	}
83
	}
81
84
Lines 164-169 Link Here
164
    }
167
    }
165
168
166
    /**
169
    /**
170
     * File offset in the 'Pictures' stream
171
     *
172
     * @return offset in the 'Pictures' stream
173
     */
174
    public int getOffset(){
175
        return offset;
176
    }
177
178
    /**
179
     * Set offset of this picture in the 'Pictures' stream.
180
     * We need to set it when a new picture is created.
181
     *
182
     * @param offset in the 'Pictures' stream
183
     */
184
    public void setOffset(int offset){
185
        this.offset = offset;
186
    }
187
188
    /**
167
     * Compute 16-byte checksum of this picture
189
     * Compute 16-byte checksum of this picture
168
     */
190
     */
169
    public static byte[] getChecksum(byte[] data) {
191
    public static byte[] getChecksum(byte[] data) {
(-)src/scratchpad/src/org/apache/poi/hslf/model/Picture.java (-1 / +1 lines)
Lines 153-159 Link Here
153
        int idx = getPictureIndex()-1;
153
        int idx = getPictureIndex()-1;
154
        EscherBSERecord bse = (EscherBSERecord)lst.get(idx);
154
        EscherBSERecord bse = (EscherBSERecord)lst.get(idx);
155
        for ( int i = 0; i < pict.length; i++ ) {
155
        for ( int i = 0; i < pict.length; i++ ) {
156
            if (Arrays.equals(bse.getUid(), pict[i].getUID())){
156
            if (pict[i].getOffset() ==  bse.getOffset()){
157
                return pict[i];
157
                return pict[i];
158
            }
158
            }
159
        }
159
        }

Return to bug 39991