diff options
author | nyquist <nyquist@chromium.org> | 2015-11-24 02:04:17 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-24 10:05:13 +0000 |
commit | 04b8bd2ea68f22f8051d9988e4872e51c4ab4409 (patch) | |
tree | effe1cb2581aa3f180f361d737187156ad9de524 /cc/playback | |
parent | 94740e359d1173f1d262857b7ebeb7913bf2218a (diff) | |
download | chromium_src-04b8bd2ea68f22f8051d9988e4872e51c4ab4409.zip chromium_src-04b8bd2ea68f22f8051d9988e4872e51c4ab4409.tar.gz chromium_src-04b8bd2ea68f22f8051d9988e4872e51c4ab4409.tar.bz2 |
Add support for converting cc::Region to and from protobuf.
For the (de)serialization of property trees and layers, we need to be
able to serialize several data types and this CL adds conversions and
a unit test for the cc::Region type.
The conversion of cc::Region happens by serializing a list of
gfx::Rect objects, and then on the deserialization side the union
of the gfx::Rect objects are created to recreate the cc::Region.
The initial version of this CL used writeToMemory and readFromMemory
in Skia, and a suggestion was made to fix using uint8_t instead of
char[], and this change still keeps this fix, even after those methods
are not in use anymore.
This is done in a separate CL to keep the logic-changing CLs clean
and focused.
BUG=538710
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1460503004
Cr-Commit-Position: refs/heads/master@{#361302}
Diffstat (limited to 'cc/playback')
-rw-r--r-- | cc/playback/clip_path_display_item.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cc/playback/clip_path_display_item.cc b/cc/playback/clip_path_display_item.cc index 3b46621..a5037a2 100644 --- a/cc/playback/clip_path_display_item.cc +++ b/cc/playback/clip_path_display_item.cc @@ -41,9 +41,9 @@ void ClipPathDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { // Just use skia's serialization method for the SkPath for now. size_t path_size = clip_path_.writeToMemory(nullptr); if (path_size > 0) { - scoped_ptr<char[]> buffer(new char[path_size]); + scoped_ptr<uint8_t[]> buffer(new uint8_t[path_size]); clip_path_.writeToMemory(buffer.get()); - details->set_clip_path(std::string(buffer.get(), path_size)); + details->set_clip_path(buffer.get(), path_size); } } @@ -56,7 +56,7 @@ void ClipPathDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { SkPath clip_path; if (details.has_clip_path()) { - size_t bytes_read = clip_path.readFromMemory(details.clip_path().c_str(), + size_t bytes_read = clip_path.readFromMemory(details.clip_path().data(), details.clip_path().size()); DCHECK_EQ(details.clip_path().size(), bytes_read); } |