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/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 LayerTreeSettings::LayerTreeSettings() | 96 LayerTreeSettings::LayerTreeSettings() |
97 : acceleratePainting(false) | 97 : acceleratePainting(false) |
98 , implSidePainting(false) | 98 , implSidePainting(false) |
99 , renderVSyncEnabled(true) | 99 , renderVSyncEnabled(true) |
100 , perTilePaintingEnabled(false) | 100 , perTilePaintingEnabled(false) |
101 , partialSwapEnabled(false) | 101 , partialSwapEnabled(false) |
102 , acceleratedAnimationEnabled(true) | 102 , acceleratedAnimationEnabled(true) |
103 , pageScalePinchZoomEnabled(false) | 103 , pageScalePinchZoomEnabled(false) |
104 , backgroundColorInsteadOfCheckerboard(false) | 104 , backgroundColorInsteadOfCheckerboard(false) |
105 , showOverdrawInTracing(false) | 105 , showOverdrawInTracing(false) |
| 106 , canUseLCDText(true) |
106 , refreshRate(0) | 107 , refreshRate(0) |
107 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) | 108 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) |
108 , numRasterThreads(1) | 109 , numRasterThreads(1) |
109 , defaultTileSize(gfx::Size(256, 256)) | 110 , defaultTileSize(gfx::Size(256, 256)) |
110 , maxUntiledLayerSize(gfx::Size(512, 512)) | 111 , maxUntiledLayerSize(gfx::Size(512, 512)) |
111 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) | 112 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) |
112 { | 113 { |
113 // TODO(danakj): Move this to chromium when we don't go through the WebKit A
PI anymore. | 114 // TODO(danakj): Move this to chromium when we don't go through the WebKit A
PI anymore. |
114 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches:
:kEnableImplSidePainting); | 115 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches:
:kEnableImplSidePainting); |
115 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k
EnablePartialSwap); | 116 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k
EnablePartialSwap); |
116 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has
Switch(switches::kBackgroundColorInsteadOfCheckerboard); | 117 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has
Switch(switches::kBackgroundColorInsteadOfCheckerboard); |
117 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches
::kTraceOverdraw); | 118 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches
::kTraceOverdraw); |
118 | 119 |
| 120 // TODO(alokp): Remove this hard-coded setting. |
| 121 // Platforms that need to disable LCD text must explicitly set this value. |
| 122 #if defined(OS_ANDROID) |
| 123 canUseLCDText = false; |
| 124 #endif |
| 125 |
119 initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess(
)->HasSwitch(cc::switches::kShowPropertyChangedRects); | 126 initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess(
)->HasSwitch(cc::switches::kShowPropertyChangedRects); |
120 initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()-
>HasSwitch(cc::switches::kShowSurfaceDamageRects); | 127 initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()-
>HasSwitch(cc::switches::kShowSurfaceDamageRects); |
121 initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->H
asSwitch(cc::switches::kShowScreenSpaceRects); | 128 initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->H
asSwitch(cc::switches::kShowScreenSpaceRects); |
122 initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProce
ss()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects); | 129 initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProce
ss()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects); |
123 initialDebugState.showOccludingRects = CommandLine::ForCurrentProcess()->Has
Switch(cc::switches::kShowOccludingRects); | 130 initialDebugState.showOccludingRects = CommandLine::ForCurrentProcess()->Has
Switch(cc::switches::kShowOccludingRects); |
124 initialDebugState.showNonOccludingRects = CommandLine::ForCurrentProcess()->
HasSwitch(cc::switches::kShowNonOccludingRects); | 131 initialDebugState.showNonOccludingRects = CommandLine::ForCurrentProcess()->
HasSwitch(cc::switches::kShowNonOccludingRects); |
125 | 132 |
126 if (CommandLine::ForCurrentProcess()->HasSwitch( | 133 if (CommandLine::ForCurrentProcess()->HasSwitch( |
127 switches::kNumRasterThreads)) { | 134 switches::kNumRasterThreads)) { |
128 const size_t kMaxRasterThreads = 64; | 135 const size_t kMaxRasterThreads = 64; |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 LayerList updateList; | 681 LayerList updateList; |
675 | 682 |
676 { | 683 { |
677 if (m_settings.pageScalePinchZoomEnabled) { | 684 if (m_settings.pageScalePinchZoomEnabled) { |
678 Layer* rootScroll = findFirstScrollableLayer(rootLayer); | 685 Layer* rootScroll = findFirstScrollableLayer(rootLayer); |
679 if (rootScroll) | 686 if (rootScroll) |
680 rootScroll->setImplTransform(m_implTransform); | 687 rootScroll->setImplTransform(m_implTransform); |
681 } | 688 } |
682 | 689 |
683 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::calcDrawEtc"); | 690 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::calcDrawEtc"); |
684 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSi
ze(), m_deviceScaleFactor, m_pageScaleFactor, rendererCapabilities().maxTextureS
ize, updateList); | 691 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSi
ze(), m_deviceScaleFactor, m_pageScaleFactor, rendererCapabilities().maxTextureS
ize, m_settings.canUseLCDText, updateList); |
685 } | 692 } |
686 | 693 |
687 // Reset partial texture update requests. | 694 // Reset partial texture update requests. |
688 m_partialTextureUpdateRequests = 0; | 695 m_partialTextureUpdateRequests = 0; |
689 | 696 |
690 bool needMoreUpdates = paintLayerContents(updateList, queue); | 697 bool needMoreUpdates = paintLayerContents(updateList, queue); |
691 if (m_triggerIdleUpdates && needMoreUpdates) { | 698 if (m_triggerIdleUpdates && needMoreUpdates) { |
692 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::posting prepaint task")
; | 699 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::posting prepaint task")
; |
693 m_prepaintCallback.Reset(base::Bind(&LayerTreeHost::triggerPrepaint, bas
e::Unretained(this))); | 700 m_prepaintCallback.Reset(base::Bind(&LayerTreeHost::triggerPrepaint, bas
e::Unretained(this))); |
694 static base::TimeDelta prepaintDelay = base::TimeDelta::FromMilliseconds
(100); | 701 static base::TimeDelta prepaintDelay = base::TimeDelta::FromMilliseconds
(100); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 else | 981 else |
975 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); | 982 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); |
976 } | 983 } |
977 } | 984 } |
978 | 985 |
979 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 986 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
980 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 987 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
981 } | 988 } |
982 | 989 |
983 } // namespace cc | 990 } // namespace cc |
OLD | NEW |