diff options
author | dtrainor <dtrainor@chromium.org> | 2015-10-28 09:02:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-28 16:03:33 +0000 |
commit | 2191e4d3cb6b574fd532547a8f93e02f9168a706 (patch) | |
tree | 557ba88e2f263f76111a1f717543e75e71914d09 /cc/proto | |
parent | c754d858cdae6ae15a554ecbc003d67b41168605 (diff) | |
download | chromium_src-2191e4d3cb6b574fd532547a8f93e02f9168a706.zip chromium_src-2191e4d3cb6b574fd532547a8f93e02f9168a706.tar.gz chromium_src-2191e4d3cb6b574fd532547a8f93e02f9168a706.tar.bz2 |
Add protobuf serialization to DisplayItemList
Serialize the following classes:
- DisplayItemListSettings
- DisplayItemList
- DisplayItem and all subclasses
- Did not fully serialize FilterDisplayItem. Serializing
FilterOperations will require more work. Will do in a follow up CL.
Added unit tests for all DisplayItems serialized.
BUG=541321
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1407793002
Cr-Commit-Position: refs/heads/master@{#356563}
Diffstat (limited to 'cc/proto')
-rw-r--r-- | cc/proto/BUILD.gn | 1 | ||||
-rw-r--r-- | cc/proto/display_item.proto | 93 | ||||
-rw-r--r-- | cc/proto/gfx_conversions.h | 2 | ||||
-rw-r--r-- | cc/proto/skia_conversions.h | 2 |
4 files changed, 98 insertions, 0 deletions
diff --git a/cc/proto/BUILD.gn b/cc/proto/BUILD.gn index acf5e9b..dcd4214 100644 --- a/cc/proto/BUILD.gn +++ b/cc/proto/BUILD.gn @@ -29,6 +29,7 @@ proto_library("proto_internal") { sources = [ # TODO(dtrainor): Move protos to their correct packages once it's possible # to include protos from other directories/targets (crbug.com/542423). + "display_item.proto", "point.proto", "pointf.proto", "rect.proto", diff --git a/cc/proto/display_item.proto b/cc/proto/display_item.proto new file mode 100644 index 0000000..6a01dff --- /dev/null +++ b/cc/proto/display_item.proto @@ -0,0 +1,93 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +syntax = "proto2"; + +import "skregion.proto"; +import "skrrect.proto"; +import "skxfermode.proto"; +import "rect.proto"; +import "rectf.proto"; +import "transform.proto"; + +option optimize_for = LITE_RUNTIME; + +package cc.proto; + +message DisplayItemListSettings { + optional bool use_cached_picture = 1; +} + +message DisplayItemList { + repeated DisplayItem items = 1; + optional cc.proto.Rect layer_rect = 2; + optional DisplayItemListSettings settings = 3; +} + +message DisplayItem { + enum Type { + Type_Clip = 1; + Type_EndClip = 2; + Type_ClipPath = 3; + Type_EndClipPath = 4; + Type_Compositing = 5; + Type_EndCompositing = 6; + Type_Drawing = 7; + Type_Filter = 8; + Type_EndFilter = 9; + Type_FloatClip = 10; + Type_EndFloatClip = 11; + Type_Transform = 12; + Type_EndTransform = 13; + } + + optional Type type = 1; + + // Unique DisplayItem types. |type| determines which one (if any) is valid. + optional ClipDisplayItem clip_item = 1000; + optional ClipPathDisplayItem clip_path_item = 1001; + optional CompositingDisplayItem compositing_item = 1002; + optional DrawingDisplayItem drawing_item = 1003; + optional FilterDisplayItem filter_item = 1004; + optional FloatClipDisplayItem float_clip_item = 1005; + optional TransformDisplayItem transform_item = 1006; +} + +message ClipDisplayItem { + optional cc.proto.Rect clip_rect = 1; + + repeated cc.proto.SkRRect rounded_rects = 2; +} + +message ClipPathDisplayItem { + optional cc.proto.SkRegion.Op clip_op = 1; + optional bool antialias = 2; + optional bytes clip_path = 3; /* SkPath */ +} + +message CompositingDisplayItem { + optional uint32 alpha = 1; + + optional cc.proto.SkXfermode.Mode mode = 2; + optional cc.proto.RectF bounds = 3; + optional bytes color_filter = 4; /* SkColorFilter */ +} + +message DrawingDisplayItem { + optional bytes picture = 1; /* SkPicture */ +} + +message FilterDisplayItem { + optional cc.proto.RectF bounds = 1; + + // TODO(dtrainor): Support FilterOperations. +} + +message FloatClipDisplayItem { + optional cc.proto.RectF clip_rect = 1; +} + +message TransformDisplayItem { + optional cc.proto.Transform transform = 1; +} diff --git a/cc/proto/gfx_conversions.h b/cc/proto/gfx_conversions.h index e982e58..5b5c315 100644 --- a/cc/proto/gfx_conversions.h +++ b/cc/proto/gfx_conversions.h @@ -29,6 +29,8 @@ class SizeF; class Transform; } +// TODO(dtrainor): Move these to a class and make them static +// (crbug.com/548432). CC_EXPORT void PointToProto(const gfx::Point& point, proto::Point* proto); CC_EXPORT gfx::Point ProtoToPoint(const proto::Point& proto); diff --git a/cc/proto/skia_conversions.h b/cc/proto/skia_conversions.h index 302e313c..6735cf1 100644 --- a/cc/proto/skia_conversions.h +++ b/cc/proto/skia_conversions.h @@ -21,6 +21,8 @@ namespace proto { class SkRRect; } +// TODO(dtrainor): Move these to a class and make them static +// (crbug.com/548432). CC_EXPORT SkRegion::Op SkRegionOpFromProto(proto::SkRegion::Op op); CC_EXPORT proto::SkRegion::Op SkRegionOpToProto(SkRegion::Op op); |