Commit Graph

117 Commits

Author SHA1 Message Date
Matt Perry
71cf849271 Sky: Added radial gradients.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1169863002.
2015-06-09 12:45:02 -04:00
Hixie
37f0b0240b 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
Collin Jackson
62bff5f7ef Sky support for flexbox justify content
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1164363002
2015-06-08 14:14:02 -07:00
Adam Barth
824bc31626 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
Matt Perry
1f26d65757 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
1526e5f8e0 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
Hixie
b7c588661c 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
b05d618e62 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
Hixie
68369e9d62 Style guide says enum values should be lowerCamelCase.
https://www.dartlang.org/articles/style-guide/#names

R=jackson@google.com

Review URL: https://codereview.chromium.org/1158813004
2015-06-04 12:24:10 -07:00
Matt Perry
30dac5853d 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
Hixie
433df32cd0 Enable RenderDecoratedBox to draw borders.
Currently supports only solid borders, but of any colour and size, independently controlling each side.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1154903006
2015-06-04 10:50:59 -07:00
Hixie
395102d5ca Rename RenderNode to RenderObject.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1165013003
2015-06-04 10:45:21 -07:00
Adam Barth
e99c880bc2 Fix gesture events in fn2
This CL makes gesture events work again in fn2.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1146923005
2015-06-03 16:06:15 -07:00
Collin Jackson
fef65fc431 Implement RenderImage and Image for Sky
This also fixes a bug that was preventing markNeedsLayout from working

R=abarth@chromium.org, eseidel@chromium.org, abarth, eseidel

Review URL: https://codereview.chromium.org/1160013004
2015-06-03 15:17:12 -07:00
Matt Perry
dc4915059f 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
Eric Seidel
28a43627a2 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
Adam Barth
6543b55cb6 Add support for transforms to container
These transforms are currently very basic but they seem to mostly work.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1152273004
2015-06-03 10:20:33 -07:00
Matt Perry
0f8ae9f16c 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
Hixie
b53644f660 Rename rendering/render_*.dart to rendering/*.dart
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1166773003
2015-06-02 13:55:20 -07:00
Matt Perry
9618a82750 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
e28c832a79 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
dc9635dd33 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
2fe4b05e6d 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
4eb2ac712e 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
Matt Perry
e22b790e0c Add a Color class to dart:sky.
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1161273004
2015-06-01 16:48:48 -04:00
Collin Jackson
205bd1449a Add Sky framework support for drawing images
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1151753009
2015-05-29 16:45:43 -07:00
Adam Barth
04169c4ce3 Add a simple inksplash example
We'll eventually turn this into a full fn2 component, but for now it's just an
example.

To make this work, I created a schedule.dart as a start to implementing
scheduler.md. For now, I've kept the API similar to the web platform so that
the old world can continue use it backed by sky.window.requestAnimationFrame.

R=eseidel@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1145973009
2015-05-29 13:55:12 -07:00
Adam Barth
dbbe62ea8f Split layout2.dart into several files
Previously layout2.dart was a thousand lines long.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1161003002
2015-05-28 16:42:04 -07:00
Hixie
46e47cf011 Make RenderParagraph mutable, and make it fit the new RenderNode protocols
R=abarth@chromium.org, eseidel@chromium.org

Review URL: https://codereview.chromium.org/1165463002
2015-05-28 15:19:36 -07:00
Adam Barth
3f22019e66 Replace BoxDimensions with sky.Size
R=ianh@google.com

Review URL: https://codereview.chromium.org/1150253005
2015-05-28 14:29:29 -07:00
Adam Barth
b0e39b7d99 Move simple_render_tree into tests as render_flex
R=ianh@google.com

Review URL: https://codereview.chromium.org/1146123003
2015-05-28 14:29:10 -07:00
Matt Perry
96b04e34b1 Add an API to set the ColorFilter on a Paint object.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1158693005
2015-05-28 17:17:11 -04:00
Adam Barth
10901fabad Introduce RenderProxyBox and RenderSizedBox
Also makes Point, Size, and Rect immutable.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1162033002
2015-05-28 13:39:26 -07:00
Adam Barth
647232b8a5 Use Point, Size, and Rect in layout2.dart
R=ianh@google.com

Review URL: https://codereview.chromium.org/1156303004
2015-05-28 12:42:54 -07:00
Eric Seidel
081a440e6c Move RenderParagraph into layout2.dart
TBR=ianh@google.com

Review URL: https://codereview.chromium.org/1155103003
2015-05-28 12:26:09 -07:00
Eric Seidel
54eb9b146e Add a very simple RenderParagraph example using LayoutRoot.
I'm sure we'll want something more sophisticated in the near future.

Next step is to actually animate this updating layout.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1150183005
2015-05-28 12:18:56 -07:00
Hixie
ec29082f84 Refactor layout/relayout into a single method.
This dramatically simplifies the layout model.
I haven't gone through and simplified the existing functions, we should probably go through and figure out if they can be cleaned up a bit.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1161983004
2015-05-28 11:15:58 -07:00
Hixie
e45a3f7b32 Refactor padding out of RenderBlock.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1143153011
2015-05-27 17:11:45 -07:00
Matt Perry
15687c8831 Sky: Add a DrawLooper interface to the painting API to be used for shadows.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1144193006
2015-05-27 16:22:01 -04:00
Hixie
270e386351 Fix compilation errors in render-sector.dart
TBR=abarth

Review URL: https://codereview.chromium.org/1153273002
2015-05-27 12:03:15 -07:00
Matt Perry
36baaf53a5 Sky: Add a Point class.
Also, fix the style in Rect.cpp/.h.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1158843002
2015-05-27 14:40:02 -04:00
Hixie
6ffea218fe Replace setBoxDecoration() with a decoration property. (part II)
This was supposed to be in https://codereview.chromium.org/1153893006/

TBR=abarth

Review URL: https://codereview.chromium.org/1151383003
2015-05-27 09:35:15 -07:00
Hixie
2415a118f6 Replace setBoxDecoration() with a decoration property.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1153893006
2015-05-27 09:30:25 -07:00
Hixie
c09aac3f3f Rationalise hit testing in the new RenderNode world
- makes the event logic not involve a boolean return value (since we ignored it anyway)
- splits the event handling logic into two steps, hit testing and event dispatch
- introduces an App class on the Dart side to factor out the interaction with the C++ side
- ports sector-layout and simple_render_tree to the new App infrastructure
- port simple_render_tree to the new event handling logic
- implement hit testing for the sector-layout demo

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1143343004
2015-05-26 12:44:35 -07:00
Collin Jackson
3976cd7b28 Clean up syntax as suggested by sethladd
R=sethladd@google.com, sethladd

Review URL: https://codereview.chromium.org/1159763003
2015-05-26 10:20:37 -07:00
Hixie
2470cdcafa RenderSector example: add a class to stack in the other direction, and fix various bugs.
- the circle now fills the screen
- you can set dimensions on the solid color node
- debugging printfs and rects are gone
- the protocol is changed so that for sectors, you position before you size (since your size and your childrens' positions all depend on your own position)

TBR=abarth

Review URL: https://codereview.chromium.org/1154213003
2015-05-26 09:53:21 -07:00
Hixie
54403a610b A proof of concept for annular sector layout.
Could be useful for watch faces. :-)
Includes some minor fixes to layout2.dart.
Includes adding a very basic path API.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1152383002
2015-05-26 08:33:13 -07:00
Collin Jackson
87e8b162c7 WIP Flexbox Layout Manager for Sky framework.
This only handles really basic cases and doesn't understand
justification, wrapping, and so on. Submitting for code
review so I can get some early feedback before I invest
more time into making it correct.

R=ianh@google.com, abarth

Review URL: https://codereview.chromium.org/1151293002
2015-05-22 18:47:29 -07:00
Adam Barth
51c670e62b Address Ian's comments on layout2.dart
R=ianh@google.com

Review URL: https://codereview.chromium.org/1152603002
2015-05-21 13:32:21 -07:00
Adam Barth
af9a06c023 Port touch-demo.sky to SkyView universe
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1151613005
2015-05-21 12:34:38 -07:00
Adam Barth
ed38815dbd Port spinning_square to SkyView universe
This demo shows how to create a spinning square using the lowest-level APIs. We
should probably create more spinning square demos at the other layers of the
system.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1147393002
2015-05-21 12:14:10 -07:00
Adam Barth
c63c396da8 Make hit testing work in layout2.dart
This CL makes simple_render_tree.dart interactive by making the hit testing
system work. I've also added a mechanism for requesting an animation frame.

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

Review URL: https://codereview.chromium.org/1153543002
2015-05-21 11:22:17 -07:00
Adam Barth
400d6df700 Actually perform a block layout
This CL teaches simple_render_tree how to do a block layout using layout2.dart.

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

Review URL: https://codereview.chromium.org/1144423002
2015-05-21 11:15:50 -07:00
Adam Barth
3a6cab2c40 Add a simple_render_tree example
This example shows how to draw a circle using subclasses of RenderNode.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1144193004
2015-05-20 13:49:29 -07:00
Adam Barth
83805e2a9e Plumb input events into SkyView
Clients can now register a callback that gets called whenever we have an event
for the view. We'll need to update the Event class at some point, but this is a
start.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1129333005
2015-05-19 16:50:28 -07:00
Adam Barth
17040ff355 Plumb display metrics into SkyView
This CL teaches SkyView the width, height, and device pixel ratio of the
display. In the future, we'll want some sort of notification system for when
these values change.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1139823010
2015-05-19 14:54:08 -07:00
Adam Barth
0b18d56d5a Teach SkyView path to draw a circle
This CL adds a global view object that can receive a Picture and be signaled to
draw. When using SkyView, this Picture shows up on screen.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1134913003
2015-05-19 14:20:04 -07:00
John McCutchan
5fd9d77387 Fix domokit.github.io site deployment script
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1145843002
2015-05-19 14:03:13 -07:00
Adam Barth
a21939bdaf Teach SkyView code path to print hello, world
This CL makes the SkyView codepath smart enough to print "hello, world" to the
console. The code path is off by default but can be enabled by changing one
line of code.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1131673011
2015-05-19 13:51:12 -07:00
Matt Perry
9dfbc4eea4 Sky: Add a CustomDart attribute to the IDL compiler, and use that with Canvas
to provide a better Dart API.

When the attribute is present on an IDL interface, the generate Dart code will be a private interface that can extended by custom dart code.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1135283005
2015-05-19 13:59:05 -04:00
Eric Seidel
293563078d Add Canvas.drawPicture
I wrote another copy of paint_element_into_displaylist
using this new technology.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1129353010
2015-05-18 15:13:15 -07:00
Eric Seidel
20459183e4 Make it possible to Paint elements into a display list.
Currently said elements need to be in the DOM and have
already been laid out for this to work, but follow-up patches
will remove these restrictions.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1144673002
2015-05-18 14:49:59 -07:00
Matt Perry
769cef59ba Flesh out the Painting API a bit.
This exposes most methods from Skia's C canvas API to Dart. For now, SkRect and
SkMatrix are represented simply as an array of floats, which requires a
conversion at the bindings layer. More complex types like SkPath are still TODO.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1144483002
2015-05-13 17:17:26 -04:00
Eric Seidel
a0609d1f4e Make it possible to custom-paint without an Element.
This adds a new abstract 'Canvas' which is similar to SkCanvas.
PaintContext implements Canvas while still having its
own commit() method to cause the paint actions to apply to
the Element for the next frame.
This adds a new PictureRecorder which also implements Canvas
and has an endRecording() method which returns a Picture
(another new interface) which can be held from Dart.

There is also now a rootPicture setter on Document which takes
a Picture and will then make the Document draw that Picture
until changed.

This piggybacks on the existing custom painting system
which adds the painting at background-and-borders paint
time so technically if you both set rootPicture as well as
construct a DOM you will draw the DOM on top of your picture. :)

R=mpcomplete@chromium.org

Review URL: https://codereview.chromium.org/1122423009
2015-05-13 13:16:47 -07:00
Eric Seidel
d12f84c818 Add pubspec.yaml files for each of the examples/ directories
so that pub get will create a packages/ directory for each
and users of packages/sky/sky_tool can run these examples
from sky_sdk as the instructions say to.

TBR=ianh@google.com
https://github.com/domokit/mojo/issues/128

Review URL: https://codereview.chromium.org/1110283002
2015-04-28 16:26:38 -07:00
Eric Seidel
72902ef85b Teach window.location.href setter to handle relative urls.
Also fixed display of text in touch-demo.sky

R=ianh@google.com

Review URL: https://codereview.chromium.org/1059743004
2015-04-14 12:16:51 -07:00
Adam Barth
854f083f1b Clean up examples directory
1) Merge input example into widgets example
2) Move single-file, non-fn examples into a "raw" directory
3) Rename stocks-fn and widgets-fn to stocks and widgets

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1005393006
2015-03-26 14:32:40 -07:00