| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "cc/playback/clip_display_item.h" | 9 #include "cc/playback/clip_display_item.h" |
| 10 #include "cc/playback/display_item_list_settings.h" | 10 #include "cc/playback/display_item_list_settings.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 scoped_refptr<DisplayItemList> | 50 scoped_refptr<DisplayItemList> |
| 51 FakeContentLayerClient::PaintContentsToDisplayList( | 51 FakeContentLayerClient::PaintContentsToDisplayList( |
| 52 PaintingControlSetting painting_control) { | 52 PaintingControlSetting painting_control) { |
| 53 // Cached picture is used because unit tests expect to be able to | 53 // Cached picture is used because unit tests expect to be able to |
| 54 // use GatherPixelRefs. | 54 // use GatherPixelRefs. |
| 55 DisplayItemListSettings settings; | 55 DisplayItemListSettings settings; |
| 56 settings.use_cached_picture = display_list_use_cached_picture_; | 56 settings.use_cached_picture = display_list_use_cached_picture_; |
| 57 scoped_refptr<DisplayItemList> display_list = | 57 scoped_refptr<DisplayItemList> display_list = |
| 58 DisplayItemList::Create(PaintableRegion(), settings); | 58 DisplayItemList::Create(settings); |
| 59 display_list->SetRetainVisualRectsForTesting(true); |
| 59 SkPictureRecorder recorder; | 60 SkPictureRecorder recorder; |
| 60 sk_sp<SkCanvas> canvas; | 61 sk_sp<SkCanvas> canvas; |
| 61 | 62 |
| 62 for (RectPaintVector::const_iterator it = draw_rects_.begin(); | 63 for (RectPaintVector::const_iterator it = draw_rects_.begin(); |
| 63 it != draw_rects_.end(); ++it) { | 64 it != draw_rects_.end(); ++it) { |
| 64 const gfx::RectF& draw_rect = it->first; | 65 const gfx::RectF& draw_rect = it->first; |
| 65 const SkPaint& paint = it->second; | 66 const SkPaint& paint = it->second; |
| 66 canvas = sk_ref_sp(recorder.beginRecording(gfx::RectFToSkRect(draw_rect))); | 67 canvas = sk_ref_sp(recorder.beginRecording(gfx::RectFToSkRect(draw_rect))); |
| 67 canvas->drawRect(gfx::RectFToSkRect(draw_rect), paint); | 68 canvas->drawRect(gfx::RectFToSkRect(draw_rect), paint); |
| 68 display_list->CreateAndAppendDrawingItem<DrawingDisplayItem>( | 69 display_list->CreateAndAppendDrawingItem<DrawingDisplayItem>( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 return display_list; | 105 return display_list; |
| 105 } | 106 } |
| 106 | 107 |
| 107 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; } | 108 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; } |
| 108 | 109 |
| 109 size_t FakeContentLayerClient::GetApproximateUnsharedMemoryUsage() const { | 110 size_t FakeContentLayerClient::GetApproximateUnsharedMemoryUsage() const { |
| 110 return reported_memory_usage_; | 111 return reported_memory_usage_; |
| 111 } | 112 } |
| 112 | 113 |
| 113 } // namespace cc | 114 } // namespace cc |
| OLD | NEW |