| 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" |
| 11 #include "FloatRect.h" | 11 #include "FloatRect.h" |
| 12 #include "SkColor.h" | 12 #include "SkColor.h" |
| 13 #include "cc/hash_pair.h" |
| 13 #include "cc/own_ptr_vector.h" | 14 #include "cc/own_ptr_vector.h" |
| 15 #include "cc/scoped_ptr_hash_map.h" |
| 14 #include <public/WebFilterOperations.h> | 16 #include <public/WebFilterOperations.h> |
| 15 #include <public/WebTransformationMatrix.h> | 17 #include <public/WebTransformationMatrix.h> |
| 16 #include <wtf/HashMap.h> | |
| 17 #include <wtf/PassOwnPtr.h> | |
| 18 #include <wtf/Vector.h> | 18 #include <wtf/Vector.h> |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 | 21 |
| 22 class CCLayerImpl; | 22 class CCLayerImpl; |
| 23 class CCRenderSurface; | 23 class CCRenderSurface; |
| 24 | 24 |
| 25 struct CCAppendQuadsData; | 25 struct CCAppendQuadsData; |
| 26 | 26 |
| 27 // A list of CCDrawQuad objects, sorted internally in front-to-back order. | 27 // A list of CCDrawQuad objects, sorted internally in front-to-back order. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 51 : layerId(layerId) | 51 : layerId(layerId) |
| 52 , index(index) | 52 , index(index) |
| 53 { | 53 { |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool operator==(const Id& other) const { return layerId == other.layerId
&& index == other.index; } | 56 bool operator==(const Id& other) const { return layerId == other.layerId
&& index == other.index; } |
| 57 bool operator!=(const Id& other) const { return !(*this == other); } | 57 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); } | 58 bool operator<(const Id& other) const { return layerId < other.layerId |
| (layerId == other.layerId && index < other.index); } |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 static PassOwnPtr<CCRenderPass> create(Id, IntRect outputRect, const WebKit:
:WebTransformationMatrix& transformToRootTarget); | 61 static scoped_ptr<CCRenderPass> create(Id, IntRect outputRect, const WebKit:
:WebTransformationMatrix& transformToRootTarget); |
| 62 | 62 |
| 63 // A shallow copy of the render pass, which does not include its quads. | 63 // A shallow copy of the render pass, which does not include its quads. |
| 64 PassOwnPtr<CCRenderPass> copy(Id newId) const; | 64 scoped_ptr<CCRenderPass> copy(Id newId) const; |
| 65 | 65 |
| 66 void appendQuadsForLayer(CCLayerImpl*, CCOcclusionTrackerImpl*, CCAppendQuad
sData&); | 66 void appendQuadsForLayer(CCLayerImpl*, CCOcclusionTrackerImpl*, CCAppendQuad
sData&); |
| 67 void appendQuadsForRenderSurfaceLayer(CCLayerImpl*, const CCRenderPass* cont
ributingRenderPass, CCOcclusionTrackerImpl*, CCAppendQuadsData&); | 67 void appendQuadsForRenderSurfaceLayer(CCLayerImpl*, const CCRenderPass* cont
ributingRenderPass, CCOcclusionTrackerImpl*, CCAppendQuadsData&); |
| 68 void appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor screenBackgroun
dColor, const CCOcclusionTrackerImpl&); | 68 void appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor screenBackgroun
dColor, const CCOcclusionTrackerImpl&); |
| 69 | 69 |
| 70 const CCQuadList& quadList() const { return m_quadList; } | 70 const CCQuadList& quadList() const { return m_quadList; } |
| 71 | 71 |
| 72 Id id() const { return m_id; } | 72 Id id() const { return m_id; } |
| 73 | 73 |
| 74 // FIXME: Modify this transform when merging the RenderPass into a parent co
mpositor. | 74 // FIXME: Modify this transform when merging the RenderPass into a parent co
mpositor. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 102 IntRect m_outputRect; | 102 IntRect m_outputRect; |
| 103 FloatRect m_damageRect; | 103 FloatRect m_damageRect; |
| 104 bool m_hasTransparentBackground; | 104 bool m_hasTransparentBackground; |
| 105 bool m_hasOcclusionFromOutsideTargetSurface; | 105 bool m_hasOcclusionFromOutsideTargetSurface; |
| 106 WebKit::WebFilterOperations m_filters; | 106 WebKit::WebFilterOperations m_filters; |
| 107 WebKit::WebFilterOperations m_backgroundFilters; | 107 WebKit::WebFilterOperations m_backgroundFilters; |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 } // namespace cc | 110 } // namespace cc |
| 111 | 111 |
| 112 namespace WTF { | 112 namespace BASE_HASH_NAMESPACE { |
| 113 template<> struct HashTraits<cc::CCRenderPass::Id> : GenericHashTraits<cc::CCRen
derPass::Id> { | 113 #if defined(COMPILER_MSVC) |
| 114 static const bool emptyValueIsZero = false; | 114 template<> |
| 115 static const bool needsDestruction = false; | 115 inline size_t hash_value<cc::CCRenderPass::Id>(const cc::CCRenderPass::Id& key)
{ |
| 116 static cc::CCRenderPass::Id emptyValue() { return cc::CCRenderPass::Id(0, 0)
; } | 116 return hash_value<std::pair<int, int>(key.layerId, value.index); |
| 117 static void constructDeletedValue(cc::CCRenderPass::Id& slot) { slot = cc::C
CRenderPass::Id(-1, -1); } | 117 } |
| 118 static bool isDeletedValue(cc::CCRenderPass::Id value) { return value.layerI
d == -1 && value.index == -1; } | 118 #elif defined(COMPILER_GCC) |
| 119 template<> |
| 120 struct hash<cc::CCRenderPass::Id> { |
| 121 size_t operator()(cc::CCRenderPass::Id key) const { |
| 122 return hash<std::pair<int, int> >()(std::pair<int, int>(key.layerId, key
.index)); |
| 123 } |
| 119 }; | 124 }; |
| 120 template<> struct IntHash<cc::CCRenderPass::Id> { | 125 #else |
| 121 static unsigned hash(const cc::CCRenderPass::Id& key) { return PairHash<int,
int>::hash(std::make_pair(key.layerId, key.index)); } | 126 #error define a hash function for your compiler |
| 122 static bool equal(const cc::CCRenderPass::Id& a, const cc::CCRenderPass::Id&
b) { return a == b; } | 127 #endif // COMPILER |
| 123 static const bool safeToCompareToEmptyOrDeleted = true; | 128 } |
| 124 }; | |
| 125 template<> struct DefaultHash<cc::CCRenderPass::Id> { | |
| 126 typedef IntHash<cc::CCRenderPass::Id> Hash; | |
| 127 }; | |
| 128 } // namespace WTF | |
| 129 | 129 |
| 130 namespace cc { | 130 namespace cc { |
| 131 typedef Vector<CCRenderPass*> CCRenderPassList; | 131 typedef Vector<CCRenderPass*> CCRenderPassList; |
| 132 typedef HashMap<CCRenderPass::Id, OwnPtr<CCRenderPass> > CCRenderPassIdHashMap; | 132 typedef ScopedPtrHashMap<CCRenderPass::Id, CCRenderPass> CCRenderPassIdHashMap; |
| 133 } // namespace cc | 133 } // namespace cc |
| 134 | 134 |
| 135 #endif | 135 #endif |
| OLD | NEW |