| OLD | NEW |
| 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 Loading... |
| 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 skia::RefPtr<SkPicture> picture; | 57 skia::RefPtr<SkPicture> picture; |
| 56 | 58 |
| 57 for (RectPaintVector::const_iterator it = draw_rects_.begin(); | 59 for (RectPaintVector::const_iterator it = draw_rects_.begin(); |
| 58 it != draw_rects_.end(); ++it) { | 60 it != draw_rects_.end(); ++it) { |
| 59 const gfx::RectF& draw_rect = it->first; | 61 const gfx::RectF& draw_rect = it->first; |
| 60 const SkPaint& paint = it->second; | 62 const SkPaint& paint = it->second; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 return display_list; | 112 return display_list; |
| 111 } | 113 } |
| 112 | 114 |
| 113 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; } | 115 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; } |
| 114 | 116 |
| 115 size_t FakeContentLayerClient::GetApproximateUnsharedMemoryUsage() const { | 117 size_t FakeContentLayerClient::GetApproximateUnsharedMemoryUsage() const { |
| 116 return reported_memory_usage_; | 118 return reported_memory_usage_; |
| 117 } | 119 } |
| 118 | 120 |
| 119 } // namespace cc | 121 } // namespace cc |
| OLD | NEW |