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

Side by Side Diff: blimp/test/support/compositor/picture_cache_test_support.cc

Issue 2509983004: Revert "Change call-sites now that SkCanvas is not ref-counted" (Closed)
Patch Set: 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 "blimp/test/support/compositor/picture_cache_test_support.h" 5 #include "blimp/test/support/compositor/picture_cache_test_support.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "blimp/common/blob_cache/blob_cache.h" 8 #include "blimp/common/blob_cache/blob_cache.h"
9 #include "blimp/common/blob_cache/id_util.h" 9 #include "blimp/common/blob_cache/id_util.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
11 #include "third_party/skia/include/core/SkColor.h" 11 #include "third_party/skia/include/core/SkColor.h"
12 #include "third_party/skia/include/core/SkData.h" 12 #include "third_party/skia/include/core/SkData.h"
13 #include "third_party/skia/include/core/SkPicture.h" 13 #include "third_party/skia/include/core/SkPicture.h"
14 #include "third_party/skia/include/core/SkPictureRecorder.h" 14 #include "third_party/skia/include/core/SkPictureRecorder.h"
15 #include "third_party/skia/include/core/SkRefCnt.h" 15 #include "third_party/skia/include/core/SkRefCnt.h"
16 #include "ui/gfx/geometry/point_f.h" 16 #include "ui/gfx/geometry/point_f.h"
17 #include "ui/gfx/geometry/rect.h" 17 #include "ui/gfx/geometry/rect.h"
18 #include "ui/gfx/geometry/rect_f.h" 18 #include "ui/gfx/geometry/rect_f.h"
19 #include "ui/gfx/skia_util.h" 19 #include "ui/gfx/skia_util.h"
20 20
21 namespace blimp { 21 namespace blimp {
22 22
23 sk_sp<const SkPicture> CreateSkPicture(SkColor color) { 23 sk_sp<const SkPicture> CreateSkPicture(SkColor color) {
24 SkPictureRecorder recorder; 24 SkPictureRecorder recorder;
25 SkCanvas* canvas = recorder.beginRecording(SkRect::MakeWH(1, 1)); 25 sk_sp<SkCanvas> canvas =
26 sk_ref_sp(recorder.beginRecording(SkRect::MakeWH(1, 1)));
26 canvas->drawColor(color); 27 canvas->drawColor(color);
27 return recorder.finishRecordingAsPicture(); 28 return recorder.finishRecordingAsPicture();
28 } 29 }
29 30
30 sk_sp<SkData> SerializePicture(sk_sp<const SkPicture> picture) { 31 sk_sp<SkData> SerializePicture(sk_sp<const SkPicture> picture) {
31 sk_sp<SkData> data = picture->serialize(); 32 sk_sp<SkData> data = picture->serialize();
32 DCHECK_GT(data->size(), 0u); 33 DCHECK_GT(data->size(), 0u);
33 return data; 34 return data;
34 } 35 }
35 36
(...skipping 14 matching lines...) Expand all
50 sk_sp<const SkPicture> deserialized_picture = 51 sk_sp<const SkPicture> deserialized_picture =
51 DeserializePicture(picture_data.data); 52 DeserializePicture(picture_data.data);
52 return GetBlobId(picture) == GetBlobId(deserialized_picture); 53 return GetBlobId(picture) == GetBlobId(deserialized_picture);
53 } 54 }
54 55
55 cc::PictureData CreatePictureData(sk_sp<const SkPicture> picture) { 56 cc::PictureData CreatePictureData(sk_sp<const SkPicture> picture) {
56 return cc::PictureData(picture->uniqueID(), SerializePicture(picture)); 57 return cc::PictureData(picture->uniqueID(), SerializePicture(picture));
57 } 58 }
58 59
59 } // namespace blimp 60 } // namespace blimp
OLDNEW
« no previous file with comments | « android_webview/native/java_browser_view_renderer_helper.cc ('k') | cc/blimp/compositor_state_deserializer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698