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

Side by Side Diff: cc/draw_quad.h

Issue 11418047: cc: Turn DrawQuad into a struct-like class with public data members. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no virtual for SetAll() 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/delegated_renderer_layer_impl_unittest.cc ('k') | cc/draw_quad.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 CC_DRAW_QUAD_H_ 5 #ifndef CC_DRAW_QUAD_H_
6 #define CC_DRAW_QUAD_H_ 6 #define CC_DRAW_QUAD_H_
7 7
8 #include "cc/cc_export.h" 8 #include "cc/cc_export.h"
9 #include "cc/shared_quad_state.h" 9 #include "cc/shared_quad_state.h"
10 10
(...skipping 17 matching lines...) Expand all
28 YUV_VIDEO_CONTENT, 28 YUV_VIDEO_CONTENT,
29 STREAM_VIDEO_CONTENT, 29 STREAM_VIDEO_CONTENT,
30 }; 30 };
31 31
32 virtual ~DrawQuad(); 32 virtual ~DrawQuad();
33 33
34 scoped_ptr<DrawQuad> Copy( 34 scoped_ptr<DrawQuad> Copy(
35 const SharedQuadState* copied_shared_quad_state) const; 35 const SharedQuadState* copied_shared_quad_state) const;
36 36
37 // TODO(danakj): Chromify or remove these SharedQuadState helpers. 37 // TODO(danakj): Chromify or remove these SharedQuadState helpers.
38 const WebKit::WebTransformationMatrix& quadTransform() const { return shared_q uad_state_->quadTransform; } 38 const WebKit::WebTransformationMatrix& quadTransform() const { return shared_q uad_state->quadTransform; }
39 gfx::Rect visibleContentRect() const { return shared_quad_state_->visibleConte ntRect; } 39 gfx::Rect visibleContentRect() const { return shared_quad_state->visibleConten tRect; }
40 gfx::Rect clippedRectInTarget() const { return shared_quad_state_->clippedRect InTarget; } 40 gfx::Rect clippedRectInTarget() const { return shared_quad_state->clippedRectI nTarget; }
41 float opacity() const { return shared_quad_state_->opacity; } 41 float opacity() const { return shared_quad_state->opacity; }
42 42
43 Material material() const { return material_; } 43 Material material;
44 44
45 // This rect, after applying the quad_transform(), gives the geometry that 45 // This rect, after applying the quad_transform(), gives the geometry that
46 // this quad should draw to. 46 // this quad should draw to.
47 gfx::Rect rect() const { return rect_; } 47 gfx::Rect rect;
48 48
49 // This specifies the region of the quad that is opaque. 49 // This specifies the region of the quad that is opaque.
50 gfx::Rect opaque_rect() const { return opaque_rect_; } 50 gfx::Rect opaque_rect;
51 51
52 // Allows changing the rect that gets drawn to make it smaller. This value 52 // Allows changing the rect that gets drawn to make it smaller. This value
53 // should be clipped to quadRect. 53 // should be clipped to quadRect.
54 gfx::Rect visible_rect() const { return visible_rect_; } 54 gfx::Rect visible_rect;
55
56 // Allows changing the rect that gets drawn to make it smaller. Parameter
57 // passed in will be clipped to quadRect().
58 void set_visible_rect(gfx::Rect rect) { visible_rect_ = rect; }
59 55
60 // By default blending is used when some part of the quad is not opaque. 56 // By default blending is used when some part of the quad is not opaque.
61 // With this setting, it is possible to force blending on regardless of the 57 // With this setting, it is possible to force blending on regardless of the
62 // opaque area. 58 // opaque area.
63 bool needs_blending() const { return needs_blending_; } 59 bool needs_blending;
64 60
65 // Stores state common to a large bundle of quads; kept separate for memory 61 // Stores state common to a large bundle of quads; kept separate for memory
66 // efficiency. There is special treatment to reconstruct these pointers 62 // efficiency. There is special treatment to reconstruct these pointers
67 // during serialization. 63 // during serialization.
68 const SharedQuadState* shared_quad_state() const { 64 const SharedQuadState* shared_quad_state;
69 return shared_quad_state_;
70 }
71 65
72 // Allows changing the rect that gets drawn to make it smaller. Parameter 66 bool IsDebugQuad() const { return material == DEBUG_BORDER; }
73 // passed in will be clipped to quadRect().
74 void set_shared_quad_state(const SharedQuadState* shared_quad_state) {
75 shared_quad_state_ = shared_quad_state;
76 }
77
78 bool IsDebugQuad() const { return material_ == DEBUG_BORDER; }
79 bool ShouldDrawWithBlending() const { 67 bool ShouldDrawWithBlending() const {
80 return needs_blending_ || opacity() < 1.0f || 68 return needs_blending || shared_quad_state->opacity < 1.0f ||
81 !opaque_rect_.Contains(visible_rect_); 69 !opaque_rect.Contains(visible_rect);
82 } 70 }
83 71
84 protected: 72 protected:
85 DrawQuad(const SharedQuadState* shared_quad_state, 73 DrawQuad();
86 Material material,
87 gfx::Rect rect,
88 gfx::Rect opaque_rect);
89 74
90 // Stores state common to a large bundle of quads; kept separate for memory 75 void SetAll(const SharedQuadState* shared_quad_state,
91 // efficiency. There is special treatment to reconstruct these pointers 76 Material material,
92 // during serialization. 77 gfx::Rect rect,
93 const SharedQuadState* shared_quad_state_; 78 gfx::Rect opaque_rect,
94 79 gfx::Rect visible_rect,
95 Material material_; 80 bool needs_blending);
96 gfx::Rect rect_;
97 gfx::Rect visible_rect_;
98
99 // By default blending is used when some part of the quad is not opaque. With
100 // this setting, it is possible to force blending on regardless of the opaque
101 // area.
102 bool needs_blending_;
103
104 // Be default, this rect is empty. It is used when the shared quad state and a bove
105 // variables determine that the quad is not fully opaque but may be partially opaque.
106 gfx::Rect opaque_rect_;
107 }; 81 };
108 82
109 } 83 }
110 84
111 #endif // CC_DRAW_QUAD_H_ 85 #endif // CC_DRAW_QUAD_H_
OLDNEW
« no previous file with comments | « cc/delegated_renderer_layer_impl_unittest.cc ('k') | cc/draw_quad.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698