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

Side by Side Diff: cc/blimp/picture_data_conversions_unittest.cc

Issue 2476113002: Change call-sites now that SkCanvas is not ref-counted (Closed)
Patch Set: try fixing win again Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/blimp/picture_data_conversions.h" 5 #include "cc/blimp/picture_data_conversions.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "cc/blimp/picture_data.h" 12 #include "cc/blimp/picture_data.h"
13 #include "cc/proto/layer_tree_host.pb.h" 13 #include "cc/proto/layer_tree_host.pb.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "third_party/skia/include/core/SkCanvas.h" 15 #include "third_party/skia/include/core/SkCanvas.h"
16 #include "third_party/skia/include/core/SkColor.h" 16 #include "third_party/skia/include/core/SkColor.h"
17 #include "third_party/skia/include/core/SkData.h" 17 #include "third_party/skia/include/core/SkData.h"
18 #include "third_party/skia/include/core/SkPicture.h" 18 #include "third_party/skia/include/core/SkPicture.h"
19 #include "third_party/skia/include/core/SkPictureRecorder.h" 19 #include "third_party/skia/include/core/SkPictureRecorder.h"
20 #include "third_party/skia/include/core/SkRefCnt.h" 20 #include "third_party/skia/include/core/SkRefCnt.h"
21 21
22 namespace cc { 22 namespace cc {
23 namespace { 23 namespace {
24 sk_sp<const SkPicture> CreateSkPicture(SkColor color) { 24 sk_sp<const SkPicture> CreateSkPicture(SkColor color) {
25 SkPictureRecorder recorder; 25 SkPictureRecorder recorder;
26 sk_sp<SkCanvas> canvas = 26 recorder.beginRecording(SkRect::MakeWH(1, 1))->drawColor(color);
27 sk_ref_sp(recorder.beginRecording(SkRect::MakeWH(1, 1)));
28 canvas->drawColor(color);
29 return recorder.finishRecordingAsPicture(); 27 return recorder.finishRecordingAsPicture();
30 } 28 }
31 29
32 sk_sp<SkData> SerializePicture(sk_sp<const SkPicture> picture) { 30 sk_sp<SkData> SerializePicture(sk_sp<const SkPicture> picture) {
33 sk_sp<SkData> data = picture->serialize(); 31 sk_sp<SkData> data = picture->serialize();
34 DCHECK_GT(data->size(), 0u); 32 DCHECK_GT(data->size(), 0u);
35 return data; 33 return data;
36 } 34 }
37 35
38 bool SamePicture(sk_sp<const SkPicture> picture, 36 bool SamePicture(sk_sp<const SkPicture> picture,
(...skipping 25 matching lines...) Expand all
64 62
65 ASSERT_EQ(2U, deserialized.size()); 63 ASSERT_EQ(2U, deserialized.size());
66 PictureData picture_data_1 = deserialized.at(0); 64 PictureData picture_data_1 = deserialized.at(0);
67 PictureData picture_data_2 = deserialized.at(1); 65 PictureData picture_data_2 = deserialized.at(1);
68 EXPECT_TRUE(SamePicture(picture1, picture_data_1)); 66 EXPECT_TRUE(SamePicture(picture1, picture_data_1));
69 EXPECT_TRUE(SamePicture(picture2, picture_data_2)); 67 EXPECT_TRUE(SamePicture(picture2, picture_data_2));
70 } 68 }
71 69
72 } // namespace 70 } // namespace
73 } // namespace cc 71 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698