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

Unified Diff: cc/render_pass.h

Issue 11413106: cc: Make RenderPass into a struct-like class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/quad_culler_unittest.cc ('k') | cc/render_pass.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/render_pass.h
diff --git a/cc/render_pass.h b/cc/render_pass.h
index 97ab8ee977bc9cdd15a836831b60f24957eff146..e14b5e6d97be36eca25ccd83c3cb427f61668fec 100644
--- a/cc/render_pass.h
+++ b/cc/render_pass.h
@@ -22,101 +22,97 @@ class SkImageFilter;
namespace cc {
-class LayerImpl;
-template<typename LayerType, typename SurfaceType>
-class OcclusionTrackerBase;
-class RenderSurfaceImpl;
-
-struct AppendQuadsData;
-
-typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl;
-
// A list of DrawQuad objects, sorted internally in front-to-back order.
class QuadList : public ScopedPtrVector<DrawQuad> {
-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(); }
+ 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<SharedQuadState> SharedQuadStateList;
class CC_EXPORT RenderPass {
-public:
- ~RenderPass();
-
- struct Id {
- int layerId;
- int index;
+ public:
+ struct Id {
+ int layer_id;
+ int index;
- Id(int layerId, int index)
- : layerId(layerId)
- , index(index)
- {
- }
+ Id(int layer_id, int index) : layer_id(layer_id), 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); }
- };
+ bool operator==(const Id& other) const {
+ return layer_id == other.layer_id && index == other.index;
+ }
+ bool operator!=(const Id& other) const {
+ return !(*this == other);
+ }
+ bool operator<(const Id& other) const {
+ return layer_id < other.layer_id ||
+ (layer_id == other.layer_id && index < other.index);
+ }
+ };
- static scoped_ptr<RenderPass> create(Id, gfx::Rect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget);
+ ~RenderPass();
- // A shallow copy of the render pass, which does not include its quads.
- scoped_ptr<RenderPass> copy(Id newId) const;
+ static scoped_ptr<RenderPass> Create();
- void appendQuadsForLayer(LayerImpl*, OcclusionTrackerImpl*, AppendQuadsData&);
- void appendQuadsForRenderSurfaceLayer(LayerImpl*, const RenderPass* contributingRenderPass, OcclusionTrackerImpl*, AppendQuadsData&);
- void appendQuadsToFillScreen(LayerImpl* rootLayer, SkColor screenBackgroundColor, const OcclusionTrackerImpl&);
+ // A shallow copy of the render pass, which does not include its quads.
+ scoped_ptr<RenderPass> Copy(Id newId) const;
- const QuadList& quadList() const { return m_quadList; }
+ void SetNew(Id id,
+ gfx::Rect output_rect,
+ gfx::RectF damage_rect,
+ const WebKit::WebTransformationMatrix& transform_to_root_target);
- Id id() const { return m_id; }
+ void SetAll(Id id,
+ gfx::Rect output_rect,
+ gfx::RectF damage_rect,
+ const WebKit::WebTransformationMatrix& transform_to_root_target,
+ bool has_transparent_background,
+ bool has_occlusion_from_outside_target_surface,
+ const WebKit::WebFilterOperations& filters,
+ SkImageFilter* filter,
+ const WebKit::WebFilterOperations& background_filters);
- // 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; }
+ // Uniquely identifies the render pass in the compositor's current frame.
+ Id id;
- // This denotes the bounds in physical pixels of the output generated by this RenderPass.
- const gfx::Rect& outputRect() const { return m_outputRect; }
+ // These are in the space of the render pass' physical pixels.
+ gfx::Rect output_rect;
+ gfx::RectF damage_rect;
- gfx::RectF damageRect() const { return m_damageRect; }
- void setDamageRect(gfx::RectF rect) { m_damageRect = rect; }
+ // Transforms from the origin of the |output_rect| to the origin of the root
+ // render pass' |output_rect|.
+ WebKit::WebTransformationMatrix transform_to_root_target;
- const WebKit::WebFilterOperations& filters() const { return m_filters; }
- void setFilters(const WebKit::WebFilterOperations& filters) { m_filters = filters; }
+ // If false, the pixels in the render pass' texture are all opaque.
+ bool has_transparent_background;
- const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; }
- void setBackgroundFilters(const WebKit::WebFilterOperations& filters) { m_backgroundFilters = filters; }
+ // If true, then there may be pixels in the render pass' texture that are not
+ // complete, since they are occluded.
+ bool has_occlusion_from_outside_target_surface;
- SkImageFilter* filter() const { return m_filter; }
- void setFilter(SkImageFilter* filter);
+ // Deprecated post-processing filters, applied to the pixels in the render
+ // pass' texture.
+ WebKit::WebFilterOperations filters;
+ // Post-processing filter applied to the pixels in the render pass' texture.
+ SkImageFilter* filter;
- bool hasTransparentBackground() const { return m_hasTransparentBackground; }
- void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; }
+ // Post-processing filters, applied to the pixels showing through the
+ // background of the render pass, from behind it.
+ WebKit::WebFilterOperations background_filters;
- bool hasOcclusionFromOutsideTargetSurface() const { return m_hasOcclusionFromOutsideTargetSurface; }
- void setHasOcclusionFromOutsideTargetSurface(bool hasOcclusionFromOutsideTargetSurface) { m_hasOcclusionFromOutsideTargetSurface = hasOcclusionFromOutsideTargetSurface; }
-protected:
- RenderPass(Id, gfx::Rect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget);
+ QuadList quad_list;
+ SharedQuadStateList shared_quad_state_list;
- Id m_id;
- QuadList m_quadList;
- SharedQuadStateList m_sharedQuadStateList;
- WebKit::WebTransformationMatrix m_transformToRootTarget;
- gfx::Rect m_outputRect;
- gfx::RectF m_damageRect;
- bool m_hasTransparentBackground;
- bool m_hasOcclusionFromOutsideTargetSurface;
- WebKit::WebFilterOperations m_filters;
- WebKit::WebFilterOperations m_backgroundFilters;
- SkImageFilter* m_filter;
+ protected:
+ RenderPass();
- DISALLOW_COPY_AND_ASSIGN(RenderPass);
+ DISALLOW_COPY_AND_ASSIGN(RenderPass);
};
} // namespace cc
@@ -125,14 +121,16 @@ namespace BASE_HASH_NAMESPACE {
#if defined(COMPILER_MSVC)
template<>
inline size_t hash_value<cc::RenderPass::Id>(const cc::RenderPass::Id& key) {
- return hash_value<std::pair<int, int> >(std::pair<int, int>(key.layerId, key.index));
+ return hash_value<std::pair<int, int> >(
+ std::pair<int, int>(key.layer_id, key.index));
}
#elif defined(COMPILER_GCC)
template<>
struct hash<cc::RenderPass::Id> {
- size_t operator()(cc::RenderPass::Id key) const {
- return hash<std::pair<int, int> >()(std::pair<int, int>(key.layerId, key.index));
- }
+ size_t operator()(cc::RenderPass::Id key) const {
+ return hash<std::pair<int, int> >()(
+ std::pair<int, int>(key.layer_id, key.index));
+ }
};
#else
#error define a hash function for your compiler
« no previous file with comments | « cc/quad_culler_unittest.cc ('k') | cc/render_pass.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698