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

Side by Side Diff: cc/test/fake_content_layer_client.cc

Issue 1512823002: Serialize DisplayListRecordingSource to protos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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 unified diff | Download patch
« no previous file with comments | « cc/test/fake_content_layer_client.h ('k') | cc/test/fake_display_list_recording_source.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/test/fake_content_layer_client.h" 5 #include "cc/test/fake_content_layer_client.h"
6 6
7 #include "cc/playback/clip_display_item.h" 7 #include "cc/playback/clip_display_item.h"
8 #include "cc/playback/display_item_list_settings.h" 8 #include "cc/playback/display_item_list_settings.h"
9 #include "cc/playback/drawing_display_item.h" 9 #include "cc/playback/drawing_display_item.h"
10 #include "cc/playback/transform_display_item.h" 10 #include "cc/playback/transform_display_item.h"
(...skipping 10 matching lines...) Expand all
21 : image(skia::SharePtr(img)), point(point), paint(paint) {} 21 : image(skia::SharePtr(img)), point(point), paint(paint) {}
22 22
23 FakeContentLayerClient::ImageData::ImageData(const SkImage* img, 23 FakeContentLayerClient::ImageData::ImageData(const SkImage* img,
24 const gfx::Transform& transform, 24 const gfx::Transform& transform,
25 const SkPaint& paint) 25 const SkPaint& paint)
26 : image(skia::SharePtr(img)), transform(transform), paint(paint) {} 26 : image(skia::SharePtr(img)), transform(transform), paint(paint) {}
27 27
28 FakeContentLayerClient::ImageData::~ImageData() {} 28 FakeContentLayerClient::ImageData::~ImageData() {}
29 29
30 FakeContentLayerClient::FakeContentLayerClient() 30 FakeContentLayerClient::FakeContentLayerClient()
31 : fill_with_nonsolid_color_(false), 31 : display_list_use_cached_picture_(true),
32 fill_with_nonsolid_color_(false),
32 last_canvas_(nullptr), 33 last_canvas_(nullptr),
33 last_painting_control_(PAINTING_BEHAVIOR_NORMAL), 34 last_painting_control_(PAINTING_BEHAVIOR_NORMAL),
34 reported_memory_usage_(0) {} 35 reported_memory_usage_(0),
36 bounds_set_(false) {}
35 37
36 FakeContentLayerClient::~FakeContentLayerClient() { 38 FakeContentLayerClient::~FakeContentLayerClient() {
37 } 39 }
38 40
39 gfx::Rect FakeContentLayerClient::PaintableRegion() { 41 gfx::Rect FakeContentLayerClient::PaintableRegion() {
40 CHECK(bounds_set_); 42 CHECK(bounds_set_);
41 return gfx::Rect(bounds_); 43 return gfx::Rect(bounds_);
42 } 44 }
43 45
44 scoped_refptr<DisplayItemList> 46 scoped_refptr<DisplayItemList>
45 FakeContentLayerClient::PaintContentsToDisplayList( 47 FakeContentLayerClient::PaintContentsToDisplayList(
46 PaintingControlSetting painting_control) { 48 PaintingControlSetting painting_control) {
47 // Cached picture is used because unit tests expect to be able to 49 // Cached picture is used because unit tests expect to be able to
48 // use GatherPixelRefs. 50 // use GatherPixelRefs.
49 DisplayItemListSettings settings; 51 DisplayItemListSettings settings;
50 settings.use_cached_picture = true; 52 settings.use_cached_picture = display_list_use_cached_picture_;
51 scoped_refptr<DisplayItemList> display_list = 53 scoped_refptr<DisplayItemList> display_list =
52 DisplayItemList::Create(PaintableRegion(), settings); 54 DisplayItemList::Create(PaintableRegion(), settings);
53 SkPictureRecorder recorder; 55 SkPictureRecorder recorder;
54 skia::RefPtr<SkCanvas> canvas; 56 skia::RefPtr<SkCanvas> canvas;
55 57
56 for (RectPaintVector::const_iterator it = draw_rects_.begin(); 58 for (RectPaintVector::const_iterator it = draw_rects_.begin();
57 it != draw_rects_.end(); ++it) { 59 it != draw_rects_.end(); ++it) {
58 const gfx::RectF& draw_rect = it->first; 60 const gfx::RectF& draw_rect = it->first;
59 const SkPaint& paint = it->second; 61 const SkPaint& paint = it->second;
60 canvas = 62 canvas =
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return display_list; 105 return display_list;
104 } 106 }
105 107
106 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; } 108 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; }
107 109
108 size_t FakeContentLayerClient::GetApproximateUnsharedMemoryUsage() const { 110 size_t FakeContentLayerClient::GetApproximateUnsharedMemoryUsage() const {
109 return reported_memory_usage_; 111 return reported_memory_usage_;
110 } 112 }
111 113
112 } // namespace cc 114 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_content_layer_client.h ('k') | cc/test/fake_display_list_recording_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698