| OLD | NEW |
| 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 "compositor_state_deserializer.h" | 5 #include "compositor_state_deserializer.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "cc/animation/animation_host.h" | 8 #include "cc/animation/animation_host.h" |
| 9 #include "cc/blimp/client_picture_cache.h" | 9 #include "cc/blimp/client_picture_cache.h" |
| 10 #include "cc/blimp/compositor_proto_state.h" | 10 #include "cc/blimp/compositor_proto_state.h" |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 TEST_F(CompositorStateDeserializerTest, PictureLayer) { | 332 TEST_F(CompositorStateDeserializerTest, PictureLayer) { |
| 333 scoped_refptr<Layer> root_layer = Layer::Create(); | 333 scoped_refptr<Layer> root_layer = Layer::Create(); |
| 334 root_layer->SetBounds(gfx::Size(10, 10)); | 334 root_layer->SetBounds(gfx::Size(10, 10)); |
| 335 root_layer->SetIsDrawable(true); | 335 root_layer->SetIsDrawable(true); |
| 336 layer_tree_host_remote_->GetLayerTree()->SetRootLayer(root_layer); | 336 layer_tree_host_remote_->GetLayerTree()->SetRootLayer(root_layer); |
| 337 | 337 |
| 338 gfx::Size layer_size = gfx::Size(5, 5); | 338 gfx::Size layer_size = gfx::Size(5, 5); |
| 339 | 339 |
| 340 gfx::PointF offset(2.f, 3.f); | 340 gfx::PointF offset(2.f, 3.f); |
| 341 SkPictureRecorder recorder; | 341 SkPictureRecorder recorder; |
| 342 sk_sp<SkCanvas> canvas; | 342 SkCanvas* canvas; |
| 343 SkPaint red_paint; | 343 SkPaint red_paint; |
| 344 red_paint.setColor(SK_ColorRED); | 344 red_paint.setColor(SK_ColorRED); |
| 345 canvas = sk_ref_sp(recorder.beginRecording(SkRect::MakeXYWH( | 345 canvas = recorder.beginRecording(SkRect::MakeXYWH( |
| 346 offset.x(), offset.y(), layer_size.width(), layer_size.height()))); | 346 offset.x(), offset.y(), layer_size.width(), layer_size.height())); |
| 347 canvas->translate(offset.x(), offset.y()); | 347 canvas->translate(offset.x(), offset.y()); |
| 348 canvas->drawRectCoords(0.f, 0.f, 4.f, 4.f, red_paint); | 348 canvas->drawRectCoords(0.f, 0.f, 4.f, 4.f, red_paint); |
| 349 sk_sp<SkPicture> test_picture = recorder.finishRecordingAsPicture(); | 349 sk_sp<SkPicture> test_picture = recorder.finishRecordingAsPicture(); |
| 350 | 350 |
| 351 DisplayItemListSettings settings; | 351 DisplayItemListSettings settings; |
| 352 settings.use_cached_picture = false; | 352 settings.use_cached_picture = false; |
| 353 scoped_refptr<DisplayItemList> display_list = | 353 scoped_refptr<DisplayItemList> display_list = |
| 354 DisplayItemList::Create(settings); | 354 DisplayItemList::Create(settings); |
| 355 const gfx::Rect visual_rect(0, 0, 42, 42); | 355 const gfx::Rect visual_rect(0, 0, 42, 42); |
| 356 display_list->CreateAndAppendDrawingItem<DrawingDisplayItem>(visual_rect, | 356 display_list->CreateAndAppendDrawingItem<DrawingDisplayItem>(visual_rect, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 picture_layer2->id())); | 394 picture_layer2->id())); |
| 395 scoped_refptr<DisplayItemList> client_display_list2 = | 395 scoped_refptr<DisplayItemList> client_display_list2 = |
| 396 client_picture_layer2->client()->PaintContentsToDisplayList( | 396 client_picture_layer2->client()->PaintContentsToDisplayList( |
| 397 ContentLayerClient::PaintingControlSetting::PAINTING_BEHAVIOR_NORMAL); | 397 ContentLayerClient::PaintingControlSetting::PAINTING_BEHAVIOR_NORMAL); |
| 398 EXPECT_TRUE(AreDisplayListDrawingResultsSame( | 398 EXPECT_TRUE(AreDisplayListDrawingResultsSame( |
| 399 gfx::Rect(layer_size), display_list.get(), client_display_list2.get())); | 399 gfx::Rect(layer_size), display_list.get(), client_display_list2.get())); |
| 400 } | 400 } |
| 401 | 401 |
| 402 } // namespace | 402 } // namespace |
| 403 } // namespace cc | 403 } // namespace cc |
| OLD | NEW |