Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1606 } else if (content_is_suitable_for_gpu_rasterization_) { | 1606 } else if (content_is_suitable_for_gpu_rasterization_) { |
| 1607 use_gpu = true; | 1607 use_gpu = true; |
| 1608 gpu_rasterization_status_ = GpuRasterizationStatus::ON; | 1608 gpu_rasterization_status_ = GpuRasterizationStatus::ON; |
| 1609 } else if (using_msaa_for_complex_content) { | 1609 } else if (using_msaa_for_complex_content) { |
| 1610 use_gpu = use_msaa = true; | 1610 use_gpu = use_msaa = true; |
| 1611 gpu_rasterization_status_ = GpuRasterizationStatus::MSAA_CONTENT; | 1611 gpu_rasterization_status_ = GpuRasterizationStatus::MSAA_CONTENT; |
| 1612 } else { | 1612 } else { |
| 1613 gpu_rasterization_status_ = GpuRasterizationStatus::OFF_CONTENT; | 1613 gpu_rasterization_status_ = GpuRasterizationStatus::OFF_CONTENT; |
| 1614 } | 1614 } |
| 1615 | 1615 |
| 1616 if (use_gpu) { | |
|
danakj
2015/05/13 20:47:49
I think this is better than making InitializeRende
| |
| 1617 // Ensure that a GrContext is initialized for GPU rasterization. | |
| 1618 if (!output_surface_->context_provider() || | |
| 1619 !output_surface_->worker_context_provider() || | |
| 1620 !output_surface_->worker_context_provider()->GrContext()) { | |
| 1621 use_gpu = false; | |
| 1622 use_msaa = false; | |
| 1623 gpu_rasterization_status_ = GpuRasterizationStatus::OFF_DEVICE; | |
| 1624 } | |
| 1625 } | |
| 1626 | |
| 1616 if (use_gpu == use_gpu_rasterization_ && use_msaa == use_msaa_) | 1627 if (use_gpu == use_gpu_rasterization_ && use_msaa == use_msaa_) |
| 1617 return; | 1628 return; |
| 1618 | 1629 |
| 1619 // Note that this must happen first, in case the rest of the calls want to | 1630 // Note that this must happen first, in case the rest of the calls want to |
| 1620 // query the new state of |use_gpu_rasterization_|. | 1631 // query the new state of |use_gpu_rasterization_|. |
| 1621 use_gpu_rasterization_ = use_gpu; | 1632 use_gpu_rasterization_ = use_gpu; |
| 1622 use_msaa_ = use_msaa; | 1633 use_msaa_ = use_msaa; |
| 1623 | 1634 |
| 1624 // Clean up and replace existing tile manager with another one that uses | 1635 // Clean up and replace existing tile manager with another one that uses |
| 1625 // appropriate rasterizer. | 1636 // appropriate rasterizer. |
| (...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3399 new_target.SetToMin(layer_impl->MaxScrollOffset()); | 3410 new_target.SetToMin(layer_impl->MaxScrollOffset()); |
| 3400 | 3411 |
| 3401 curve->UpdateTarget( | 3412 curve->UpdateTarget( |
| 3402 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) | 3413 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) |
| 3403 .InSecondsF(), | 3414 .InSecondsF(), |
| 3404 new_target); | 3415 new_target); |
| 3405 | 3416 |
| 3406 return true; | 3417 return true; |
| 3407 } | 3418 } |
| 3408 } // namespace cc | 3419 } // namespace cc |
| OLD | NEW |