Use SCHEME_HTTP for HTTPS proxies on Android.
[chromium-blink-merge.git] / cc / render_surface_impl.h
blob9892c4218d76b36d2033c216c50c88c2002953f9
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
3 // found in the LICENSE file.
5 #ifndef CC_RENDER_SURFACE_IMPL_H_
6 #define CC_RENDER_SURFACE_IMPL_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/cc_export.h"
11 #include "cc/render_pass.h"
12 #include "cc/shared_quad_state.h"
13 #include "ui/gfx/rect.h"
14 #include "ui/gfx/rect_f.h"
15 #include "ui/gfx/transform.h"
17 namespace cc {
19 class DamageTracker;
20 class DelegatedRendererLayerImpl;
21 class QuadSink;
22 class RenderPassSink;
23 class LayerImpl;
25 struct AppendQuadsData;
27 class CC_EXPORT RenderSurfaceImpl {
28 public:
29 explicit RenderSurfaceImpl(LayerImpl*);
30 virtual ~RenderSurfaceImpl();
32 std::string name() const;
33 void dumpSurface(std::string*, int indent) const;
35 gfx::PointF contentRectCenter() const { return gfx::RectF(m_contentRect).CenterPoint(); }
37 // Returns the rect that encloses the RenderSurfaceImpl including any reflection.
38 gfx::RectF drawableContentRect() const;
40 float drawOpacity() const { return m_drawOpacity; }
41 void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
43 void setNearestAncestorThatMovesPixels(RenderSurfaceImpl* surface) { m_nearestAncestorThatMovesPixels = surface; }
44 const RenderSurfaceImpl* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels; }
46 bool drawOpacityIsAnimating() const { return m_drawOpacityIsAnimating; }
47 void setDrawOpacityIsAnimating(bool drawOpacityIsAnimating) { m_drawOpacityIsAnimating = drawOpacityIsAnimating; }
49 void setDrawTransform(const gfx::Transform& drawTransform) { m_drawTransform = drawTransform; }
50 const gfx::Transform& drawTransform() const { return m_drawTransform; }
52 void setScreenSpaceTransform(const gfx::Transform& screenSpaceTransform) { m_screenSpaceTransform = screenSpaceTransform; }
53 const gfx::Transform& screenSpaceTransform() const { return m_screenSpaceTransform; }
55 void setReplicaDrawTransform(const gfx::Transform& replicaDrawTransform) { m_replicaDrawTransform = replicaDrawTransform; }
56 const gfx::Transform& replicaDrawTransform() const { return m_replicaDrawTransform; }
58 void setReplicaScreenSpaceTransform(const gfx::Transform& replicaScreenSpaceTransform) { m_replicaScreenSpaceTransform = replicaScreenSpaceTransform; }
59 const gfx::Transform& replicaScreenSpaceTransform() const { return m_replicaScreenSpaceTransform; }
61 bool targetSurfaceTransformsAreAnimating() const { return m_targetSurfaceTransformsAreAnimating; }
62 void setTargetSurfaceTransformsAreAnimating(bool animating) { m_targetSurfaceTransformsAreAnimating = animating; }
63 bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransformsAreAnimating; }
64 void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTransformsAreAnimating = animating; }
66 void setIsClipped(bool isClipped) { m_isClipped = isClipped; }
67 bool isClipped() const { return m_isClipped; }
69 void setClipRect(const gfx::Rect&);
70 const gfx::Rect& clipRect() const { return m_clipRect; }
72 bool contentsChanged() const;
74 void setContentRect(const gfx::Rect&);
75 const gfx::Rect& contentRect() const { return m_contentRect; }
77 std::vector<LayerImpl*>& layerList() { return m_layerList; }
78 void addContributingDelegatedRenderPassLayer(LayerImpl*);
79 void clearLayerLists();
81 int owningLayerId() const;
83 void resetPropertyChangedFlag() { m_surfacePropertyChanged = false; }
84 bool surfacePropertyChanged() const;
85 bool surfacePropertyChangedOnlyFromDescendant() const;
87 DamageTracker* damageTracker() const { return m_damageTracker.get(); }
89 RenderPass::Id renderPassId();
91 void appendRenderPasses(RenderPassSink&);
92 void appendQuads(QuadSink&, AppendQuadsData&, bool forReplica, RenderPass::Id renderPassId);
94 private:
95 LayerImpl* m_owningLayer;
97 // Uses this surface's space.
98 gfx::Rect m_contentRect;
99 bool m_surfacePropertyChanged;
101 float m_drawOpacity;
102 bool m_drawOpacityIsAnimating;
103 gfx::Transform m_drawTransform;
104 gfx::Transform m_screenSpaceTransform;
105 gfx::Transform m_replicaDrawTransform;
106 gfx::Transform m_replicaScreenSpaceTransform;
107 bool m_targetSurfaceTransformsAreAnimating;
108 bool m_screenSpaceTransformsAreAnimating;
110 bool m_isClipped;
112 // Uses the space of the surface's target surface.
113 gfx::Rect m_clipRect;
115 std::vector<LayerImpl*> m_layerList;
116 std::vector<DelegatedRendererLayerImpl*> m_contributingDelegatedRenderPassLayerList;
118 // The nearest ancestor target surface that will contain the contents of this surface, and that is going
119 // to move pixels within the surface (such as with a blur). This can point to itself.
120 RenderSurfaceImpl* m_nearestAncestorThatMovesPixels;
122 scoped_ptr<DamageTracker> m_damageTracker;
124 // For LayerIteratorActions
125 int m_targetRenderSurfaceLayerIndexHistory;
126 int m_currentLayerIndexHistory;
128 friend struct LayerIteratorActions;
130 DISALLOW_COPY_AND_ASSIGN(RenderSurfaceImpl);
134 #endif // CC_RENDER_SURFACE_IMPL_H_