Make some debugging adjustments.

This commit is contained in:
Jennifer Taylor
2021-05-22 01:30:58 +00:00
parent f33c73572b
commit 8ee8e5c519
2 changed files with 30 additions and 4 deletions

View File

@@ -444,6 +444,17 @@ class AFPRenderer(VerboseOutput):
# Render individual shapes if this is a sprite.
if isinstance(renderable, PlacedClip):
if only_depths is not None:
if renderable.depth not in only_depths:
if renderable.depth != -1:
# Not on the correct depth plane.
return img
new_only_depths = only_depths
else:
new_only_depths = None
else:
new_only_depths = None
# This is a sprite placement reference. Make sure that we render lower depths
# first, but preserved placed order as well.
depths = set(obj.depth for obj in renderable.placed_objects)
@@ -451,8 +462,12 @@ class AFPRenderer(VerboseOutput):
for obj in renderable.placed_objects:
if obj.depth != depth:
continue
img = self.__render_object(img, obj, transform, only_depths=only_depths, prefix=prefix + " ")
img = self.__render_object(img, obj, transform, only_depths=new_only_depths, prefix=prefix + " ")
elif isinstance(renderable, PlacedShape):
if only_depths is not None and renderable.depth not in only_depths:
# Not on the correct depth plane.
return img
# This is a shape draw reference.
shape = renderable.source
@@ -466,9 +481,6 @@ class AFPRenderer(VerboseOutput):
if not (params.flags & 0x1):
# Not instantiable, don't render.
return img
if only_depths is not None and renderable.depth not in only_depths:
# Not on the correct depth plane.
return img
if params.flags & 0x4:
# TODO: Need to support blending and UV coordinate colors here.

View File

@@ -1137,6 +1137,8 @@ class SWF(TrackedCoverage, VerboseOutput):
# Handle object colors
multcolor = Color(1.0, 1.0, 1.0, 1.0)
addcolor = Color(0.0, 0.0, 0.0, 0.0)
multdisplayed = False
adddisplayed = False
if flags & 0x800:
# Multiplicative color present.
@@ -1150,6 +1152,7 @@ class SWF(TrackedCoverage, VerboseOutput):
multcolor.b = float(b) / 255.0
multcolor.a = float(a) / 255.0
self.vprint(f"{prefix} Mult Color: {multcolor}")
multdisplayed = True
if flags & 0x1000:
# Additive color present.
@@ -1163,6 +1166,7 @@ class SWF(TrackedCoverage, VerboseOutput):
addcolor.b = float(b) / 255.0
addcolor.a = float(a) / 255.0
self.vprint(f"{prefix} Add Color: {addcolor}")
adddisplayed = True
if flags & 0x2000:
# Multiplicative color present, smaller integers.
@@ -1176,6 +1180,7 @@ class SWF(TrackedCoverage, VerboseOutput):
multcolor.b = float((rgba >> 8) & 0xFF) / 255.0
multcolor.a = float(rgba & 0xFF) / 255.0
self.vprint(f"{prefix} Mult Color: {multcolor}")
multdisplayed = True
if flags & 0x4000:
# Additive color present, smaller integers.
@@ -1189,6 +1194,15 @@ class SWF(TrackedCoverage, VerboseOutput):
addcolor.b = float((rgba >> 8) & 0xFF) / 255.0
addcolor.a = float(rgba & 0xFF) / 255.0
self.vprint(f"{prefix} Add Color: {addcolor}")
adddisplayed = True
# For easier debugging, display the default color when the color
# is being used.
if flags & 0x8:
if not multdisplayed:
self.vprint(f"{prefix} Mult Color: {multcolor}")
if not adddisplayed:
self.vprint(f"{prefix} Add Color: {addcolor}")
bytecodes: Dict[int, List[ByteCode]] = {}
if flags & 0x80: