| 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 "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 SoftwareRenderer::SoftwareRenderer(const RendererSettings* settings, | 56 SoftwareRenderer::SoftwareRenderer(const RendererSettings* settings, |
| 57 OutputSurface* output_surface, | 57 OutputSurface* output_surface, |
| 58 ResourceProvider* resource_provider) | 58 ResourceProvider* resource_provider) |
| 59 : DirectRenderer(settings, output_surface, resource_provider), | 59 : DirectRenderer(settings, output_surface, resource_provider), |
| 60 output_device_(output_surface->software_device()) { | 60 output_device_(output_surface->software_device()) { |
| 61 if (resource_provider_) { | 61 if (resource_provider_) { |
| 62 capabilities_.max_texture_size = resource_provider_->max_texture_size(); | 62 capabilities_.max_texture_size = resource_provider_->max_texture_size(); |
| 63 capabilities_.best_texture_format = | 63 capabilities_.best_texture_format = |
| 64 resource_provider_->best_texture_format(); | 64 resource_provider_->best_texture_format(); |
| 65 } | 65 } |
| 66 // The updater can access bitmaps while the SoftwareRenderer is using them. | |
| 67 capabilities_.allow_partial_texture_updates = true; | |
| 68 capabilities_.using_partial_swap = true; | |
| 69 | |
| 70 capabilities_.using_shared_memory_resources = true; | 66 capabilities_.using_shared_memory_resources = true; |
| 71 | |
| 72 capabilities_.allow_rasterize_on_demand = true; | |
| 73 } | 67 } |
| 74 | 68 |
| 75 SoftwareRenderer::~SoftwareRenderer() {} | 69 SoftwareRenderer::~SoftwareRenderer() {} |
| 76 | 70 |
| 77 const RendererCapabilitiesImpl& SoftwareRenderer::Capabilities() const { | 71 const RendererCapabilitiesImpl& SoftwareRenderer::Capabilities() const { |
| 78 return capabilities_; | 72 return capabilities_; |
| 79 } | 73 } |
| 80 | 74 |
| 75 bool SoftwareRenderer::CanPartialSwap() { |
| 76 return true; |
| 77 } |
| 78 |
| 81 void SoftwareRenderer::BeginDrawingFrame(DrawingFrame* frame) { | 79 void SoftwareRenderer::BeginDrawingFrame(DrawingFrame* frame) { |
| 82 TRACE_EVENT0("cc", "SoftwareRenderer::BeginDrawingFrame"); | 80 TRACE_EVENT0("cc", "SoftwareRenderer::BeginDrawingFrame"); |
| 83 root_canvas_ = output_device_->BeginPaint(frame->root_damage_rect); | 81 root_canvas_ = output_device_->BeginPaint(frame->root_damage_rect); |
| 84 } | 82 } |
| 85 | 83 |
| 86 void SoftwareRenderer::FinishDrawingFrame(DrawingFrame* frame) { | 84 void SoftwareRenderer::FinishDrawingFrame(DrawingFrame* frame) { |
| 87 TRACE_EVENT0("cc", "SoftwareRenderer::FinishDrawingFrame"); | 85 TRACE_EVENT0("cc", "SoftwareRenderer::FinishDrawingFrame"); |
| 88 current_framebuffer_lock_ = nullptr; | 86 current_framebuffer_lock_ = nullptr; |
| 89 current_framebuffer_canvas_.reset(); | 87 current_framebuffer_canvas_.reset(); |
| 90 current_canvas_ = nullptr; | 88 current_canvas_ = nullptr; |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 ApplyImageFilter(filter.get(), quad, backdrop_bitmap, nullptr); | 719 ApplyImageFilter(filter.get(), quad, backdrop_bitmap, nullptr); |
| 722 | 720 |
| 723 if (!filter_backdrop_image) | 721 if (!filter_backdrop_image) |
| 724 return nullptr; | 722 return nullptr; |
| 725 | 723 |
| 726 return filter_backdrop_image->makeShader(content_tile_mode, content_tile_mode, | 724 return filter_backdrop_image->makeShader(content_tile_mode, content_tile_mode, |
| 727 &filter_backdrop_transform); | 725 &filter_backdrop_transform); |
| 728 } | 726 } |
| 729 | 727 |
| 730 } // namespace cc | 728 } // namespace cc |
| OLD | NEW |