// that appears at the center point of the brush. The color of the brush changes gradually from the
// boundary color to the center color as it moves from the boundary to the center point.
centerColor = readARGB(leis.readInt());
- int size = 3*LittleEndianConsts.INT_SIZE;
+ long size = 3*LittleEndianConsts.INT_SIZE;
if (wrapMode == null) {
return size;
size += 3*LittleEndianConsts.INT_SIZE;
}
- return size;
+ return Math.toIntExact(size);
}
@Override
// across a shape, when the image is smaller than the area being filled.
wrapMode = EmfPlusWrapMode.valueOf(leis.readInt());
- int size = 2*LittleEndianConsts.INT_SIZE;
+ long size = 2*LittleEndianConsts.INT_SIZE;
if (TRANSFORM.isSet(dataFlags)) {
size += readXForm(leis, (brushTransform = new AffineTransform()));
size += (image = new EmfPlusImage()).init(leis, dataSize-size, EmfPlusObjectType.IMAGE, 0);
}
- return size;
+ return Math.toIntExact(size);
}
@Override
EmfPlusObjectType objectType = getObjectType();
assert (objectType != null);
- int size = 0;
+ long size = 0;
totalObjectSize = 0;
int dataSize2 = (int) dataSize;
objectData = objectType.constructor.get();
size += objectData.init(leis, dataSize2, objectType, flags);
- return size;
+ return Math.toIntExact(size);
}
@Override
@SuppressWarnings("unused")
private long initCustomCap(Consumer<EmfPlusCustomLineCap> setter, LittleEndianInputStream leis) throws IOException {
int CustomStartCapSize = leis.readInt();
- int size = LittleEndianConsts.INT_SIZE;
+ long size = LittleEndianConsts.INT_SIZE;
EmfPlusGraphicsVersion version = new EmfPlusGraphicsVersion();
size += version.init(leis);
setter.accept(cap);
- return size;
+ return Math.toIntExact(size);
}
@Override
public void applyObject(HemfGraphics ctx, List<? extends EmfPlusObjectData> continuedObjectData) {
final HemfDrawProperties prop = ctx.getProperties();
- // TOOD:
+ // TODO:
// - set width according unit type
// - provide logic for different start and end cap
// - provide standard caps like diamond
if (recordLen == 8 && atomLen > 8) {
// Assume it has children, rather than being corrupted
walkEscherDDF((indent + 3), pos + 8, (int) atomLen);
-
- // Wind on our length + our header
- pos += atomLen;
- pos += 8;
- len -= atomLen;
- len -= 8;
- } else {
- // No children, wind on our real length
- pos += atomLen;
- pos += 8;
- len -= atomLen;
- len -= 8;
}
+ // Wind on our length + our header
+ pos = Math.toIntExact(pos + atomLen) + 8;
+ len = Math.toIntExact(len - atomLen) - 8;
// Move on to the next one, if we're not at the end yet
if (len >= 8) {
_childRecords.add(r);
}
long rlen = LittleEndian.getUInt(remainingData,offset+4);
- offset += 8 + rlen;
+ offset = Math.toIntExact(offset + 8 + rlen);
}
}