Skip to content

Commit

Permalink
Few updates to conform with Dart style
Browse files Browse the repository at this point in the history
  • Loading branch information
umberto-sonnino committed Aug 22, 2019
1 parent 4a0ce44 commit ef7d75c
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 44 deletions.
15 changes: 8 additions & 7 deletions flare_dart/lib/actor.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import 'dart:async';
import "dart:typed_data";
import "dart:convert";
import "actor_image.dart";
import "actor_shape.dart";
import "dart:typed_data";

import "actor_artboard.dart";
import "actor_color.dart";
import "actor_ellipse.dart";
import "actor_image.dart";
import "actor_path.dart";
import "actor_polygon.dart";
import "actor_rectangle.dart";
import "actor_shape.dart";
import "actor_star.dart";
import "actor_triangle.dart";
import "actor_path.dart";
import "actor_color.dart";
import "stream_reader.dart";
import "block_types.dart";
import "actor_artboard.dart";
import "stream_reader.dart";

abstract class Actor {
int maxTextureIndex = 0;
Expand Down
43 changes: 22 additions & 21 deletions flare_dart/lib/actor_artboard.dart
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
import "actor_flags.dart";
import "block_types.dart";
import "actor_node.dart";
import "dart:math";
import "dart:typed_data";

import "actor.dart";
import "actor_bone.dart";
import "actor_color.dart";
import "actor_component.dart";
import "actor_distance_constraint.dart";
import "actor_drawable.dart";
import "actor_ellipse.dart";
import "actor_event.dart";
import "actor_flags.dart";
import "actor_ik_constraint.dart";
import "actor_image.dart";
import "actor_jelly_bone.dart";
import "actor_node.dart";
import "actor_node_solo.dart";
import "actor_path.dart";
import "actor_polygon.dart";
import "actor_rectangle.dart";
import "actor_root_bone.dart";
import "actor_jelly_bone.dart";
import "actor_rotation_constraint.dart";
import "actor_scale_constraint.dart";
import "actor_shape.dart";
import "actor_skin.dart";
import "actor_path.dart";
import "actor_star.dart";
import "actor_transform_constraint.dart";
import "actor_translation_constraint.dart";
import "jelly_component.dart";
import "actor_ik_constraint.dart";
import "actor_rotation_constraint.dart";
import "actor_image.dart";
import "actor_drawable.dart";
import "actor_shape.dart";
import "actor_ellipse.dart";
import "actor_polygon.dart";
import "actor_rectangle.dart";
import "actor_star.dart";
import "actor_triangle.dart";
import "actor_color.dart";
import "animation/actor_animation.dart";
import "block_types.dart";
import "dependency_sorter.dart";
import "actor.dart";
import "stream_reader.dart";
import "math/vec2d.dart";
import "dart:typed_data";
import "jelly_component.dart";
import "math/aabb.dart";
import "dart:math";
import "math/vec2d.dart";
import "stream_reader.dart";

class ActorArtboard {
int _flags = ActorFlags.IsDrawOrderDirty;
Expand Down
39 changes: 26 additions & 13 deletions flare_dart/lib/actor_color.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import "dart:collection";
import "dart:typed_data";
import 'math/mat2d.dart';

import "actor_node.dart";
import "actor_shape.dart";
import "actor_artboard.dart";

import "actor_component.dart";
import "dart:collection";
import "stream_reader.dart";
import "math/vec2d.dart";
import "actor_flags.dart";
import "actor_node.dart";
import "actor_shape.dart";
import 'math/mat2d.dart';
import "math/vec2d.dart";
import "stream_reader.dart";

enum FillRule { EvenOdd, NonZero }
enum StrokeCap { Butt, Round, Square }
Expand Down Expand Up @@ -53,6 +52,7 @@ abstract class ActorPaint extends ActorComponent {
return component;
}

@override
void completeResolve() {
artboard.addDependency(this, parent);
}
Expand Down Expand Up @@ -103,7 +103,10 @@ abstract class ActorColor extends ActorPaint {
return component;
}

@override
void onDirty(int dirt) {}

@override
void update(int dirt) {}
}

Expand Down Expand Up @@ -221,6 +224,7 @@ abstract class ColorFill extends ActorColor with ActorFill {
return component;
}

@override
void completeResolve() {
super.completeResolve();

Expand All @@ -244,6 +248,7 @@ abstract class ColorStroke extends ActorColor with ActorStroke {
return component;
}

@override
void completeResolve() {
super.completeResolve();

Expand All @@ -256,11 +261,12 @@ abstract class ColorStroke extends ActorColor with ActorStroke {

abstract class GradientColor extends ActorPaint {
Float32List _colorStops = Float32List(10);
Vec2D _start = Vec2D();
Vec2D _end = Vec2D();
Vec2D _renderStart = Vec2D();
Vec2D _renderEnd = Vec2D();
double opacity = 1.0;
final Vec2D _start = Vec2D();
final Vec2D _end = Vec2D();
final Vec2D _renderStart = Vec2D();
final Vec2D _renderEnd = Vec2D();
@override
final double opacity = 1.0;

This comment has been minimized.

Copy link
@luigi-rosso

luigi-rosso Oct 25, 2019

Contributor

@umberto-sonnino tracing back why we had this opacity value. Looks like it was already here a while ago when you did some static analyzer fixes. I'll keep tracing back, I bet it's something I overlooked and just added way back when.


Vec2D get start => _start;
Vec2D get end => _end;
Expand Down Expand Up @@ -293,9 +299,12 @@ abstract class GradientColor extends ActorPaint {
return component;
}

@override
void onDirty(int dirt) {}

@override
void update(int dirt) {
ActorShape shape = parent;
ActorShape shape = parent as ActorShape;
Mat2D world = shape.worldTransform;
Vec2D.transformMat2D(_renderStart, _start, world);
Vec2D.transformMat2D(_renderEnd, _end, world);
Expand All @@ -315,6 +324,7 @@ abstract class GradientFill extends GradientColor with ActorFill {
return component;
}

@override
void completeResolve() {
super.completeResolve();

Expand All @@ -338,6 +348,7 @@ abstract class GradientStroke extends GradientColor with ActorStroke {
return component;
}

@override
void completeResolve() {
super.completeResolve();

Expand Down Expand Up @@ -381,6 +392,7 @@ abstract class RadialGradientFill extends RadialGradientColor with ActorFill {
return component;
}

@override
void completeResolve() {
super.completeResolve();

Expand All @@ -406,6 +418,7 @@ abstract class RadialGradientStroke extends RadialGradientColor
return component;
}

@override
void completeResolve() {
super.completeResolve();

Expand Down
8 changes: 7 additions & 1 deletion flare_dart/lib/actor_event.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "actor_component.dart";
import "actor_artboard.dart";
import "actor_component.dart";
import "stream_reader.dart";

class ActorEvent extends ActorComponent {
Expand All @@ -14,13 +14,19 @@ class ActorEvent extends ActorComponent {
return component;
}

@override
ActorComponent makeInstance(ActorArtboard resetArtboard) {
ActorEvent instanceEvent = ActorEvent();
instanceEvent.copyComponent(this, resetArtboard);
return instanceEvent;
}

@override
void completeResolve() {}

@override
void onDirty(int dirt) {}

@override
void update(int dirt) {}
}
4 changes: 2 additions & 2 deletions flare_dart/lib/animation/actor_animation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ class ActorAnimation {

// We distinguish between animated and triggered components as ActorEvents
// are currently only used to trigger events and don't need the full
// animation cycle. This lets them optimize them out of the regular animation
// cycle.
// animation cycle. This lets them optimize them out of the regular
// animation cycle.
int animatedComponentCount = 0;
int triggerComponentCount = 0;

Expand Down

0 comments on commit ef7d75c

Please sign in to comment.