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 CCLayerTreeHostImpl_h | 5 #ifndef CCLayerTreeHostImpl_h |
6 #define CCLayerTreeHostImpl_h | 6 #define CCLayerTreeHostImpl_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" |
11 #include "cc/animation_events.h" | 11 #include "cc/animation_events.h" |
| 12 #include "cc/cc_export.h" |
12 #include "cc/input_handler.h" | 13 #include "cc/input_handler.h" |
13 #include "cc/layer_sorter.h" | 14 #include "cc/layer_sorter.h" |
14 #include "cc/render_pass.h" | 15 #include "cc/render_pass.h" |
15 #include "cc/render_pass_sink.h" | 16 #include "cc/render_pass_sink.h" |
16 #include "cc/renderer.h" | 17 #include "cc/renderer.h" |
17 #include "third_party/skia/include/core/SkColor.h" | 18 #include "third_party/skia/include/core/SkColor.h" |
18 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
19 #include <public/WebCompositorOutputSurfaceClient.h> | 20 #include <public/WebCompositorOutputSurfaceClient.h> |
20 | 21 |
21 namespace cc { | 22 namespace cc { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 float m_pageScaleDelta; | 93 float m_pageScaleDelta; |
93 float m_sentPageScaleDelta; | 94 float m_sentPageScaleDelta; |
94 float m_maxPageScaleFactor; | 95 float m_maxPageScaleFactor; |
95 float m_minPageScaleFactor; | 96 float m_minPageScaleFactor; |
96 | 97 |
97 FloatPoint m_pinchViewportScrollDelta; | 98 FloatPoint m_pinchViewportScrollDelta; |
98 gfx::SizeF m_layoutViewportSize; | 99 gfx::SizeF m_layoutViewportSize; |
99 }; | 100 }; |
100 | 101 |
101 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta
te | 102 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta
te |
102 class LayerTreeHostImpl : public InputHandlerClient, | 103 class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, |
103 public RendererClient, | 104 public RendererClient, |
104 public WebKit::WebCompositorOutputSurfaceClient { | 105 public NON_EXPORTED_BASE(WebKit::WebComposit
orOutputSurfaceClient) { |
105 typedef std::vector<LayerImpl*> LayerList; | 106 typedef std::vector<LayerImpl*> LayerList; |
106 | 107 |
107 public: | 108 public: |
108 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT
reeHostImplClient*); | 109 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT
reeHostImplClient*); |
109 virtual ~LayerTreeHostImpl(); | 110 virtual ~LayerTreeHostImpl(); |
110 | 111 |
111 // InputHandlerClient implementation | 112 // InputHandlerClient implementation |
112 virtual InputHandlerClient::ScrollStatus scrollBegin(const gfx::Point&, Inpu
tHandlerClient::ScrollInputType) OVERRIDE; | 113 virtual InputHandlerClient::ScrollStatus scrollBegin(const gfx::Point&, Inpu
tHandlerClient::ScrollInputType) OVERRIDE; |
113 virtual void scrollBy(const gfx::Point&, const IntSize&) OVERRIDE; | 114 virtual void scrollBy(const gfx::Point&, const IntSize&) OVERRIDE; |
114 virtual void scrollEnd() OVERRIDE; | 115 virtual void scrollEnd() OVERRIDE; |
115 virtual void pinchGestureBegin() OVERRIDE; | 116 virtual void pinchGestureBegin() OVERRIDE; |
116 virtual void pinchGestureUpdate(float, const IntPoint&) OVERRIDE; | 117 virtual void pinchGestureUpdate(float, const IntPoint&) OVERRIDE; |
117 virtual void pinchGestureEnd() OVERRIDE; | 118 virtual void pinchGestureEnd() OVERRIDE; |
118 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool anc
horPoint, float pageScale, base::TimeTicks startTime, base::TimeDelta duration)
OVERRIDE; | 119 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool anc
horPoint, float pageScale, base::TimeTicks startTime, base::TimeDelta duration)
OVERRIDE; |
119 virtual void scheduleAnimation() OVERRIDE; | 120 virtual void scheduleAnimation() OVERRIDE; |
120 | 121 |
121 struct FrameData : public RenderPassSink { | 122 struct CC_EXPORT FrameData : public RenderPassSink { |
122 FrameData(); | 123 FrameData(); |
123 ~FrameData(); | 124 ~FrameData(); |
124 | 125 |
125 std::vector<gfx::Rect> occludingScreenSpaceRects; | 126 std::vector<gfx::Rect> occludingScreenSpaceRects; |
126 RenderPassList renderPasses; | 127 RenderPassList renderPasses; |
127 RenderPassIdHashMap renderPassesById; | 128 RenderPassIdHashMap renderPassesById; |
128 LayerList* renderSurfaceLayerList; | 129 LayerList* renderSurfaceLayerList; |
129 LayerList willDrawLayers; | 130 LayerList willDrawLayers; |
130 | 131 |
131 // RenderPassSink implementation. | 132 // RenderPassSink implementation. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 void setNeedsRedraw(); | 226 void setNeedsRedraw(); |
226 | 227 |
227 void renderingStats(RenderingStats*) const; | 228 void renderingStats(RenderingStats*) const; |
228 | 229 |
229 void updateRootScrollLayerImplTransform(); | 230 void updateRootScrollLayerImplTransform(); |
230 | 231 |
231 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } | 232 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } |
232 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get()
; } | 233 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get()
; } |
233 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } | 234 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } |
234 | 235 |
235 class CullRenderPassesWithCachedTextures { | 236 class CC_EXPORT CullRenderPassesWithCachedTextures { |
236 public: | 237 public: |
237 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&)
const; | 238 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&)
const; |
238 | 239 |
239 // Iterates from the root first, in order to remove the surfaces closest | 240 // Iterates from the root first, in order to remove the surfaces closest |
240 // to the root with cached textures, and all surfaces that draw into | 241 // to the root with cached textures, and all surfaces that draw into |
241 // them. | 242 // them. |
242 size_t renderPassListBegin(const RenderPassList& list) const { return li
st.size() - 1; } | 243 size_t renderPassListBegin(const RenderPassList& list) const { return li
st.size() - 1; } |
243 size_t renderPassListEnd(const RenderPassList&) const { return 0 - 1; } | 244 size_t renderPassListEnd(const RenderPassList&) const { return 0 - 1; } |
244 size_t renderPassListNext(size_t it) const { return it - 1; } | 245 size_t renderPassListNext(size_t it) const { return it - 1; } |
245 | 246 |
246 CullRenderPassesWithCachedTextures(Renderer& renderer) : m_renderer(rend
erer) { } | 247 CullRenderPassesWithCachedTextures(Renderer& renderer) : m_renderer(rend
erer) { } |
247 private: | 248 private: |
248 Renderer& m_renderer; | 249 Renderer& m_renderer; |
249 }; | 250 }; |
250 | 251 |
251 class CullRenderPassesWithNoQuads { | 252 class CC_EXPORT CullRenderPassesWithNoQuads { |
252 public: | 253 public: |
253 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&)
const; | 254 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&)
const; |
254 | 255 |
255 // Iterates in draw order, so that when a surface is removed, and its | 256 // Iterates in draw order, so that when a surface is removed, and its |
256 // target becomes empty, then its target can be removed also. | 257 // target becomes empty, then its target can be removed also. |
257 size_t renderPassListBegin(const RenderPassList&) const { return 0; } | 258 size_t renderPassListBegin(const RenderPassList&) const { return 0; } |
258 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } | 259 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } |
259 size_t renderPassListNext(size_t it) const { return it + 1; } | 260 size_t renderPassListNext(size_t it) const { return it + 1; } |
260 }; | 261 }; |
261 | 262 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 350 |
350 size_t m_numImplThreadScrolls; | 351 size_t m_numImplThreadScrolls; |
351 size_t m_numMainThreadScrolls; | 352 size_t m_numMainThreadScrolls; |
352 | 353 |
353 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 354 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
354 }; | 355 }; |
355 | 356 |
356 } // namespace cc | 357 } // namespace cc |
357 | 358 |
358 #endif | 359 #endif |
OLD | NEW |