Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: cc/CCRenderPass.h

Issue 10989028: cc: Remove WebCore dependecies from CCRenderPass and CCDrawQuad classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 CCRenderPass_h 5 #ifndef CCRenderPass_h
6 #define CCRenderPass_h 6 #define CCRenderPass_h
7 7
8 #include "CCDrawQuad.h" 8 #include "CCDrawQuad.h"
9 #include "CCOcclusionTracker.h"
10 #include "CCSharedQuadState.h" 9 #include "CCSharedQuadState.h"
11 #include "FloatRect.h"
12 #include "SkColor.h" 10 #include "SkColor.h"
13 #include "cc/hash_pair.h" 11 #include "cc/hash_pair.h"
14 #include "cc/scoped_ptr_hash_map.h" 12 #include "cc/scoped_ptr_hash_map.h"
15 #include "cc/scoped_ptr_vector.h" 13 #include "cc/scoped_ptr_vector.h"
14 #include <public/WebRect.h>
15 #include <public/WebFloatRect.h>
16 #include <public/WebFilterOperations.h> 16 #include <public/WebFilterOperations.h>
17 #include <public/WebTransformationMatrix.h> 17 #include <public/WebTransformationMatrix.h>
18 #include <wtf/Vector.h> 18 #include <vector>
19 19
20 namespace cc { 20 namespace cc {
21 21
22 class CCLayerImpl; 22 class CCLayerImpl;
23 template<typename LayerType, typename SurfaceType>
24 class CCOcclusionTrackerBase;
23 class CCRenderSurface; 25 class CCRenderSurface;
24 26
25 struct CCAppendQuadsData; 27 struct CCAppendQuadsData;
26 28
29 typedef CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface> CCOcclusionTrackerI mpl;
30
27 // A list of CCDrawQuad objects, sorted internally in front-to-back order. 31 // A list of CCDrawQuad objects, sorted internally in front-to-back order.
28 class CCQuadList : public ScopedPtrVector<CCDrawQuad> { 32 class CCQuadList : public ScopedPtrVector<CCDrawQuad> {
29 public: 33 public:
30 typedef reverse_iterator backToFrontIterator; 34 typedef reverse_iterator backToFrontIterator;
31 typedef const_reverse_iterator constBackToFrontIterator; 35 typedef const_reverse_iterator constBackToFrontIterator;
32 36
33 inline backToFrontIterator backToFrontBegin() { return rbegin(); } 37 inline backToFrontIterator backToFrontBegin() { return rbegin(); }
34 inline backToFrontIterator backToFrontEnd() { return rend(); } 38 inline backToFrontIterator backToFrontEnd() { return rend(); }
35 inline constBackToFrontIterator backToFrontBegin() const { return rbegin(); } 39 inline constBackToFrontIterator backToFrontBegin() const { return rbegin(); }
36 inline constBackToFrontIterator backToFrontEnd() const { return rend(); } 40 inline constBackToFrontIterator backToFrontEnd() const { return rend(); }
37 }; 41 };
38 42
39 typedef ScopedPtrVector<CCSharedQuadState> CCSharedQuadStateList; 43 typedef ScopedPtrVector<CCSharedQuadState> CCSharedQuadStateList;
40 44
41 class CCRenderPass { 45 class CCRenderPass {
42 WTF_MAKE_NONCOPYABLE(CCRenderPass);
43 public: 46 public:
44 ~CCRenderPass(); 47 ~CCRenderPass();
45 48
46 struct Id { 49 struct Id {
47 int layerId; 50 int layerId;
48 int index; 51 int index;
49 52
50 Id(int layerId, int index) 53 Id(int layerId, int index)
51 : layerId(layerId) 54 : layerId(layerId)
52 , index(index) 55 , index(index)
53 { 56 {
54 } 57 }
55 58
56 bool operator==(const Id& other) const { return layerId == other.layerId && index == other.index; } 59 bool operator==(const Id& other) const { return layerId == other.layerId && index == other.index; }
57 bool operator!=(const Id& other) const { return !(*this == other); } 60 bool operator!=(const Id& other) const { return !(*this == other); }
58 bool operator<(const Id& other) const { return layerId < other.layerId | | (layerId == other.layerId && index < other.index); } 61 bool operator<(const Id& other) const { return layerId < other.layerId | | (layerId == other.layerId && index < other.index); }
59 }; 62 };
60 63
61 static scoped_ptr<CCRenderPass> create(Id, IntRect outputRect, const WebKit: :WebTransformationMatrix& transformToRootTarget); 64 static scoped_ptr<CCRenderPass> create(Id, WebKit::WebRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget);
62 65
63 // A shallow copy of the render pass, which does not include its quads. 66 // A shallow copy of the render pass, which does not include its quads.
64 scoped_ptr<CCRenderPass> copy(Id newId) const; 67 scoped_ptr<CCRenderPass> copy(Id newId) const;
65 68
66 void appendQuadsForLayer(CCLayerImpl*, CCOcclusionTrackerImpl*, CCAppendQuad sData&); 69 void appendQuadsForLayer(CCLayerImpl*, CCOcclusionTrackerImpl*, CCAppendQuad sData&);
67 void appendQuadsForRenderSurfaceLayer(CCLayerImpl*, const CCRenderPass* cont ributingRenderPass, CCOcclusionTrackerImpl*, CCAppendQuadsData&); 70 void appendQuadsForRenderSurfaceLayer(CCLayerImpl*, const CCRenderPass* cont ributingRenderPass, CCOcclusionTrackerImpl*, CCAppendQuadsData&);
68 void appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor screenBackgroun dColor, const CCOcclusionTrackerImpl&); 71 void appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor screenBackgroun dColor, const CCOcclusionTrackerImpl&);
69 72
70 const CCQuadList& quadList() const { return m_quadList; } 73 const CCQuadList& quadList() const { return m_quadList; }
71 74
72 Id id() const { return m_id; } 75 Id id() const { return m_id; }
73 76
74 // FIXME: Modify this transform when merging the RenderPass into a parent co mpositor. 77 // FIXME: Modify this transform when merging the RenderPass into a parent co mpositor.
75 // Transforms from quad's original content space to the root target's conten t space. 78 // Transforms from quad's original content space to the root target's conten t space.
76 const WebKit::WebTransformationMatrix& transformToRootTarget() const { retur n m_transformToRootTarget; } 79 const WebKit::WebTransformationMatrix& transformToRootTarget() const { retur n m_transformToRootTarget; }
77 80
78 // This denotes the bounds in physical pixels of the output generated by thi s RenderPass. 81 // This denotes the bounds in physical pixels of the output generated by thi s RenderPass.
79 const IntRect& outputRect() const { return m_outputRect; } 82 const WebKit::WebRect& outputRect() const { return m_outputRect; }
80 83
81 FloatRect damageRect() const { return m_damageRect; } 84 WebKit::WebFloatRect damageRect() const { return m_damageRect; }
82 void setDamageRect(FloatRect rect) { m_damageRect = rect; } 85 void setDamageRect(WebKit::WebFloatRect rect) { m_damageRect = rect; }
83 86
84 const WebKit::WebFilterOperations& filters() const { return m_filters; } 87 const WebKit::WebFilterOperations& filters() const { return m_filters; }
85 void setFilters(const WebKit::WebFilterOperations& filters) { m_filters = fi lters; } 88 void setFilters(const WebKit::WebFilterOperations& filters) { m_filters = fi lters; }
86 89
87 const WebKit::WebFilterOperations& backgroundFilters() const { return m_back groundFilters; } 90 const WebKit::WebFilterOperations& backgroundFilters() const { return m_back groundFilters; }
88 void setBackgroundFilters(const WebKit::WebFilterOperations& filters) { m_ba ckgroundFilters = filters; } 91 void setBackgroundFilters(const WebKit::WebFilterOperations& filters) { m_ba ckgroundFilters = filters; }
89 92
90 bool hasTransparentBackground() const { return m_hasTransparentBackground; } 93 bool hasTransparentBackground() const { return m_hasTransparentBackground; }
91 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro und = transparent; } 94 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro und = transparent; }
92 95
93 bool hasOcclusionFromOutsideTargetSurface() const { return m_hasOcclusionFro mOutsideTargetSurface; } 96 bool hasOcclusionFromOutsideTargetSurface() const { return m_hasOcclusionFro mOutsideTargetSurface; }
94 void setHasOcclusionFromOutsideTargetSurface(bool hasOcclusionFromOutsideTar getSurface) { m_hasOcclusionFromOutsideTargetSurface = hasOcclusionFromOutsideTa rgetSurface; } 97 void setHasOcclusionFromOutsideTargetSurface(bool hasOcclusionFromOutsideTar getSurface) { m_hasOcclusionFromOutsideTargetSurface = hasOcclusionFromOutsideTa rgetSurface; }
95 protected: 98 protected:
96 CCRenderPass(Id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget); 99 CCRenderPass(Id, WebKit::WebRect outputRect, const WebKit::WebTransformation Matrix& transformToRootTarget);
97 100
98 Id m_id; 101 Id m_id;
99 CCQuadList m_quadList; 102 CCQuadList m_quadList;
100 CCSharedQuadStateList m_sharedQuadStateList; 103 CCSharedQuadStateList m_sharedQuadStateList;
101 WebKit::WebTransformationMatrix m_transformToRootTarget; 104 WebKit::WebTransformationMatrix m_transformToRootTarget;
102 IntRect m_outputRect; 105 WebKit::WebRect m_outputRect;
103 FloatRect m_damageRect; 106 WebKit::WebFloatRect m_damageRect;
104 bool m_hasTransparentBackground; 107 bool m_hasTransparentBackground;
105 bool m_hasOcclusionFromOutsideTargetSurface; 108 bool m_hasOcclusionFromOutsideTargetSurface;
106 WebKit::WebFilterOperations m_filters; 109 WebKit::WebFilterOperations m_filters;
107 WebKit::WebFilterOperations m_backgroundFilters; 110 WebKit::WebFilterOperations m_backgroundFilters;
111
112 DISALLOW_COPY_AND_ASSIGN(CCRenderPass);
108 }; 113 };
109 114
110 } // namespace cc 115 } // namespace cc
111 116
112 namespace BASE_HASH_NAMESPACE { 117 namespace BASE_HASH_NAMESPACE {
113 #if defined(COMPILER_MSVC) 118 #if defined(COMPILER_MSVC)
114 template<> 119 template<>
115 inline size_t hash_value<cc::CCRenderPass::Id>(const cc::CCRenderPass::Id& key) { 120 inline size_t hash_value<cc::CCRenderPass::Id>(const cc::CCRenderPass::Id& key) {
116 return hash_value<std::pair<int, int>(key.layerId, value.index); 121 return hash_value<std::pair<int, int>(key.layerId, value.index);
117 } 122 }
118 #elif defined(COMPILER_GCC) 123 #elif defined(COMPILER_GCC)
119 template<> 124 template<>
120 struct hash<cc::CCRenderPass::Id> { 125 struct hash<cc::CCRenderPass::Id> {
121 size_t operator()(cc::CCRenderPass::Id key) const { 126 size_t operator()(cc::CCRenderPass::Id key) const {
122 return hash<std::pair<int, int> >()(std::pair<int, int>(key.layerId, key .index)); 127 return hash<std::pair<int, int> >()(std::pair<int, int>(key.layerId, key .index));
123 } 128 }
124 }; 129 };
125 #else 130 #else
126 #error define a hash function for your compiler 131 #error define a hash function for your compiler
127 #endif // COMPILER 132 #endif // COMPILER
128 } 133 }
129 134
130 namespace cc { 135 namespace cc {
131 typedef Vector<CCRenderPass*> CCRenderPassList; 136 typedef std::vector<CCRenderPass*> CCRenderPassList;
132 typedef ScopedPtrHashMap<CCRenderPass::Id, CCRenderPass> CCRenderPassIdHashMap; 137 typedef ScopedPtrHashMap<CCRenderPass::Id, CCRenderPass> CCRenderPassIdHashMap;
133 } // namespace cc 138 } // namespace cc
134 139
135 #endif 140 #endif
OLDNEW
« no previous file with comments | « cc/CCLayerTreeHostImplTest.cpp ('k') | cc/CCRenderPass.cpp » ('j') | cc/scoped_ptr_hash_map.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698