734 Commits

Author SHA1 Message Date
Eric Seidel
c1cad6ccda Don't crash when main.dart is a 404.
Ideally we would show a failwhale or some such, but
I don't know how we would bundle that file with our
APK yet.

Fixes https://github.com/domokit/mojo/issues/228

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1182633002.
2015-06-11 14:07:49 -07:00
Matt Perry
583b126b57 Remove redundant Paint.setARGB in favor of assigning to Paint.color.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1182563002.
2015-06-11 15:43:53 -04:00
Matt Perry
85670ba03d Expose and use constants for DrawLooperLayerInfo.setPaintBits to dart.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1175403002.
2015-06-11 15:41:12 -04:00
Matt Perry
c9dd71253c Fix up constructor naming style for MaskFilter and ColorFilter.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1179913002.
2015-06-11 13:15:20 -04:00
Matt Perry
b973810865 Sky: Small fixes to Gradient interface. Added comments and renamed constructors.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1180873003.
2015-06-11 13:14:51 -04:00
Adam Barth
d0c30be6ca Make the stocks popup menu fade in
The final animation is more involved, but this CL starts implementing the menu
animation by making it fade in.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1174253003.
2015-06-10 17:28:43 -07:00
Chinmay Garde
ac4f0bebc5 sky/engine updates for iOS targets
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1163323003.
2015-06-10 16:17:56 -07:00
Collin Jackson
86b2b3ed28 Clip inkwell splash around the floating action button
R=abarth@chromium.org, ianh@google.com, abarth

Review URL: https://codereview.chromium.org/1174203002
2015-06-10 15:57:26 -07:00
Adam Barth
c17d58ab28 Fix shutdown crash in Sky
Previously, we would try to close some Dart persistent handles after destroying
the isolate. Now we revoke the weak pointers these handles are using to refer
to the isolate before trying to tear them down.

Fixes https://github.com/domokit/mojo/issues/233

R=chinmaygarde@google.com, eseidel@chromium.org

Review URL: https://codereview.chromium.org/1175053002.
2015-06-10 12:59:07 -07:00
Eric Seidel
c87b98b687 Enable antialiasing on Paint by default.
The app looks so much better with this on.

R=jackson@google.com, abarth@chromium.org

Review URL: https://codereview.chromium.org/1172413002.
2015-06-10 11:11:03 -07:00
Matt Perry
42892c733b Add LinearBoxGradient and RadialBoxGradient decorations for RenderDecoratedBox.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1175763002.
2015-06-10 12:23:57 -04:00
Eric Seidel
52fd41bc88 Make Sky not crash when an image 404s.
I also fixed image_cache to not even bother
to call ImageDecoder in the 404 case, but I also
fixed CanvasImageDecoder not to blow up if the
buffer is empty and its not able to allocate
an ImageDecoder.

Closes https://github.com/domokit/mojo/issues/229

R=abarth@chromium.org, jackson@google.com

Review URL: https://codereview.chromium.org/1170413002.
2015-06-09 17:29:00 -07:00
Hixie
d54c213b24 Clean up a bunch of our Dart code.
- constructors first
 - have either a blank line at the top and bottom of each class, or no blank line in either place (it's still inconsistent about which we should do)
 - hide clamp()

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1172173002
2015-06-09 15:27:58 -07:00
Adam Barth
4011ec97b8 SkyView should handle screen rotation
This CL implements a basic version of screen rotation where we just relayout at
the new size. In the future, we'll want a fancy version where we transition
between the two layouts.

R=ianh@google.com
BUG=

Review URL: https://codereview.chromium.org/1177563002.
2015-06-09 13:56:18 -07:00
Matt Perry
d745bd3d47 Sky: Add a DartConverterEnum and use that for all our enum needs.
R=abarth@chromium.org, eseidel@chromium.org

Review URL: https://codereview.chromium.org/1170963003.
2015-06-09 15:58:54 -04:00
Matt Perry
9f64045470 Sky: Allow clients to specify tile mode for gradients (repeating or mirror).
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1166223004.
2015-06-09 15:21:46 -04:00
Eric Seidel
8f975399e1 Move image loading out of C++ into Dart
We already know how to talk to the network_service from Dart
via fetch.dart.  Might as well use that for Image loading
as well insetad of having ImageLoader do it.

As part of this I've renamed *ImageLoader to *ImageDecoder
and moved all the image loading logic into Dart.  This required
me to teach the idl system about mojo handles so that I could
pass the resulting MojoHandle from fetch.dart up through to
ImageDecoder.

R=abarth@chromium.org, jackson@google.com, hansmuller@google.com

Review URL: https://codereview.chromium.org/1173703002.
2015-06-09 12:14:13 -07:00
Matt Perry
aa80a91279 Change the ColorFilter constructor to ColorFilter.Mode, in case we want to add
more ColorFilter types.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1163373007.
2015-06-09 14:55:52 -04:00
Matt Perry
ecb61e1466 Sky: Added radial gradients.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1169863002.
2015-06-09 12:45:02 -04:00
Eric Seidel
92fd88b73f Fix RenderParagraph to respect text color.
I don't think this is the final API we're going to use.

I suspect we'll add a TextStyle struct to hold
color and size, etc. which back-ends into CSS like
this does today.

Currently no one uses this color even though it exists.

This is one step towards fixing:
https://github.com/domokit/mojo/issues/213

R=ianh@google.com

Review URL: https://codereview.chromium.org/1162573007
2015-06-08 15:22:18 -07:00
Hixie
44ad012a65 Convert everything in the Sky API from degrees to radians.
Radians are the one true angle unit.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1164393002
2015-06-08 14:38:06 -07:00
Matt Perry
7382a261aa Change the way we provide custom dart code for IDL bindings.
Rather than appending the custom Foo.dart code to the end of the generated
interface, we now copy it to a CustomFoo.dart file in the output directory.
This allows us to declare it as a proper dependency.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1171743002
2015-06-08 17:26:51 -04:00
Adam Barth
5a14f03f7b Add Point.origin for new Point(0.0, 0.0)
R=eseidel@chromium.org, ianh@google.com

Review URL: https://codereview.chromium.org/1166183002
2015-06-08 13:36:52 -07:00
Eric Seidel
0e738ab6aa Make SkyShell stop crashing on scroll in Stocks2.
This is just another hack on top of the hack that is LayoutRoot.

We will want to untangle Document ownership further as we
iterate on LayoutRoot.  For now LayoutRoot is both very
inefficient (allocates a new Frame for each one!) as well
as crashy like this (by not actually owning the document
but rather grabbing it off the "rootElement" assigned to it).

This at least fixes this common crasher for now.
https://github.com/domokit/mojo/issues/206

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1171643002
2015-06-08 12:41:31 -07:00
Matt Perry
edd0d6e16a Add support for linear gradients, implemented as skia shaders.
I had to complicate the IDL bindings generation to allow passing an array of
colors. Without these changes, we'd try to convert the dart object to
Vector<SkColor>, which C++ thinks is Vector<unsigned>, and we'd use the wrong
converter. So I added some template grease to force it to use a
Vector<CanvasColor> converter.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1152963009
2015-06-08 13:49:10 -04:00
Adam Barth
2384779263 Introduce sky.Sky.zero
And deploy it in a few places.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1164303002
2015-06-08 10:09:03 -07:00
Collin Jackson
668e1e37ab Implement a simple checkbox in Sky’s fn2 components library
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1161813005
2015-06-05 14:51:37 -07:00
Collin Jackson
18ab61e1ee Use an enum for Dart bindings for Skia Paint style
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1171543002
2015-06-05 10:12:45 -07:00
Adam Barth
247344193d Add the floating action button to stocks2
The + isn't quite centered properly, but the button is a circle in the right
place.

R=eseidel@chromium.org, ianh@google.com

Review URL: https://codereview.chromium.org/1156383004
2015-06-05 10:07:51 -07:00
Collin Jackson
45cbbc0fae Implement radio button for Sky’s fn2
R=abarth@chromium.org, eseidel@chromium.org, abarth

Review URL: https://codereview.chromium.org/1157573012
2015-06-04 17:24:38 -07:00
Hixie
96aadc99b4 Rename "BorderSide.None" to "BorderSide.none", since it's a constant, and change the sky.Size.infinite() constructor to a constant.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1158263005
2015-06-04 16:17:20 -07:00
Eric Seidel
54d01bc005 Attempt to write a RenderShadowedBox
The goal of this is to have a Renderer-layer abstraction
around the Sky Engine c++ apis for drawing a shadow.

R=mpcomplete@chromium.org

Review URL: https://codereview.chromium.org/1146893004
2015-06-04 14:49:24 -07:00
Viktor Lidholt
2d8240aa75 Adds support for transfer mode in Paint and SpriteNode classes. Adds support for opacity in sprites, and modifies example game.
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1164633004
2015-06-04 11:14:07 -07:00
Matt Perry
8afcb0fe2d Canvas.concat takes a 16-element Float32List instead of an array.
The array should be in column-major format, in the format used by vector_math.dart.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1155193004
2015-06-04 13:51:44 -04:00
Eric Seidel
8d52fb51dc Make Icon work using space-aged base-url technology.
I also moved Icon back to using int, since double doesn't
actually make sense for an icon pixel size.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1164023005
2015-06-03 17:16:12 -07:00
Adam Barth
1e9184d282 Make Uri.base work in SkyView
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1153673005
2015-06-03 17:00:44 -07:00
Adam Barth
6d5227ea0c Make Drawer in components2 work
This CL introduces RenderStack and fixes a number of bugs to make the Drawer in
components2 work.

R=ianh@google.com, eseidel@chromium.org

Review URL: https://codereview.chromium.org/1147143005
2015-06-03 14:52:13 -07:00
Hixie
57fef366d1 Provide Point+Size, Point-Point, Point.toSize(), and Rect.toPoint().
Also some minor code cleanup in affected files and nearby files.

R=mpcomplete@chromium.org

Review URL: https://codereview.chromium.org/1160453006
2015-06-03 14:21:46 -07:00
Matt Perry
8c097b0892 Update BoxDecoration and RenderParagraph to use sky.Color instead of int.
Also add operator==, hashCode, toString, and some basic Color constants to
Color.

R=abarth@chromium.org, ianh@google.com

Review URL: https://codereview.chromium.org/1162023004
2015-06-03 16:57:04 -04:00
Matt Perry
3aa1e23d7d Sky: Convert TransferMode to an enum.
It looked and smelled like an enum, so lets just make it one. This also gives us a nice toString() method.

R=abarth@chromium.org, eseidel@chromium.org, ianh@google.com

Review URL: https://codereview.chromium.org/1144233004
2015-06-03 16:19:14 -04:00
Eric Seidel
b18eecb50d Make tracing work in the new .dart world.
R=abarth@chromium.org, viktorl@google.com

Review URL: https://codereview.chromium.org/1152483006
2015-06-03 12:40:38 -07:00
Matt Perry
72ca1d9f32 Simplify TransferMode and Color types.
They are no longer wrappers in C++, but are converted directly to their Skia types.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1162393002
2015-06-03 13:33:33 -04:00
John McCutchan
87fd276d3d Enable Dart's checked mode in the Sky controller by default for debug builds
This matches the behaviour of the Mojo Dart controller and was requested by tonyg@

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1152873006
2015-06-03 09:33:17 -07:00
Eric Seidel
d9ed864cc9 Give the Stocks2 App a new improved toolbar.
Looks horrible.  But it's a start.

R=abarth@chromium.org, ianh@google.com
BUG=

Review URL: https://codereview.chromium.org/1146913005
2015-06-02 16:13:31 -07:00
Matt Perry
485523560f Add a MaskFilter interface to dart:sky to handle blur.
For this, I added back my previous CustomDart attribute for customizing the
generated Dart code of an interface.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1162843003
2015-06-02 17:26:32 -04:00
Matt Perry
e68fe5d33e Add TransferMode to dart:sky, and use it instead of passing ints around.
Also use Point in place of passing 2 ints to the DrawLooper API.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1158883004
2015-06-02 15:03:44 -04:00
Matt Perry
4f2d78a5bb Re-land "Add a Color class to dart:sky."
The previous patch broke the sky tests. I have updated the framework to use the new Color class.

R=jackson@google.com

Review URL: https://codereview.chromium.org/1159663003
2015-06-02 14:09:42 -04:00
Collin Jackson
f396442e0a Implement a simple image cache for Sky in Dart. This doesn't yet do any eviction from the cache.
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1165753004
2015-06-02 10:44:48 -07:00
Collin Jackson
2ff84ffe5f Refactor image handling in Sky to expose the loader and image as separate classes to Dart code. This makes it possible to avoid unnecessary paints, by only painting once when the image has loaded. Now that we've separated the loader and image classes, we can implement an image cache in Dart.
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1156003007
2015-06-01 16:21:21 -07:00
Matt Perry
ffed692545 Revert "Add a Color class to dart:sky."
This reverts commit a413c8319fe9a46dc131f6efe275d014c9cb7eb9.

Reason: seems to have broken Sky tests:
Regressions: Unexpected crashes (2)
  raw/render_box.dart [ Crash ]
  raw/render_flex.dart [ Crash ]

TBR=jackson@google.com

Review URL: https://codereview.chromium.org/1143133007
2015-06-01 18:13:35 -04:00