Index: cc/render_pass.h |
diff --git a/cc/render_pass.h b/cc/render_pass.h |
index 638cbb270ce9b24689d5095baf174ade4f4d1a13..cdfa958dd27ea0de44b19ec20780d5eb8e97a231 100644 |
--- a/cc/render_pass.h |
+++ b/cc/render_pass.h |
@@ -1,3 +1,140 @@ |
-// Copyright 2012 The Chromium Authors. All rights reserved. |
+// Copyright 2011 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+ |
+#ifndef CCRenderPass_h |
+#define CCRenderPass_h |
+ |
+#include "base/basictypes.h" |
+#include "cc/hash_pair.h" |
+#include "cc/scoped_ptr_hash_map.h" |
+#include "cc/scoped_ptr_vector.h" |
+#include "CCDrawQuad.h" |
+#include "CCSharedQuadState.h" |
+#include "FloatRect.h" |
+#include "SkColor.h" |
+#include <public/WebFilterOperations.h> |
+#include <public/WebTransformationMatrix.h> |
+#include <vector> |
+ |
+namespace cc { |
+ |
+class CCLayerImpl; |
+template<typename LayerType, typename SurfaceType> |
+class CCOcclusionTrackerBase; |
+class CCRenderSurface; |
+ |
+struct CCAppendQuadsData; |
+ |
+typedef CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface> CCOcclusionTrackerImpl; |
+ |
+// A list of CCDrawQuad objects, sorted internally in front-to-back order. |
+class CCQuadList : public ScopedPtrVector<CCDrawQuad> { |
+public: |
+ typedef reverse_iterator backToFrontIterator; |
+ typedef const_reverse_iterator constBackToFrontIterator; |
+ |
+ inline backToFrontIterator backToFrontBegin() { return rbegin(); } |
+ inline backToFrontIterator backToFrontEnd() { return rend(); } |
+ inline constBackToFrontIterator backToFrontBegin() const { return rbegin(); } |
+ inline constBackToFrontIterator backToFrontEnd() const { return rend(); } |
+}; |
+ |
+typedef ScopedPtrVector<CCSharedQuadState> CCSharedQuadStateList; |
+ |
+class CCRenderPass { |
+public: |
+ ~CCRenderPass(); |
+ |
+ struct Id { |
+ int layerId; |
+ int index; |
+ |
+ Id(int layerId, int index) |
+ : layerId(layerId) |
+ , index(index) |
+ { |
+ } |
+ |
+ bool operator==(const Id& other) const { return layerId == other.layerId && index == other.index; } |
+ bool operator!=(const Id& other) const { return !(*this == other); } |
+ bool operator<(const Id& other) const { return layerId < other.layerId || (layerId == other.layerId && index < other.index); } |
+ }; |
+ |
+ static scoped_ptr<CCRenderPass> create(Id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget); |
+ |
+ // A shallow copy of the render pass, which does not include its quads. |
+ scoped_ptr<CCRenderPass> copy(Id newId) const; |
+ |
+ void appendQuadsForLayer(CCLayerImpl*, CCOcclusionTrackerImpl*, CCAppendQuadsData&); |
+ void appendQuadsForRenderSurfaceLayer(CCLayerImpl*, const CCRenderPass* contributingRenderPass, CCOcclusionTrackerImpl*, CCAppendQuadsData&); |
+ void appendQuadsToFillScreen(CCLayerImpl* rootLayer, SkColor screenBackgroundColor, const CCOcclusionTrackerImpl&); |
+ |
+ const CCQuadList& quadList() const { return m_quadList; } |
+ |
+ Id id() const { return m_id; } |
+ |
+ // FIXME: Modify this transform when merging the RenderPass into a parent compositor. |
+ // Transforms from quad's original content space to the root target's content space. |
+ const WebKit::WebTransformationMatrix& transformToRootTarget() const { return m_transformToRootTarget; } |
+ |
+ // This denotes the bounds in physical pixels of the output generated by this RenderPass. |
+ const IntRect& outputRect() const { return m_outputRect; } |
+ |
+ FloatRect damageRect() const { return m_damageRect; } |
+ void setDamageRect(FloatRect rect) { m_damageRect = rect; } |
+ |
+ const WebKit::WebFilterOperations& filters() const { return m_filters; } |
+ void setFilters(const WebKit::WebFilterOperations& filters) { m_filters = filters; } |
+ |
+ const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; } |
+ void setBackgroundFilters(const WebKit::WebFilterOperations& filters) { m_backgroundFilters = filters; } |
+ |
+ bool hasTransparentBackground() const { return m_hasTransparentBackground; } |
+ void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; } |
+ |
+ bool hasOcclusionFromOutsideTargetSurface() const { return m_hasOcclusionFromOutsideTargetSurface; } |
+ void setHasOcclusionFromOutsideTargetSurface(bool hasOcclusionFromOutsideTargetSurface) { m_hasOcclusionFromOutsideTargetSurface = hasOcclusionFromOutsideTargetSurface; } |
+protected: |
+ CCRenderPass(Id, IntRect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget); |
+ |
+ Id m_id; |
+ CCQuadList m_quadList; |
+ CCSharedQuadStateList m_sharedQuadStateList; |
+ WebKit::WebTransformationMatrix m_transformToRootTarget; |
+ IntRect m_outputRect; |
+ FloatRect m_damageRect; |
+ bool m_hasTransparentBackground; |
+ bool m_hasOcclusionFromOutsideTargetSurface; |
+ WebKit::WebFilterOperations m_filters; |
+ WebKit::WebFilterOperations m_backgroundFilters; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(CCRenderPass); |
+}; |
+ |
+} // namespace cc |
+ |
+namespace BASE_HASH_NAMESPACE { |
+#if defined(COMPILER_MSVC) |
+template<> |
+inline size_t hash_value<cc::CCRenderPass::Id>(const cc::CCRenderPass::Id& key) { |
+ return hash_value<std::pair<int, int> >(std::pair<int, int>(key.layerId, key.index)); |
+} |
+#elif defined(COMPILER_GCC) |
+template<> |
+struct hash<cc::CCRenderPass::Id> { |
+ size_t operator()(cc::CCRenderPass::Id key) const { |
+ return hash<std::pair<int, int> >()(std::pair<int, int>(key.layerId, key.index)); |
+ } |
+}; |
+#else |
+#error define a hash function for your compiler |
+#endif // COMPILER |
+} |
+ |
+namespace cc { |
+typedef std::vector<CCRenderPass*> CCRenderPassList; |
+typedef ScopedPtrHashMap<CCRenderPass::Id, CCRenderPass> CCRenderPassIdHashMap; |
+} // namespace cc |
+ |
+#endif |