| 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 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" | 9 #include "CCOcclusionTracker.h" |
| 10 #include "CCSharedQuadState.h" | 10 #include "CCSharedQuadState.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 inline backToFrontIterator backToFrontEnd() { return rend(); } | 32 inline backToFrontIterator backToFrontEnd() { return rend(); } |
| 33 inline constBackToFrontIterator backToFrontBegin() const { return rbegin();
} | 33 inline constBackToFrontIterator backToFrontBegin() const { return rbegin();
} |
| 34 inline constBackToFrontIterator backToFrontEnd() const { return rend(); } | 34 inline constBackToFrontIterator backToFrontEnd() const { return rend(); } |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 typedef Vector<OwnPtr<CCSharedQuadState> > CCSharedQuadStateList; | 37 typedef Vector<OwnPtr<CCSharedQuadState> > CCSharedQuadStateList; |
| 38 | 38 |
| 39 class CCRenderPass { | 39 class CCRenderPass { |
| 40 WTF_MAKE_NONCOPYABLE(CCRenderPass); | 40 WTF_MAKE_NONCOPYABLE(CCRenderPass); |
| 41 public: | 41 public: |
| 42 static PassOwnPtr<CCRenderPass> create(int id, IntRect outputRect, const Web
Kit::WebTransformationMatrix& transformToRootTarget); | 42 struct Id { |
| 43 int layerId; |
| 44 int index; |
| 45 |
| 46 Id(int layerId, int index) |
| 47 : layerId(layerId) |
| 48 , index(index) |
| 49 { |
| 50 } |
| 51 |
| 52 bool operator==(const Id& other) const { return layerId == other.layerId
&& index == other.index; } |
| 53 bool operator!=(const Id& other) const { return !(*this == other); } |
| 54 bool operator<(const Id& other) const { return layerId < other.layerId |
| (layerId == other.layerId && index < other.index); } |
| 55 }; |
| 56 |
| 57 static PassOwnPtr<CCRenderPass> create(Id, IntRect outputRect, const WebKit:
:WebTransformationMatrix& transformToRootTarget); |
| 58 |
| 59 // A shallow copy of the render pass, which does not include its quads. |
| 60 PassOwnPtr<CCRenderPass> copy(Id newId) const; |
| 43 | 61 |
| 44 void appendQuadsForLayer(CCLayerImpl*, CCOcclusionTrackerImpl*, CCAppendQuad
sData&); | 62 void appendQuadsForLayer(CCLayerImpl*, CCOcclusionTrackerImpl*, CCAppendQuad
sData&); |
| 45 void appendQuadsForRenderSurfaceLayer(CCLayerImpl*, const CCRenderPass* cont
ributingRenderPass, CCOcclusionTrackerImpl*, CCAppendQuadsData&); | 63 void appendQuadsForRenderSurfaceLayer(CCLayerImpl*, const CCRenderPass* cont
ributingRenderPass, CCOcclusionTrackerImpl*, CCAppendQuadsData&); |
| 46 void appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor screenBackgroun
dColor, const CCOcclusionTrackerImpl&); | 64 void appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor screenBackgroun
dColor, const CCOcclusionTrackerImpl&); |
| 47 | 65 |
| 48 const CCQuadList& quadList() const { return m_quadList; } | 66 const CCQuadList& quadList() const { return m_quadList; } |
| 49 | 67 |
| 50 int id() const { return m_id; } | 68 Id id() const { return m_id; } |
| 51 | 69 |
| 52 // FIXME: Modify this transform when merging the RenderPass into a parent co
mpositor. | 70 // FIXME: Modify this transform when merging the RenderPass into a parent co
mpositor. |
| 53 // Transforms from quad's original content space to the root target's conten
t space. | 71 // Transforms from quad's original content space to the root target's conten
t space. |
| 54 const WebKit::WebTransformationMatrix& transformToRootTarget() const { retur
n m_transformToRootTarget; } | 72 const WebKit::WebTransformationMatrix& transformToRootTarget() const { retur
n m_transformToRootTarget; } |
| 55 | 73 |
| 56 // This denotes the bounds in physical pixels of the output generated by thi
s RenderPass. | 74 // This denotes the bounds in physical pixels of the output generated by thi
s RenderPass. |
| 57 const IntRect& outputRect() const { return m_outputRect; } | 75 const IntRect& outputRect() const { return m_outputRect; } |
| 58 | 76 |
| 59 FloatRect damageRect() const { return m_damageRect; } | 77 FloatRect damageRect() const { return m_damageRect; } |
| 60 void setDamageRect(FloatRect rect) { m_damageRect = rect; } | 78 void setDamageRect(FloatRect rect) { m_damageRect = rect; } |
| 61 | 79 |
| 62 const WebKit::WebFilterOperations& filters() const { return m_filters; } | 80 const WebKit::WebFilterOperations& filters() const { return m_filters; } |
| 63 void setFilters(const WebKit::WebFilterOperations& filters) { m_filters = fi
lters; } | 81 void setFilters(const WebKit::WebFilterOperations& filters) { m_filters = fi
lters; } |
| 64 | 82 |
| 65 const WebKit::WebFilterOperations& backgroundFilters() const { return m_back
groundFilters; } | 83 const WebKit::WebFilterOperations& backgroundFilters() const { return m_back
groundFilters; } |
| 66 void setBackgroundFilters(const WebKit::WebFilterOperations& filters) { m_ba
ckgroundFilters = filters; } | 84 void setBackgroundFilters(const WebKit::WebFilterOperations& filters) { m_ba
ckgroundFilters = filters; } |
| 67 | 85 |
| 68 bool hasTransparentBackground() const { return m_hasTransparentBackground; } | 86 bool hasTransparentBackground() const { return m_hasTransparentBackground; } |
| 69 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } | 87 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } |
| 70 | 88 |
| 71 bool hasOcclusionFromOutsideTargetSurface() const { return m_hasOcclusionFro
mOutsideTargetSurface; } | 89 bool hasOcclusionFromOutsideTargetSurface() const { return m_hasOcclusionFro
mOutsideTargetSurface; } |
| 72 void setHasOcclusionFromOutsideTargetSurface(bool hasOcclusionFromOutsideTar
getSurface) { m_hasOcclusionFromOutsideTargetSurface = hasOcclusionFromOutsideTa
rgetSurface; } | 90 void setHasOcclusionFromOutsideTargetSurface(bool hasOcclusionFromOutsideTar
getSurface) { m_hasOcclusionFromOutsideTargetSurface = hasOcclusionFromOutsideTa
rgetSurface; } |
| 73 protected: | 91 protected: |
| 74 CCRenderPass(int id, IntRect outputRect, const WebKit::WebTransformationMatr
ix& transformToRootTarget); | 92 CCRenderPass(Id, IntRect outputRect, const WebKit::WebTransformationMatrix&
transformToRootTarget); |
| 75 | 93 |
| 76 int m_id; | 94 Id m_id; |
| 77 CCQuadList m_quadList; | 95 CCQuadList m_quadList; |
| 78 CCSharedQuadStateList m_sharedQuadStateList; | 96 CCSharedQuadStateList m_sharedQuadStateList; |
| 79 WebKit::WebTransformationMatrix m_transformToRootTarget; | 97 WebKit::WebTransformationMatrix m_transformToRootTarget; |
| 80 IntRect m_outputRect; | 98 IntRect m_outputRect; |
| 81 FloatRect m_damageRect; | 99 FloatRect m_damageRect; |
| 82 bool m_hasTransparentBackground; | 100 bool m_hasTransparentBackground; |
| 83 bool m_hasOcclusionFromOutsideTargetSurface; | 101 bool m_hasOcclusionFromOutsideTargetSurface; |
| 84 WebKit::WebFilterOperations m_filters; | 102 WebKit::WebFilterOperations m_filters; |
| 85 WebKit::WebFilterOperations m_backgroundFilters; | 103 WebKit::WebFilterOperations m_backgroundFilters; |
| 86 }; | 104 }; |
| 87 | 105 |
| 106 } // namespace WebCore |
| 107 |
| 108 namespace WTF { |
| 109 template<> struct HashTraits<WebCore::CCRenderPass::Id> : GenericHashTraits<WebC
ore::CCRenderPass::Id> { |
| 110 static const bool emptyValueIsZero = false; |
| 111 static const bool needsDestruction = false; |
| 112 static WebCore::CCRenderPass::Id emptyValue() { return WebCore::CCRenderPass
::Id(0, 0); } |
| 113 static void constructDeletedValue(WebCore::CCRenderPass::Id& slot) { slot =
WebCore::CCRenderPass::Id(-1, -1); } |
| 114 static bool isDeletedValue(WebCore::CCRenderPass::Id value) { return value.l
ayerId == -1 && value.index == -1; } |
| 115 }; |
| 116 template<> struct IntHash<WebCore::CCRenderPass::Id> { |
| 117 static unsigned hash(const WebCore::CCRenderPass::Id& key) { return PairHash
<int, int>::hash(std::make_pair(key.layerId, key.index)); } |
| 118 static bool equal(const WebCore::CCRenderPass::Id& a, const WebCore::CCRende
rPass::Id& b) { return a == b; } |
| 119 static const bool safeToCompareToEmptyOrDeleted = true; |
| 120 }; |
| 121 template<> struct DefaultHash<WebCore::CCRenderPass::Id> { |
| 122 typedef IntHash<WebCore::CCRenderPass::Id> Hash; |
| 123 }; |
| 124 } // namespace WTF |
| 125 |
| 126 namespace WebCore { |
| 88 typedef Vector<CCRenderPass*> CCRenderPassList; | 127 typedef Vector<CCRenderPass*> CCRenderPassList; |
| 89 typedef HashMap<int, OwnPtr<CCRenderPass> > CCRenderPassIdHashMap; | 128 typedef HashMap<CCRenderPass::Id, OwnPtr<CCRenderPass> > CCRenderPassIdHashMap; |
| 90 | 129 } // namespace WebCore |
| 91 } | |
| 92 | 130 |
| 93 #endif | 131 #endif |
| OLD | NEW |