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_IMPL_H_ | 5 #ifndef CC_LAYER_IMPL_H_ |
6 #define CC_LAYER_IMPL_H_ | 6 #define CC_LAYER_IMPL_H_ |
7 | 7 |
| 8 #include <public/WebFilterOperations.h> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "cc/cc_export.h" | 13 #include "cc/cc_export.h" |
13 #include "cc/input_handler.h" | 14 #include "cc/input_handler.h" |
14 #include "cc/layer_animation_controller.h" | 15 #include "cc/layer_animation_controller.h" |
15 #include "cc/region.h" | 16 #include "cc/region.h" |
16 #include "cc/render_pass.h" | 17 #include "cc/render_pass.h" |
17 #include "cc/render_surface_impl.h" | 18 #include "cc/render_surface_impl.h" |
18 #include "cc/resource_provider.h" | 19 #include "cc/resource_provider.h" |
19 #include "cc/scoped_ptr_vector.h" | 20 #include "cc/scoped_ptr_vector.h" |
20 #include "cc/shared_quad_state.h" | 21 #include "cc/shared_quad_state.h" |
21 #include "third_party/skia/include/core/SkColor.h" | 22 #include "third_party/skia/include/core/SkColor.h" |
22 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
23 #include "ui/gfx/rect_f.h" | 24 #include "ui/gfx/rect_f.h" |
24 #include <public/WebFilterOperations.h> | 25 #include "ui/gfx/transform.h" |
25 #include <public/WebTransformationMatrix.h> | |
26 | 26 |
27 namespace cc { | 27 namespace cc { |
28 | 28 |
29 class LayerSorter; | 29 class LayerSorter; |
30 class LayerTreeHostImpl; | 30 class LayerTreeHostImpl; |
31 class QuadSink; | 31 class QuadSink; |
32 class Renderer; | 32 class Renderer; |
33 class ScrollbarAnimationController; | 33 class ScrollbarAnimationController; |
34 class ScrollbarLayerImpl; | 34 class ScrollbarLayerImpl; |
35 class Layer; | 35 class Layer; |
36 | 36 |
37 struct AppendQuadsData; | 37 struct AppendQuadsData; |
38 | 38 |
39 class CC_EXPORT LayerImpl : public LayerAnimationControllerClient { | 39 class CC_EXPORT LayerImpl : public LayerAnimationControllerClient { |
40 public: | 40 public: |
41 static scoped_ptr<LayerImpl> create(int id) | 41 static scoped_ptr<LayerImpl> create(int id) |
42 { | 42 { |
43 return make_scoped_ptr(new LayerImpl(id)); | 43 return make_scoped_ptr(new LayerImpl(id)); |
44 } | 44 } |
45 | 45 |
46 virtual ~LayerImpl(); | 46 virtual ~LayerImpl(); |
47 | 47 |
48 // LayerAnimationControllerClient implementation. | 48 // LayerAnimationControllerClient implementation. |
49 virtual int id() const OVERRIDE; | 49 virtual int id() const OVERRIDE; |
50 virtual void setOpacityFromAnimation(float) OVERRIDE; | 50 virtual void setOpacityFromAnimation(float) OVERRIDE; |
51 virtual float opacity() const OVERRIDE; | 51 virtual float opacity() const OVERRIDE; |
52 virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix
&) OVERRIDE; | 52 virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE; |
53 virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE; | 53 virtual const gfx::Transform& transform() const OVERRIDE; |
54 | 54 |
55 // Tree structure. | 55 // Tree structure. |
56 LayerImpl* parent() { return m_parent; } | 56 LayerImpl* parent() { return m_parent; } |
57 const LayerImpl* parent() const { return m_parent; } | 57 const LayerImpl* parent() const { return m_parent; } |
58 const ScopedPtrVector<LayerImpl>& children() const { return m_children; } | 58 const ScopedPtrVector<LayerImpl>& children() const { return m_children; } |
59 void addChild(scoped_ptr<LayerImpl>); | 59 void addChild(scoped_ptr<LayerImpl>); |
60 void removeFromParent(); | 60 void removeFromParent(); |
61 void removeAllChildren(); | 61 void removeAllChildren(); |
62 | 62 |
63 void setMaskLayer(scoped_ptr<LayerImpl>); | 63 void setMaskLayer(scoped_ptr<LayerImpl>); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 void setPreserves3D(bool); | 139 void setPreserves3D(bool); |
140 bool preserves3D() const { return m_preserves3D; } | 140 bool preserves3D() const { return m_preserves3D; } |
141 | 141 |
142 void setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) { m_us
eParentBackfaceVisibility = useParentBackfaceVisibility; } | 142 void setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) { m_us
eParentBackfaceVisibility = useParentBackfaceVisibility; } |
143 bool useParentBackfaceVisibility() const { return m_useParentBackfaceVisibil
ity; } | 143 bool useParentBackfaceVisibility() const { return m_useParentBackfaceVisibil
ity; } |
144 | 144 |
145 void setUseLCDText(bool useLCDText) { m_useLCDText = useLCDText; } | 145 void setUseLCDText(bool useLCDText) { m_useLCDText = useLCDText; } |
146 bool useLCDText() const { return m_useLCDText; } | 146 bool useLCDText() const { return m_useLCDText; } |
147 | 147 |
148 void setSublayerTransform(const WebKit::WebTransformationMatrix&); | 148 void setSublayerTransform(const gfx::Transform&); |
149 const WebKit::WebTransformationMatrix& sublayerTransform() const { return m_
sublayerTransform; } | 149 const gfx::Transform& sublayerTransform() const { return m_sublayerTransform
; } |
150 | 150 |
151 // Debug layer name. | 151 // Debug layer name. |
152 void setDebugName(const std::string& debugName) { m_debugName = debugName; } | 152 void setDebugName(const std::string& debugName) { m_debugName = debugName; } |
153 std::string debugName() const { return m_debugName; } | 153 std::string debugName() const { return m_debugName; } |
154 | 154 |
155 bool showDebugBorders() const; | 155 bool showDebugBorders() const; |
156 | 156 |
157 RenderSurfaceImpl* renderSurface() const { return m_renderSurface.get(); } | 157 RenderSurfaceImpl* renderSurface() const { return m_renderSurface.get(); } |
158 void createRenderSurface(); | 158 void createRenderSurface(); |
159 void clearRenderSurface() { m_renderSurface.reset(); } | 159 void clearRenderSurface() { m_renderSurface.reset(); } |
(...skipping 26 matching lines...) Expand all Loading... |
186 | 186 |
187 gfx::Vector2d scrollOffset() const { return m_scrollOffset; } | 187 gfx::Vector2d scrollOffset() const { return m_scrollOffset; } |
188 void setScrollOffset(gfx::Vector2d); | 188 void setScrollOffset(gfx::Vector2d); |
189 | 189 |
190 gfx::Vector2d maxScrollOffset() const {return m_maxScrollOffset; } | 190 gfx::Vector2d maxScrollOffset() const {return m_maxScrollOffset; } |
191 void setMaxScrollOffset(gfx::Vector2d); | 191 void setMaxScrollOffset(gfx::Vector2d); |
192 | 192 |
193 const gfx::Vector2dF& scrollDelta() const { return m_scrollDelta; } | 193 const gfx::Vector2dF& scrollDelta() const { return m_scrollDelta; } |
194 void setScrollDelta(const gfx::Vector2dF&); | 194 void setScrollDelta(const gfx::Vector2dF&); |
195 | 195 |
196 const WebKit::WebTransformationMatrix& implTransform() const { return m_impl
Transform; } | 196 const gfx::Transform& implTransform() const { return m_implTransform; } |
197 void setImplTransform(const WebKit::WebTransformationMatrix& transform); | 197 void setImplTransform(const gfx::Transform& transform); |
198 | 198 |
199 const gfx::Vector2d& sentScrollDelta() const { return m_sentScrollDelta; } | 199 const gfx::Vector2d& sentScrollDelta() const { return m_sentScrollDelta; } |
200 void setSentScrollDelta(const gfx::Vector2d& sentScrollDelta) { m_sentScroll
Delta = sentScrollDelta; } | 200 void setSentScrollDelta(const gfx::Vector2d& sentScrollDelta) { m_sentScroll
Delta = sentScrollDelta; } |
201 | 201 |
202 // Returns the delta of the scroll that was outside of the bounds of the ini
tial scroll | 202 // Returns the delta of the scroll that was outside of the bounds of the ini
tial scroll |
203 gfx::Vector2dF scrollBy(const gfx::Vector2dF& scroll); | 203 gfx::Vector2dF scrollBy(const gfx::Vector2dF& scroll); |
204 | 204 |
205 bool scrollable() const { return m_scrollable; } | 205 bool scrollable() const { return m_scrollable; } |
206 void setScrollable(bool scrollable) { m_scrollable = scrollable; } | 206 void setScrollable(bool scrollable) { m_scrollable = scrollable; } |
207 | 207 |
(...skipping 13 matching lines...) Expand all Loading... |
221 bool drawCheckerboardForMissingTiles() const; | 221 bool drawCheckerboardForMissingTiles() const; |
222 | 222 |
223 InputHandlerClient::ScrollStatus tryScroll(const gfx::PointF& screenSpacePoi
nt, InputHandlerClient::ScrollInputType) const; | 223 InputHandlerClient::ScrollStatus tryScroll(const gfx::PointF& screenSpacePoi
nt, InputHandlerClient::ScrollInputType) const; |
224 | 224 |
225 const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; } | 225 const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; } |
226 void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleC
ontentRect = visibleContentRect; } | 226 void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleC
ontentRect = visibleContentRect; } |
227 | 227 |
228 bool doubleSided() const { return m_doubleSided; } | 228 bool doubleSided() const { return m_doubleSided; } |
229 void setDoubleSided(bool); | 229 void setDoubleSided(bool); |
230 | 230 |
231 void setTransform(const WebKit::WebTransformationMatrix&); | 231 void setTransform(const gfx::Transform&); |
232 bool transformIsAnimating() const; | 232 bool transformIsAnimating() const; |
233 | 233 |
234 const WebKit::WebTransformationMatrix& drawTransform() const { return m_draw
Transform; } | 234 const gfx::Transform& drawTransform() const { return m_drawTransform; } |
235 void setDrawTransform(const WebKit::WebTransformationMatrix& matrix) { m_dra
wTransform = matrix; } | 235 void setDrawTransform(const gfx::Transform& matrix) { m_drawTransform = matr
ix; } |
236 const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return
m_screenSpaceTransform; } | 236 const gfx::Transform& screenSpaceTransform() const { return m_screenSpaceTra
nsform; } |
237 void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix)
{ m_screenSpaceTransform = matrix; } | 237 void setScreenSpaceTransform(const gfx::Transform& matrix) { m_screenSpaceTr
ansform = matrix; } |
238 | 238 |
239 bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; } | 239 bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; } |
240 void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimatin
g = animating; } | 240 void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimatin
g = animating; } |
241 bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransform
IsAnimating; } | 241 bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransform
IsAnimating; } |
242 void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTrans
formIsAnimating = animating; } | 242 void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTrans
formIsAnimating = animating; } |
243 | 243 |
244 const gfx::Rect& drawableContentRect() const { return m_drawableContentRect;
} | 244 const gfx::Rect& drawableContentRect() const { return m_drawableContentRect;
} |
245 void setDrawableContentRect(const gfx::Rect& rect) { m_drawableContentRect =
rect; } | 245 void setDrawableContentRect(const gfx::Rect& rect) { m_drawableContentRect =
rect; } |
246 const gfx::RectF& updateRect() const { return m_updateRect; } | 246 const gfx::RectF& updateRect() const { return m_updateRect; } |
247 void setUpdateRect(const gfx::RectF& updateRect) { m_updateRect = updateRect
; } | 247 void setUpdateRect(const gfx::RectF& updateRect) { m_updateRect = updateRect
; } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 343 |
344 // Uses layer's content space. | 344 // Uses layer's content space. |
345 gfx::Rect m_visibleContentRect; | 345 gfx::Rect m_visibleContentRect; |
346 bool m_masksToBounds; | 346 bool m_masksToBounds; |
347 bool m_contentsOpaque; | 347 bool m_contentsOpaque; |
348 float m_opacity; | 348 float m_opacity; |
349 gfx::PointF m_position; | 349 gfx::PointF m_position; |
350 bool m_preserves3D; | 350 bool m_preserves3D; |
351 bool m_useParentBackfaceVisibility; | 351 bool m_useParentBackfaceVisibility; |
352 bool m_drawCheckerboardForMissingTiles; | 352 bool m_drawCheckerboardForMissingTiles; |
353 WebKit::WebTransformationMatrix m_sublayerTransform; | 353 gfx::Transform m_sublayerTransform; |
354 WebKit::WebTransformationMatrix m_transform; | 354 gfx::Transform m_transform; |
355 bool m_useLCDText; | 355 bool m_useLCDText; |
356 | 356 |
357 bool m_drawsContent; | 357 bool m_drawsContent; |
358 bool m_forceRenderSurface; | 358 bool m_forceRenderSurface; |
359 | 359 |
360 // Set for the layer that other layers are fixed to. | 360 // Set for the layer that other layers are fixed to. |
361 bool m_isContainerForFixedPositionLayers; | 361 bool m_isContainerForFixedPositionLayers; |
362 // This is true if the layer should be fixed to the closest ancestor contain
er. | 362 // This is true if the layer should be fixed to the closest ancestor contain
er. |
363 bool m_fixedToContainerLayer; | 363 bool m_fixedToContainerLayer; |
364 | 364 |
365 gfx::Vector2dF m_scrollDelta; | 365 gfx::Vector2dF m_scrollDelta; |
366 gfx::Vector2d m_sentScrollDelta; | 366 gfx::Vector2d m_sentScrollDelta; |
367 gfx::Vector2d m_maxScrollOffset; | 367 gfx::Vector2d m_maxScrollOffset; |
368 WebKit::WebTransformationMatrix m_implTransform; | 368 gfx::Transform m_implTransform; |
369 | 369 |
370 // The layer whose coordinate space this layer draws into. This can be | 370 // The layer whose coordinate space this layer draws into. This can be |
371 // either the same layer (m_renderTarget == this) or an ancestor of this | 371 // either the same layer (m_renderTarget == this) or an ancestor of this |
372 // layer. | 372 // layer. |
373 LayerImpl* m_renderTarget; | 373 LayerImpl* m_renderTarget; |
374 | 374 |
375 // The global depth value of the center of the layer. This value is used | 375 // The global depth value of the center of the layer. This value is used |
376 // to sort layers from back to front. | 376 // to sort layers from back to front. |
377 float m_drawDepth; | 377 float m_drawDepth; |
378 float m_drawOpacity; | 378 float m_drawOpacity; |
379 bool m_drawOpacityIsAnimating; | 379 bool m_drawOpacityIsAnimating; |
380 | 380 |
381 // Debug layer name. | 381 // Debug layer name. |
382 std::string m_debugName; | 382 std::string m_debugName; |
383 | 383 |
384 WebKit::WebFilterOperations m_filters; | 384 WebKit::WebFilterOperations m_filters; |
385 WebKit::WebFilterOperations m_backgroundFilters; | 385 WebKit::WebFilterOperations m_backgroundFilters; |
386 SkImageFilter* m_filter; | 386 SkImageFilter* m_filter; |
387 | 387 |
388 WebKit::WebTransformationMatrix m_drawTransform; | 388 gfx::Transform m_drawTransform; |
389 WebKit::WebTransformationMatrix m_screenSpaceTransform; | 389 gfx::Transform m_screenSpaceTransform; |
390 bool m_drawTransformIsAnimating; | 390 bool m_drawTransformIsAnimating; |
391 bool m_screenSpaceTransformIsAnimating; | 391 bool m_screenSpaceTransformIsAnimating; |
392 | 392 |
393 #ifndef NDEBUG | 393 #ifndef NDEBUG |
394 bool m_betweenWillDrawAndDidDraw; | 394 bool m_betweenWillDrawAndDidDraw; |
395 #endif | 395 #endif |
396 | 396 |
397 // Render surface associated with this layer. The layer and its descendants | 397 // Render surface associated with this layer. The layer and its descendants |
398 // will render to this surface. | 398 // will render to this surface. |
399 scoped_ptr<RenderSurfaceImpl> m_renderSurface; | 399 scoped_ptr<RenderSurfaceImpl> m_renderSurface; |
(...skipping 14 matching lines...) Expand all Loading... |
414 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; | 414 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; |
415 | 415 |
416 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 416 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
417 }; | 417 }; |
418 | 418 |
419 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*>
::iterator end, LayerSorter*); | 419 void sortLayers(std::vector<LayerImpl*>::iterator first, std::vector<LayerImpl*>
::iterator end, LayerSorter*); |
420 | 420 |
421 } | 421 } |
422 | 422 |
423 #endif // CC_LAYER_IMPL_H_ | 423 #endif // CC_LAYER_IMPL_H_ |
OLD | NEW |