fix fillstyle matrix twips

This commit is contained in:
2016-07-11 01:14:35 +06:00
parent 3871dde96f
commit 0aff618f00
5 changed files with 10 additions and 10 deletions

View File

@@ -73,7 +73,7 @@ namespace FlashTools.Internal.SwfTools.SwfTags {
: (ushort)0;
tag.Matrix = tag.HasMatrix
? SwfMatrix.Read(reader)
? SwfMatrix.Read(reader, false)
: SwfMatrix.identity;
tag.ColorTransform = tag.HasColorTransform

View File

@@ -98,7 +98,7 @@ namespace FlashTools.Internal.SwfTools.SwfTags {
: (ushort)0;
tag.Matrix = tag.HasMatrix
? SwfMatrix.Read(reader)
? SwfMatrix.Read(reader, false)
: SwfMatrix.identity;
tag.ColorTransform = tag.HasColorTransform

View File

@@ -26,7 +26,7 @@ namespace FlashTools.Internal.SwfTools.SwfTags {
var tag = new PlaceObjectTag();
tag.CharacterId = reader.ReadUInt16();
tag.Depth = reader.ReadUInt16();
tag.Matrix = SwfMatrix.Read(reader);
tag.Matrix = SwfMatrix.Read(reader, false);
tag.ColorTransform = reader.IsEOF
? SwfColorTransform.identity
: SwfColorTransform.Read(reader, false);

View File

@@ -21,13 +21,13 @@ namespace FlashTools.Internal.SwfTools.SwfTypes {
}
}
public static SwfMatrix Read(SwfStreamReader reader) {
public static SwfMatrix Read(SwfStreamReader reader, bool fill_style) {
var matrix = SwfMatrix.identity;
var has_scale = reader.ReadBit();
if ( has_scale ) {
var bits = (byte)reader.ReadUnsignedBits(5);
matrix.ScaleX = reader.ReadFixedPoint16(bits) / 20.0f;
matrix.ScaleY = reader.ReadFixedPoint16(bits) / 20.0f;
matrix.ScaleX = reader.ReadFixedPoint16(bits) * (fill_style ? 1.0f / 20.0f : 1.0f);
matrix.ScaleY = reader.ReadFixedPoint16(bits) * (fill_style ? 1.0f / 20.0f : 1.0f);
} else {
matrix.ScaleX =
matrix.ScaleY = 1.0f;
@@ -35,8 +35,8 @@ namespace FlashTools.Internal.SwfTools.SwfTypes {
var has_rotate = reader.ReadBit();
if ( has_rotate ) {
var bits = (byte)reader.ReadUnsignedBits(5);
matrix.RotateSkew0 = reader.ReadFixedPoint16(bits) / 20.0f;
matrix.RotateSkew1 = reader.ReadFixedPoint16(bits) / 20.0f;
matrix.RotateSkew0 = reader.ReadFixedPoint16(bits);
matrix.RotateSkew1 = reader.ReadFixedPoint16(bits);
} else {
matrix.RotateSkew0 =
matrix.RotateSkew1 = 0.0f;

View File

@@ -99,7 +99,7 @@ namespace FlashTools.Internal.SwfTools.SwfTypes {
SwfColor.Read(reader, with_alpha);
}
if ( fill_style.Type.IsGradientType ) {
SwfMatrix.Read(reader); // GradientMatrix
SwfMatrix.Read(reader, true); // GradientMatrix
switch ( fill_style.Type.Value ) {
case SwfFillStyleType.Type.LinearGradient:
case SwfFillStyleType.Type.RadialGradient:
@@ -112,7 +112,7 @@ namespace FlashTools.Internal.SwfTools.SwfTypes {
}
if ( fill_style.Type.IsBitmapType ) {
fill_style.BitmapId = reader.ReadUInt16();
fill_style.BitmapMatrix = SwfMatrix.Read(reader);
fill_style.BitmapMatrix = SwfMatrix.Read(reader, true);
}
return fill_style;
}