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/output/software_renderer.h" | 5 #include "cc/output/software_renderer.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 std::unique_ptr<SoftwareOutputDevice> software_output_device) { | 37 std::unique_ptr<SoftwareOutputDevice> software_output_device) { |
38 output_surface_ = | 38 output_surface_ = |
39 FakeOutputSurface::CreateSoftware(std::move(software_output_device)); | 39 FakeOutputSurface::CreateSoftware(std::move(software_output_device)); |
40 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 40 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
41 | 41 |
42 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); | 42 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
43 resource_provider_ = FakeResourceProvider::Create( | 43 resource_provider_ = FakeResourceProvider::Create( |
44 output_surface_.get(), shared_bitmap_manager_.get()); | 44 output_surface_.get(), shared_bitmap_manager_.get()); |
45 renderer_ = base::MakeUnique<SoftwareRenderer>( | 45 renderer_ = base::MakeUnique<SoftwareRenderer>( |
46 &settings_, output_surface_.get(), resource_provider()); | 46 &settings_, output_surface_.get(), resource_provider()); |
| 47 renderer_->Initialize(); |
47 renderer_->SetVisible(true); | 48 renderer_->SetVisible(true); |
48 } | 49 } |
49 | 50 |
50 ResourceProvider* resource_provider() const { | 51 ResourceProvider* resource_provider() const { |
51 return resource_provider_.get(); | 52 return resource_provider_.get(); |
52 } | 53 } |
53 | 54 |
54 SoftwareRenderer* renderer() const { return renderer_.get(); } | 55 SoftwareRenderer* renderer() const { return renderer_.get(); } |
55 | 56 |
56 std::unique_ptr<SkBitmap> DrawAndCopyOutput(RenderPassList* list, | 57 std::unique_ptr<SkBitmap> DrawAndCopyOutput(RenderPassList* list, |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 private: | 419 private: |
419 SkCanvas* canvas_ = nullptr; | 420 SkCanvas* canvas_ = nullptr; |
420 gfx::Rect damage_rect_at_start_; | 421 gfx::Rect damage_rect_at_start_; |
421 gfx::Rect clip_rect_at_end_; | 422 gfx::Rect clip_rect_at_end_; |
422 }; | 423 }; |
423 | 424 |
424 TEST_F(SoftwareRendererTest, PartialSwap) { | 425 TEST_F(SoftwareRendererTest, PartialSwap) { |
425 float device_scale_factor = 1.f; | 426 float device_scale_factor = 1.f; |
426 gfx::Rect device_viewport_rect(0, 0, 100, 100); | 427 gfx::Rect device_viewport_rect(0, 0, 100, 100); |
427 | 428 |
| 429 settings_.partial_swap_enabled = true; |
| 430 |
428 auto device_owned = base::MakeUnique<PartialSwapSoftwareOutputDevice>(); | 431 auto device_owned = base::MakeUnique<PartialSwapSoftwareOutputDevice>(); |
429 auto* device = device_owned.get(); | 432 auto* device = device_owned.get(); |
430 InitializeRenderer(std::move(device_owned)); | 433 InitializeRenderer(std::move(device_owned)); |
431 | 434 |
432 gfx::Rect viewport_rect(100, 100); | 435 gfx::Rect viewport_rect(100, 100); |
433 gfx::Rect clip_rect(100, 100); | 436 gfx::Rect clip_rect(100, 100); |
434 | 437 |
435 RenderPassList list; | 438 RenderPassList list; |
436 | 439 |
437 RenderPassId root_pass_id(1, 0); | 440 RenderPassId root_pass_id(1, 0); |
(...skipping 10 matching lines...) Expand all Loading... |
448 viewport_rect, clip_rect); | 451 viewport_rect, clip_rect); |
449 | 452 |
450 // The damage rect should be reported to the SoftwareOutputDevice. | 453 // The damage rect should be reported to the SoftwareOutputDevice. |
451 EXPECT_EQ(gfx::Rect(2, 2, 3, 3), device->damage_rect_at_start()); | 454 EXPECT_EQ(gfx::Rect(2, 2, 3, 3), device->damage_rect_at_start()); |
452 // The SkCanvas should be clipped to the damage rect. | 455 // The SkCanvas should be clipped to the damage rect. |
453 EXPECT_EQ(gfx::Rect(2, 2, 3, 3), device->clip_rect_at_end()); | 456 EXPECT_EQ(gfx::Rect(2, 2, 3, 3), device->clip_rect_at_end()); |
454 } | 457 } |
455 | 458 |
456 } // namespace | 459 } // namespace |
457 } // namespace cc | 460 } // namespace cc |
OLD | NEW |