OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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_H_ | 5 #ifndef CC_LAYER_H_ |
6 #define CC_LAYER_H_ | 6 #define CC_LAYER_H_ |
7 | 7 |
| 8 #include <public/WebFilterOperations.h> |
| 9 #include <string> |
| 10 #include <vector> |
| 11 |
8 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
9 #include "cc/cc_export.h" | 13 #include "cc/cc_export.h" |
10 #include "cc/layer_animation_controller.h" | 14 #include "cc/layer_animation_controller.h" |
11 #include "cc/occlusion_tracker.h" | 15 #include "cc/occlusion_tracker.h" |
12 #include "cc/region.h" | 16 #include "cc/region.h" |
13 #include "cc/render_surface.h" | 17 #include "cc/render_surface.h" |
14 #include "third_party/skia/include/core/SkColor.h" | 18 #include "third_party/skia/include/core/SkColor.h" |
15 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
16 #include "ui/gfx/rect_f.h" | 20 #include "ui/gfx/rect_f.h" |
17 #include <public/WebFilterOperations.h> | 21 #include "ui/gfx/transform.h" |
18 #include <public/WebTransformationMatrix.h> | |
19 #include <string> | |
20 #include <vector> | |
21 | 22 |
22 namespace WebKit { | 23 namespace WebKit { |
23 class WebAnimationDelegate; | 24 class WebAnimationDelegate; |
24 class WebLayerScrollClient; | 25 class WebLayerScrollClient; |
25 } | 26 } |
26 | 27 |
27 class SkImageFilter; | 28 class SkImageFilter; |
28 | 29 |
29 namespace cc { | 30 namespace cc { |
30 | 31 |
(...skipping 13 matching lines...) Expand all Loading... |
44 class CC_EXPORT Layer : public base::RefCounted<Layer>, public LayerAnimationCon
trollerClient { | 45 class CC_EXPORT Layer : public base::RefCounted<Layer>, public LayerAnimationCon
trollerClient { |
45 public: | 46 public: |
46 typedef std::vector<scoped_refptr<Layer> > LayerList; | 47 typedef std::vector<scoped_refptr<Layer> > LayerList; |
47 | 48 |
48 static scoped_refptr<Layer> create(); | 49 static scoped_refptr<Layer> create(); |
49 | 50 |
50 // LayerAnimationControllerClient implementation | 51 // LayerAnimationControllerClient implementation |
51 virtual int id() const OVERRIDE; | 52 virtual int id() const OVERRIDE; |
52 virtual void setOpacityFromAnimation(float) OVERRIDE; | 53 virtual void setOpacityFromAnimation(float) OVERRIDE; |
53 virtual float opacity() const OVERRIDE; | 54 virtual float opacity() const OVERRIDE; |
54 virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix
&) OVERRIDE; | 55 virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE; |
55 // A layer's transform operates layer space. That is, entirely in logical, | 56 // A layer's transform operates layer space. That is, entirely in logical, |
56 // non-page-scaled pixels (that is, they have page zoom baked in, but not pa
ge scale). | 57 // non-page-scaled pixels (that is, they have page zoom baked in, but not pa
ge scale). |
57 // The root layer is a special case -- it operates in physical pixels. | 58 // The root layer is a special case -- it operates in physical pixels. |
58 virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE; | 59 virtual const gfx::Transform& transform() const OVERRIDE; |
59 | 60 |
60 Layer* rootLayer(); | 61 Layer* rootLayer(); |
61 Layer* parent() { return m_parent; } | 62 Layer* parent() { return m_parent; } |
62 const Layer* parent() const { return m_parent; } | 63 const Layer* parent() const { return m_parent; } |
63 void addChild(scoped_refptr<Layer>); | 64 void addChild(scoped_refptr<Layer>); |
64 void insertChild(scoped_refptr<Layer>, size_t index); | 65 void insertChild(scoped_refptr<Layer>, size_t index); |
65 void replaceChild(Layer* reference, scoped_refptr<Layer> newLayer); | 66 void replaceChild(Layer* reference, scoped_refptr<Layer> newLayer); |
66 void removeFromParent(); | 67 void removeFromParent(); |
67 void removeAllChildren(); | 68 void removeAllChildren(); |
68 void setChildren(const LayerList&); | 69 void setChildren(const LayerList&); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 115 |
115 void setPosition(const gfx::PointF&); | 116 void setPosition(const gfx::PointF&); |
116 gfx::PointF position() const { return m_position; } | 117 gfx::PointF position() const { return m_position; } |
117 | 118 |
118 void setIsContainerForFixedPositionLayers(bool); | 119 void setIsContainerForFixedPositionLayers(bool); |
119 bool isContainerForFixedPositionLayers() const { return m_isContainerForFixe
dPositionLayers; } | 120 bool isContainerForFixedPositionLayers() const { return m_isContainerForFixe
dPositionLayers; } |
120 | 121 |
121 void setFixedToContainerLayer(bool); | 122 void setFixedToContainerLayer(bool); |
122 bool fixedToContainerLayer() const { return m_fixedToContainerLayer; } | 123 bool fixedToContainerLayer() const { return m_fixedToContainerLayer; } |
123 | 124 |
124 void setSublayerTransform(const WebKit::WebTransformationMatrix&); | 125 void setSublayerTransform(const gfx::Transform&); |
125 const WebKit::WebTransformationMatrix& sublayerTransform() const { return m_
sublayerTransform; } | 126 const gfx::Transform& sublayerTransform() const { return m_sublayerTransform
; } |
126 | 127 |
127 void setTransform(const WebKit::WebTransformationMatrix&); | 128 void setTransform(const gfx::Transform&); |
128 bool transformIsAnimating() const; | 129 bool transformIsAnimating() const; |
129 | 130 |
130 const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; } | 131 const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; } |
131 void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleC
ontentRect = visibleContentRect; } | 132 void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleC
ontentRect = visibleContentRect; } |
132 | 133 |
133 void setScrollOffset(gfx::Vector2d); | 134 void setScrollOffset(gfx::Vector2d); |
134 gfx::Vector2d scrollOffset() const { return m_scrollOffset; } | 135 gfx::Vector2d scrollOffset() const { return m_scrollOffset; } |
135 | 136 |
136 void setMaxScrollOffset(gfx::Vector2d); | 137 void setMaxScrollOffset(gfx::Vector2d); |
137 gfx::Vector2d maxScrollOffset() const { return m_maxScrollOffset; } | 138 gfx::Vector2d maxScrollOffset() const { return m_maxScrollOffset; } |
(...skipping 18 matching lines...) Expand all Loading... |
156 void setLayerScrollClient(WebKit::WebLayerScrollClient* layerScrollClient) {
m_layerScrollClient = layerScrollClient; } | 157 void setLayerScrollClient(WebKit::WebLayerScrollClient* layerScrollClient) {
m_layerScrollClient = layerScrollClient; } |
157 | 158 |
158 void setDrawCheckerboardForMissingTiles(bool); | 159 void setDrawCheckerboardForMissingTiles(bool); |
159 bool drawCheckerboardForMissingTiles() const { return m_drawCheckerboardForM
issingTiles; } | 160 bool drawCheckerboardForMissingTiles() const { return m_drawCheckerboardForM
issingTiles; } |
160 | 161 |
161 bool forceRenderSurface() const { return m_forceRenderSurface; } | 162 bool forceRenderSurface() const { return m_forceRenderSurface; } |
162 void setForceRenderSurface(bool); | 163 void setForceRenderSurface(bool); |
163 | 164 |
164 gfx::Vector2d scrollDelta() const { return gfx::Vector2d(); } | 165 gfx::Vector2d scrollDelta() const { return gfx::Vector2d(); } |
165 | 166 |
166 void setImplTransform(const WebKit::WebTransformationMatrix&); | 167 void setImplTransform(const gfx::Transform&); |
167 const WebKit::WebTransformationMatrix& implTransform() const { return m_impl
Transform; } | 168 const gfx::Transform& implTransform() const { return m_implTransform; } |
168 | 169 |
169 void setDoubleSided(bool); | 170 void setDoubleSided(bool); |
170 bool doubleSided() const { return m_doubleSided; } | 171 bool doubleSided() const { return m_doubleSided; } |
171 | 172 |
172 void setPreserves3D(bool preserve3D) { m_preserves3D = preserve3D; } | 173 void setPreserves3D(bool preserve3D) { m_preserves3D = preserve3D; } |
173 bool preserves3D() const { return m_preserves3D; } | 174 bool preserves3D() const { return m_preserves3D; } |
174 | 175 |
175 void setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) { m_us
eParentBackfaceVisibility = useParentBackfaceVisibility; } | 176 void setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) { m_us
eParentBackfaceVisibility = useParentBackfaceVisibility; } |
176 bool useParentBackfaceVisibility() const { return m_useParentBackfaceVisibil
ity; } | 177 bool useParentBackfaceVisibility() const { return m_useParentBackfaceVisibil
ity; } |
177 | 178 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 const Layer* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget
->renderSurface()); return m_renderTarget; } | 219 const Layer* renderTarget() const { DCHECK(!m_renderTarget || m_renderTarget
->renderSurface()); return m_renderTarget; } |
219 | 220 |
220 bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; } | 221 bool drawTransformIsAnimating() const { return m_drawTransformIsAnimating; } |
221 void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimatin
g = animating; } | 222 void setDrawTransformIsAnimating(bool animating) { m_drawTransformIsAnimatin
g = animating; } |
222 bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransform
IsAnimating; } | 223 bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransform
IsAnimating; } |
223 void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTrans
formIsAnimating = animating; } | 224 void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTrans
formIsAnimating = animating; } |
224 | 225 |
225 // This moves from layer space, with origin in the center to target space wi
th origin in the top left. | 226 // This moves from layer space, with origin in the center to target space wi
th origin in the top left. |
226 // That is, it converts from logical, non-page-scaled, to target pixels (and
if the target is the | 227 // That is, it converts from logical, non-page-scaled, to target pixels (and
if the target is the |
227 // root render surface, then this converts to physical pixels). | 228 // root render surface, then this converts to physical pixels). |
228 const WebKit::WebTransformationMatrix& drawTransform() const { return m_draw
Transform; } | 229 const gfx::Transform& drawTransform() const { return m_drawTransform; } |
229 void setDrawTransform(const WebKit::WebTransformationMatrix& matrix) { m_dra
wTransform = matrix; } | 230 void setDrawTransform(const gfx::Transform& matrix) { m_drawTransform = matr
ix; } |
230 // This moves from content space, with origin the top left to screen space w
ith origin in the top left. | 231 // This moves from content space, with origin the top left to screen space w
ith origin in the top left. |
231 // It converts logical, non-page-scaled pixels to physical pixels. | 232 // It converts logical, non-page-scaled pixels to physical pixels. |
232 const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return
m_screenSpaceTransform; } | 233 const gfx::Transform& screenSpaceTransform() const { return m_screenSpaceTra
nsform; } |
233 void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix)
{ m_screenSpaceTransform = matrix; } | 234 void setScreenSpaceTransform(const gfx::Transform& matrix) { m_screenSpaceTr
ansform = matrix; } |
234 | 235 |
235 bool isClipped() const { return m_isClipped; } | 236 bool isClipped() const { return m_isClipped; } |
236 void setIsClipped(bool isClipped) { m_isClipped = isClipped; } | 237 void setIsClipped(bool isClipped) { m_isClipped = isClipped; } |
237 | 238 |
238 const gfx::Rect& clipRect() const { return m_clipRect; } | 239 const gfx::Rect& clipRect() const { return m_clipRect; } |
239 void setClipRect(const gfx::Rect& clipRect) { m_clipRect = clipRect; } | 240 void setClipRect(const gfx::Rect& clipRect) { m_clipRect = clipRect; } |
240 | 241 |
241 const gfx::Rect& drawableContentRect() const { return m_drawableContentRect;
} | 242 const gfx::Rect& drawableContentRect() const { return m_drawableContentRect;
} |
242 void setDrawableContentRect(const gfx::Rect& rect) { m_drawableContentRect =
rect; } | 243 void setDrawableContentRect(const gfx::Rect& rect) { m_drawableContentRect =
rect; } |
243 | 244 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 bool m_isDrawable; | 380 bool m_isDrawable; |
380 bool m_masksToBounds; | 381 bool m_masksToBounds; |
381 bool m_contentsOpaque; | 382 bool m_contentsOpaque; |
382 bool m_doubleSided; | 383 bool m_doubleSided; |
383 bool m_useLCDText; | 384 bool m_useLCDText; |
384 bool m_preserves3D; | 385 bool m_preserves3D; |
385 bool m_useParentBackfaceVisibility; | 386 bool m_useParentBackfaceVisibility; |
386 bool m_drawCheckerboardForMissingTiles; | 387 bool m_drawCheckerboardForMissingTiles; |
387 bool m_forceRenderSurface; | 388 bool m_forceRenderSurface; |
388 | 389 |
389 WebKit::WebTransformationMatrix m_transform; | 390 gfx::Transform m_transform; |
390 WebKit::WebTransformationMatrix m_sublayerTransform; | 391 gfx::Transform m_sublayerTransform; |
391 | 392 |
392 // Replica layer used for reflections. | 393 // Replica layer used for reflections. |
393 scoped_refptr<Layer> m_replicaLayer; | 394 scoped_refptr<Layer> m_replicaLayer; |
394 | 395 |
395 // Transient properties. | 396 // Transient properties. |
396 scoped_ptr<RenderSurface> m_renderSurface; | 397 scoped_ptr<RenderSurface> m_renderSurface; |
397 float m_drawOpacity; | 398 float m_drawOpacity; |
398 bool m_drawOpacityIsAnimating; | 399 bool m_drawOpacityIsAnimating; |
399 | 400 |
400 Layer* m_renderTarget; | 401 Layer* m_renderTarget; |
401 | 402 |
402 WebKit::WebTransformationMatrix m_drawTransform; | 403 gfx::Transform m_drawTransform; |
403 WebKit::WebTransformationMatrix m_screenSpaceTransform; | 404 gfx::Transform m_screenSpaceTransform; |
404 bool m_drawTransformIsAnimating; | 405 bool m_drawTransformIsAnimating; |
405 bool m_screenSpaceTransformIsAnimating; | 406 bool m_screenSpaceTransformIsAnimating; |
406 | 407 |
407 // Uses target surface space. | 408 // Uses target surface space. |
408 gfx::Rect m_drawableContentRect; | 409 gfx::Rect m_drawableContentRect; |
409 gfx::Rect m_clipRect; | 410 gfx::Rect m_clipRect; |
410 | 411 |
411 // True if the layer is clipped by m_clipRect | 412 // True if the layer is clipped by m_clipRect |
412 bool m_isClipped; | 413 bool m_isClipped; |
413 | 414 |
414 float m_rasterScale; | 415 float m_rasterScale; |
415 bool m_automaticallyComputeRasterScale; | 416 bool m_automaticallyComputeRasterScale; |
416 bool m_boundsContainPageScale; | 417 bool m_boundsContainPageScale; |
417 | 418 |
418 WebKit::WebTransformationMatrix m_implTransform; | 419 gfx::Transform m_implTransform; |
419 | 420 |
420 WebKit::WebAnimationDelegate* m_layerAnimationDelegate; | 421 WebKit::WebAnimationDelegate* m_layerAnimationDelegate; |
421 WebKit::WebLayerScrollClient* m_layerScrollClient; | 422 WebKit::WebLayerScrollClient* m_layerScrollClient; |
422 }; | 423 }; |
423 | 424 |
424 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*); | 425 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*); |
425 | 426 |
426 } // namespace cc | 427 } // namespace cc |
427 | 428 |
428 #endif // CC_LAYER_H_ | 429 #endif // CC_LAYER_H_ |
OLD | NEW |