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 #ifndef CC_LAYER_TREE_HOST_IMPL_H_ | 5 #ifndef CC_LAYER_TREE_HOST_IMPL_H_ |
6 #define CC_LAYER_TREE_HOST_IMPL_H_ | 6 #define CC_LAYER_TREE_HOST_IMPL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 void readback(void* pixels, const gfx::Rect&); | 208 void readback(void* pixels, const gfx::Rect&); |
209 | 209 |
210 LayerTreeImpl* activeTree() { return m_activeTree.get(); } | 210 LayerTreeImpl* activeTree() { return m_activeTree.get(); } |
211 const LayerTreeImpl* activeTree() const { return m_activeTree.get(); } | 211 const LayerTreeImpl* activeTree() const { return m_activeTree.get(); } |
212 LayerTreeImpl* pendingTree() { return m_pendingTree.get(); } | 212 LayerTreeImpl* pendingTree() { return m_pendingTree.get(); } |
213 const LayerTreeImpl* pendingTree() const { return m_pendingTree.get(); } | 213 const LayerTreeImpl* pendingTree() const { return m_pendingTree.get(); } |
214 void createPendingTree(); | 214 void createPendingTree(); |
215 virtual void activatePendingTreeIfNeeded(); | 215 virtual void activatePendingTreeIfNeeded(); |
216 | 216 |
217 // TODO(nduca): Remove these in favor of LayerTreeImpl. | 217 // Shortcuts to layers on the active tree. |
218 void setRootLayer(scoped_ptr<LayerImpl>); | |
219 LayerImpl* rootLayer() const; | 218 LayerImpl* rootLayer() const; |
220 | |
221 // Release ownership of the current layer tree and replace it with an empty | |
222 // tree. Returns the root layer of the detached tree. | |
223 scoped_ptr<LayerImpl> detachLayerTree(); | |
224 | |
225 LayerImpl* rootScrollLayer() const; | 219 LayerImpl* rootScrollLayer() const; |
226 | |
227 // TOOD(nduca): This goes away when scrolling moves to LayerTreeImpl. | |
228 LayerImpl* currentlyScrollingLayer() const; | 220 LayerImpl* currentlyScrollingLayer() const; |
229 | 221 |
230 bool visible() const { return m_visible; } | 222 bool visible() const { return m_visible; } |
231 void setVisible(bool); | 223 void setVisible(bool); |
232 | 224 |
233 bool contentsTexturesPurged() const { return m_contentsTexturesPurged; } | 225 bool contentsTexturesPurged() const { return m_contentsTexturesPurged; } |
234 void setContentsTexturesPurged(); | 226 void setContentsTexturesPurged(); |
235 void resetContentsTexturesPurged(); | 227 void resetContentsTexturesPurged(); |
236 size_t memoryAllocationLimitBytes() const { return m_managedMemoryPolicy.byt
esLimitWhenVisible; } | 228 size_t memoryAllocationLimitBytes() const { return m_managedMemoryPolicy.byt
esLimitWhenVisible; } |
237 | 229 |
238 void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& d
eviceViewportSize); | 230 void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& d
eviceViewportSize); |
239 const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; } | 231 const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; } |
240 | 232 |
241 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 233 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
242 void setDeviceScaleFactor(float); | 234 void setDeviceScaleFactor(float); |
243 | 235 |
244 float pageScaleFactor() const; | 236 float pageScaleFactor() const; |
245 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa
ctor, float maxPageScaleFactor); | 237 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa
ctor, float maxPageScaleFactor); |
246 | 238 |
247 scoped_ptr<ScrollAndScaleSet> processScrollDeltas(); | 239 scoped_ptr<ScrollAndScaleSet> processScrollDeltas(); |
248 gfx::Transform implTransform() const; | 240 gfx::Transform implTransform() const; |
249 | 241 |
250 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, flo
at scale, base::TimeDelta duration); | 242 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, flo
at scale, base::TimeDelta duration); |
251 | 243 |
252 SkColor backgroundColor() const { return m_backgroundColor; } | |
253 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } | |
254 | |
255 bool hasTransparentBackground() const { return m_hasTransparentBackground; } | |
256 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } | |
257 bool needsAnimateLayers() const { return !m_animationRegistrar->active_anima
tion_controllers().empty(); } | 244 bool needsAnimateLayers() const { return !m_animationRegistrar->active_anima
tion_controllers().empty(); } |
258 | 245 |
259 bool needsUpdateDrawProperties() const { return m_needsUpdateDrawProperties;
} | 246 bool needsUpdateDrawProperties() const { return m_needsUpdateDrawProperties;
} |
260 void setNeedsUpdateDrawProperties() { m_needsUpdateDrawProperties = true; } | 247 void setNeedsUpdateDrawProperties() { m_needsUpdateDrawProperties = true; } |
261 | 248 |
262 void setNeedsRedraw(); | 249 void setNeedsRedraw(); |
263 | 250 |
264 void renderingStats(RenderingStats*) const; | 251 void renderingStats(RenderingStats*) const; |
265 | 252 |
266 void sendManagedMemoryStats( | 253 void sendManagedMemoryStats( |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 bool m_scrollDeltaIsInViewportSpace; | 357 bool m_scrollDeltaIsInViewportSpace; |
371 LayerTreeSettings m_settings; | 358 LayerTreeSettings m_settings; |
372 LayerTreeDebugState m_debugState; | 359 LayerTreeDebugState m_debugState; |
373 gfx::Size m_layoutViewportSize; | 360 gfx::Size m_layoutViewportSize; |
374 gfx::Size m_deviceViewportSize; | 361 gfx::Size m_deviceViewportSize; |
375 float m_deviceScaleFactor; | 362 float m_deviceScaleFactor; |
376 bool m_visible; | 363 bool m_visible; |
377 bool m_contentsTexturesPurged; | 364 bool m_contentsTexturesPurged; |
378 ManagedMemoryPolicy m_managedMemoryPolicy; | 365 ManagedMemoryPolicy m_managedMemoryPolicy; |
379 | 366 |
380 SkColor m_backgroundColor; | |
381 bool m_hasTransparentBackground; | |
382 | |
383 bool m_needsUpdateDrawProperties; | 367 bool m_needsUpdateDrawProperties; |
384 bool m_pinchGestureActive; | 368 bool m_pinchGestureActive; |
385 gfx::Point m_previousPinchAnchor; | 369 gfx::Point m_previousPinchAnchor; |
386 | 370 |
387 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; | 371 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; |
388 | 372 |
389 // This is used for ticking animations slowly when hidden. | 373 // This is used for ticking animations slowly when hidden. |
390 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; | 374 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; |
391 | 375 |
392 PinchZoomViewport m_pinchZoomViewport; | 376 PinchZoomViewport m_pinchZoomViewport; |
(...skipping 13 matching lines...) Expand all Loading... |
406 size_t m_lastSentMemoryUseBytes; | 390 size_t m_lastSentMemoryUseBytes; |
407 | 391 |
408 scoped_ptr<AnimationRegistrar> m_animationRegistrar; | 392 scoped_ptr<AnimationRegistrar> m_animationRegistrar; |
409 | 393 |
410 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 394 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
411 }; | 395 }; |
412 | 396 |
413 } // namespace cc | 397 } // namespace cc |
414 | 398 |
415 #endif // CC_LAYER_TREE_HOST_IMPL_H_ | 399 #endif // CC_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |