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

Unified Diff: mojo/dart/packages/mojo_services/lib/mojo/geometry.mojom.dart

Issue 1517853002: Extend the geometry APIs. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/services/geometry/cpp/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/dart/packages/mojo_services/lib/mojo/geometry.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/geometry.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/geometry.mojom.dart
index 90422dd86a8cb9e1c42256139864fa61d05a6ffc..cdf5a0ef62b9da974f7e775925210f23eadff088 100644
--- a/mojo/dart/packages/mojo_services/lib/mojo/geometry.mojom.dart
+++ b/mojo/dart/packages/mojo_services/lib/mojo/geometry.mojom.dart
@@ -427,6 +427,172 @@ class RectF extends bindings.Struct {
}
+class RRect extends bindings.Struct {
+ static const List<bindings.StructDataHeader> kVersions = const [
+ const bindings.StructDataHeader(56, 0)
+ ];
+ int x = 0;
+ int y = 0;
+ int width = 0;
+ int height = 0;
+ int topLeftRadiusX = 0;
+ int topLeftRadiusY = 0;
+ int topRightRadiusX = 0;
+ int topRightRadiusY = 0;
+ int bottomLeftRadiusX = 0;
+ int bottomLeftRadiusY = 0;
+ int bottomRightRadiusX = 0;
+ int bottomRightRadiusY = 0;
+
+ RRect() : super(kVersions.last.size);
+
+ static RRect deserialize(bindings.Message message) {
+ var decoder = new bindings.Decoder(message);
+ var result = decode(decoder);
+ if (decoder.excessHandles != null) {
+ decoder.excessHandles.forEach((h) => h.close());
+ }
+ return result;
+ }
+
+ static RRect decode(bindings.Decoder decoder0) {
+ if (decoder0 == null) {
+ return null;
+ }
+ RRect result = new RRect();
+
+ var mainDataHeader = decoder0.decodeStructDataHeader();
+ if (mainDataHeader.version <= kVersions.last.version) {
+ // Scan in reverse order to optimize for more recent versions.
+ for (int i = kVersions.length - 1; i >= 0; --i) {
+ if (mainDataHeader.version >= kVersions[i].version) {
+ if (mainDataHeader.size == kVersions[i].size) {
+ // Found a match.
+ break;
+ }
+ throw new bindings.MojoCodecError(
+ 'Header size doesn\'t correspond to known version size.');
+ }
+ }
+ } else if (mainDataHeader.size < kVersions.last.size) {
+ throw new bindings.MojoCodecError(
+ 'Message newer than the last known version cannot be shorter than '
+ 'required by the last known version.');
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.x = decoder0.decodeInt32(8);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.y = decoder0.decodeInt32(12);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.width = decoder0.decodeInt32(16);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.height = decoder0.decodeInt32(20);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.topLeftRadiusX = decoder0.decodeInt32(24);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.topLeftRadiusY = decoder0.decodeInt32(28);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.topRightRadiusX = decoder0.decodeInt32(32);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.topRightRadiusY = decoder0.decodeInt32(36);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.bottomLeftRadiusX = decoder0.decodeInt32(40);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.bottomLeftRadiusY = decoder0.decodeInt32(44);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.bottomRightRadiusX = decoder0.decodeInt32(48);
+ }
+ if (mainDataHeader.version >= 0) {
+
+ result.bottomRightRadiusY = decoder0.decodeInt32(52);
+ }
+ return result;
+ }
+
+ void encode(bindings.Encoder encoder) {
+ var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
+
+ encoder0.encodeInt32(x, 8);
+
+ encoder0.encodeInt32(y, 12);
+
+ encoder0.encodeInt32(width, 16);
+
+ encoder0.encodeInt32(height, 20);
+
+ encoder0.encodeInt32(topLeftRadiusX, 24);
+
+ encoder0.encodeInt32(topLeftRadiusY, 28);
+
+ encoder0.encodeInt32(topRightRadiusX, 32);
+
+ encoder0.encodeInt32(topRightRadiusY, 36);
+
+ encoder0.encodeInt32(bottomLeftRadiusX, 40);
+
+ encoder0.encodeInt32(bottomLeftRadiusY, 44);
+
+ encoder0.encodeInt32(bottomRightRadiusX, 48);
+
+ encoder0.encodeInt32(bottomRightRadiusY, 52);
+ }
+
+ String toString() {
+ return "RRect("
+ "x: $x" ", "
+ "y: $y" ", "
+ "width: $width" ", "
+ "height: $height" ", "
+ "topLeftRadiusX: $topLeftRadiusX" ", "
+ "topLeftRadiusY: $topLeftRadiusY" ", "
+ "topRightRadiusX: $topRightRadiusX" ", "
+ "topRightRadiusY: $topRightRadiusY" ", "
+ "bottomLeftRadiusX: $bottomLeftRadiusX" ", "
+ "bottomLeftRadiusY: $bottomLeftRadiusY" ", "
+ "bottomRightRadiusX: $bottomRightRadiusX" ", "
+ "bottomRightRadiusY: $bottomRightRadiusY" ")";
+ }
+
+ Map toJson() {
+ Map map = new Map();
+ map["x"] = x;
+ map["y"] = y;
+ map["width"] = width;
+ map["height"] = height;
+ map["topLeftRadiusX"] = topLeftRadiusX;
+ map["topLeftRadiusY"] = topLeftRadiusY;
+ map["topRightRadiusX"] = topRightRadiusX;
+ map["topRightRadiusY"] = topRightRadiusY;
+ map["bottomLeftRadiusX"] = bottomLeftRadiusX;
+ map["bottomLeftRadiusY"] = bottomLeftRadiusY;
+ map["bottomRightRadiusX"] = bottomRightRadiusX;
+ map["bottomRightRadiusY"] = bottomRightRadiusY;
+ return map;
+ }
+}
+
+
class Transform extends bindings.Struct {
static const List<bindings.StructDataHeader> kVersions = const [
const bindings.StructDataHeader(16, 0)
« no previous file with comments | « no previous file | mojo/services/geometry/cpp/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698