Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Issue 1214833004: Split Size into Size and Offset. (Closed)

Created:
5 years, 6 months ago by Hixie
Modified:
5 years, 6 months ago
CC:
abarth-chromium, gregsimon, jackson_old, mojo-reviews_chromium.org, qsr+mojo_chromium.org
Base URL:
https://github.com/domokit/mojo.git@master
Target Ref:
refs/heads/master
Project:
mojo
Visibility:
Public.

Description

Split Size into Size and Offset. Added a OffsetBase class that Size now inherits from, and added a new Offset class that also inherits from OffsetBase. Offset has: - dx and dy members - zero and infinite static constants - a method that returns a new Offset that's the existing one scaled by a scalar - a unary minus operator - operators overloads such that subtracting or adding two Offsets gives another Offset - a toPoint() method Added Offset and Size to the dart bindings, so they can be used from C++. Changed the Canvas API to use Point, Size, and Offset where appropriate: - drawLine uses Points now - drawCircle uses a Point now - drawImage uses a Paint now - the constructor uses a Size Changed Point as follows: - added a unary minus - Point difference now gives an Offset rather than a Size - You can add an Offset to a Point to get a new Point - toSize() has been replaced by toOffset() Changed Rect as follows: - renamed upperLeft and lowerRight to topLeft and bottomRight for consistency with our other APIs - added bottomLeft and topRight for completeness Changed Size as follows: - now inherits from OffsetBase - added *, /, ~/, and % operators for scaling sizes - subtracting a Size from a Size gives an Offset - subtracting an Offset from a Size gives a Size - changed the + operator to take an Offset instead of a Size - added topLeft, bottomLeft, topRight, bottomRight to match Rect - added center for the same reason - added shortestSide getter since that was a common pattern - removed toPoint() Changed DrawLooperLayerInfo as follows: - setOffset member takes an Offset instead of a Point Changed BoxConstraints as follows: - added biggest getter since it was a common pattern - added smallest getter for symmetry Changed BoxShadow as follows: - offset member is an Offset rather than a Size Changed ViewConstraints as follows: - replaced height and width members by a single size member I did some minor code cleanup in nearby files while I was there, including sorting sky/engine/core/core.gni alphabetically, and fixing some warnings in the examples. BUG= R=abarth@chromium.org, chinmaygarde@google.com Committed: https://chromium.googlesource.com/external/mojo/+/196833cdb92a7cdada6f60aa95d45a1aa54cf378

Patch Set 1 #

Patch Set 2 : add the new files also #

Total comments: 3

Patch Set 3 : fix tests, fix comments, and merge #

Patch Set 4 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+455 lines, -386 lines) Patch
M sky/engine/bindings/scripts/dart_types.py View 2 chunks +4 lines, -0 lines 0 comments Download
M sky/engine/bindings/scripts/templates/interface_dart.template View 1 chunk +1 line, -1 line 0 comments Download
M sky/engine/core/core.gni View 34 chunks +161 lines, -157 lines 0 comments Download
M sky/engine/core/painting/Canvas.h View 4 chunks +8 lines, -9 lines 0 comments Download
M sky/engine/core/painting/Canvas.cpp View 3 chunks +6 lines, -9 lines 0 comments Download
M sky/engine/core/painting/Canvas.idl View 2 chunks +4 lines, -4 lines 0 comments Download
M sky/engine/core/painting/DrawLooperLayerInfo.h View 2 chunks +3 lines, -2 lines 0 comments Download
M sky/engine/core/painting/DrawLooperLayerInfo.idl View 1 chunk +1 line, -2 lines 0 comments Download
M sky/engine/core/painting/Image.idl View 1 chunk +1 line, -0 lines 0 comments Download
A + sky/engine/core/painting/Offset.h View 1 1 chunk +10 lines, -10 lines 0 comments Download
A + sky/engine/core/painting/Offset.cpp View 1 2 chunks +14 lines, -17 lines 0 comments Download
A sky/engine/core/painting/Offset.dart View 1 1 chunk +29 lines, -0 lines 0 comments Download
A sky/engine/core/painting/OffsetBase.dart View 1 1 chunk +28 lines, -0 lines 0 comments Download
M sky/engine/core/painting/Point.cpp View 1 chunk +2 lines, -5 lines 0 comments Download
M sky/engine/core/painting/Point.dart View 1 2 1 chunk +5 lines, -4 lines 0 comments Download
M sky/engine/core/painting/Rect.dart View 3 chunks +5 lines, -3 lines 0 comments Download
A + sky/engine/core/painting/Size.h View 1 1 chunk +10 lines, -10 lines 0 comments Download
A + sky/engine/core/painting/Size.cpp View 1 2 chunks +14 lines, -17 lines 0 comments Download
M sky/engine/core/painting/Size.dart View 1 2 3 1 chunk +32 lines, -20 lines 0 comments Download
M sky/engine/core/script/dom_dart_state.h View 2 chunks +4 lines, -0 lines 0 comments Download
M sky/engine/core/script/dom_dart_state.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M sky/engine/core/view/View.idl View 1 chunk +2 lines, -0 lines 0 comments Download
M sky/sdk/lib/example/game/lib/game_demo_world.dart View 1 2 1 chunk +1 line, -1 line 0 comments Download
M sky/sdk/lib/example/game/lib/sprite.dart View 1 2 1 chunk +1 line, -1 line 0 comments Download
M sky/sdk/lib/example/game/lib/sprite_box.dart View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M sky/sdk/lib/example/raw/baseline.dart View 1 2 1 chunk +1 line, -1 line 0 comments Download
M sky/sdk/lib/example/raw/hello_world.dart View 1 2 1 chunk +4 lines, -5 lines 0 comments Download
M sky/sdk/lib/example/raw/launcher.dart View 1 2 1 chunk +4 lines, -5 lines 0 comments Download
M sky/sdk/lib/example/raw/painting.dart View 1 2 5 chunks +9 lines, -8 lines 0 comments Download
M sky/sdk/lib/example/raw/shadow.dart View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M sky/sdk/lib/example/raw/spinning_arabic.dart View 1 2 1 chunk +1 line, -1 line 0 comments Download
M sky/sdk/lib/example/raw/spinning_image.dart View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M sky/sdk/lib/example/raw/spinning_square.dart View 1 2 1 chunk +1 line, -1 line 0 comments Download
M sky/sdk/lib/example/rendering/touch_demo.dart View 1 2 3 chunks +23 lines, -24 lines 0 comments Download
M sky/sdk/lib/example/stocks2/lib/stock_arrow.dart View 1 2 1 chunk +1 line, -1 line 0 comments Download
M sky/sdk/lib/example/widgets/sector.dart View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M sky/sdk/lib/painting/box_painter.dart View 3 chunks +3 lines, -3 lines 0 comments Download
M sky/sdk/lib/painting/shadows.dart View 1 chunk +2 lines, -2 lines 0 comments Download
M sky/sdk/lib/rendering/box.dart View 7 chunks +11 lines, -13 lines 0 comments Download
M sky/sdk/lib/rendering/object.dart View 2 chunks +3 lines, -3 lines 0 comments Download
M sky/sdk/lib/rendering/sky_binding.dart View 1 chunk +1 line, -1 line 0 comments Download
M sky/sdk/lib/rendering/stack.dart View 1 chunk +1 line, -1 line 0 comments Download
M sky/sdk/lib/theme/shadows.dart View 2 chunks +11 lines, -11 lines 0 comments Download
M sky/sdk/lib/widgets/basic.dart View 1 chunk +1 line, -1 line 0 comments Download
M sky/sdk/lib/widgets/ink_well.dart View 1 chunk +1 line, -1 line 0 comments Download
M sky/sdk/lib/widgets/radio.dart View 1 chunk +2 lines, -2 lines 0 comments Download
M sky/sdk/lib/widgets/scaffold.dart View 1 chunk +1 line, -1 line 0 comments Download
M sky/sdk/lib/widgets/switch.dart View 1 chunk +1 line, -1 line 0 comments Download
M sky/sdk/lib/widgets/widget.dart View 1 chunk +1 line, -1 line 0 comments Download
M sky/tests/examples/stocks-expected.txt View 2 chunks +2 lines, -2 lines 0 comments Download
M sky/tests/resources/display_list.dart View 6 chunks +14 lines, -16 lines 0 comments Download
M sky/tests/widgets/buttons-expected.txt View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 7 (3 generated)
Hixie
(I've found a couple of things that need fixing still but overall it should be ...
5 years, 6 months ago (2015-06-26 21:52:43 UTC) #2
Chinmay
lgtm https://codereview.chromium.org/1214833004/diff/20001/sky/engine/core/painting/OffsetBase.dart File sky/engine/core/painting/OffsetBase.dart (right): https://codereview.chromium.org/1214833004/diff/20001/sky/engine/core/painting/OffsetBase.dart#newcode23 sky/engine/core/painting/OffsetBase.dart:23: int result = 373; Maybe we should move ...
5 years, 6 months ago (2015-06-26 21:55:18 UTC) #4
abarth-chromium
lgtm https://codereview.chromium.org/1214833004/diff/20001/sky/engine/core/painting/Offset.dart File sky/engine/core/painting/Offset.dart (right): https://codereview.chromium.org/1214833004/diff/20001/sky/engine/core/painting/Offset.dart#newcode25 sky/engine/core/painting/Offset.dart:25: // does the equivalent of "return new Point(0,0) ...
5 years, 6 months ago (2015-06-26 22:04:43 UTC) #6
Hixie
5 years, 6 months ago (2015-06-26 22:21:33 UTC) #7
Message was sent while issue was closed.
Committed patchset #4 (id:60001) manually as
196833cdb92a7cdada6f60aa95d45a1aa54cf378 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698