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

Side by Side Diff: cc/draw_quad.h

Issue 11649005: cc: Support anti-aliasing for solid color layers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and add DrawQuad::AntiAliasing struct. Created 7 years, 11 months 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
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 10 matching lines...) Expand all
21 CHECKERBOARD, 21 CHECKERBOARD,
22 DEBUG_BORDER, 22 DEBUG_BORDER,
23 IO_SURFACE_CONTENT, 23 IO_SURFACE_CONTENT,
24 RENDER_PASS, 24 RENDER_PASS,
25 TEXTURE_CONTENT, 25 TEXTURE_CONTENT,
26 SOLID_COLOR, 26 SOLID_COLOR,
27 TILED_CONTENT, 27 TILED_CONTENT,
28 YUV_VIDEO_CONTENT, 28 YUV_VIDEO_CONTENT,
29 STREAM_VIDEO_CONTENT, 29 STREAM_VIDEO_CONTENT,
30 }; 30 };
31 struct AntiAliasing {
danakj 2013/01/08 22:30:46 Should this instead be "Layer Edgeness" or somethi
reveman 2013/01/09 14:20:05 Yea, this is not the full anti-aliasing decision.
32 AntiAliasing() :
33 left_edge(false),
34 top_edge(false),
35 right_edge(false),
36 bottom_edge(false) {}
37 AntiAliasing(bool left_edge,
danakj 2013/01/08 22:34:16 I'm also wondering what is the benefit of this str
reveman 2013/01/09 14:20:05 Maybe. The default constructor is somewhat useful
38 bool top_edge,
39 bool right_edge,
40 bool bottom_edge) :
41 left_edge(left_edge),
42 top_edge(top_edge),
43 right_edge(right_edge),
44 bottom_edge(bottom_edge) {}
45
46 bool left_edge;
47 bool top_edge;
48 bool right_edge;
49 bool bottom_edge;
50 };
31 51
32 virtual ~DrawQuad(); 52 virtual ~DrawQuad();
33 53
34 scoped_ptr<DrawQuad> Copy( 54 scoped_ptr<DrawQuad> Copy(
35 const SharedQuadState* copied_shared_quad_state) const; 55 const SharedQuadState* copied_shared_quad_state) const;
36 56
37 // TODO(danakj): Chromify or remove these SharedQuadState helpers. 57 // TODO(danakj): Chromify or remove these SharedQuadState helpers.
38 const gfx::Transform& quadTransform() const { return shared_quad_state->conten t_to_target_transform; } 58 const gfx::Transform& quadTransform() const { return shared_quad_state->conten t_to_target_transform; }
39 gfx::Rect visibleContentRect() const { return shared_quad_state->visible_conte nt_rect; } 59 gfx::Rect visibleContentRect() const { return shared_quad_state->visible_conte nt_rect; }
40 gfx::Rect clippedRectInTarget() const { return shared_quad_state->clipped_rect _in_target; } 60 gfx::Rect clippedRectInTarget() const { return shared_quad_state->clipped_rect _in_target; }
(...skipping 12 matching lines...) Expand all
53 73
54 // Allows changing the rect that gets drawn to make it smaller. This value 74 // Allows changing the rect that gets drawn to make it smaller. This value
55 // should be clipped to quadRect. 75 // should be clipped to quadRect.
56 gfx::Rect visible_rect; 76 gfx::Rect visible_rect;
57 77
58 // By default blending is used when some part of the quad is not opaque. 78 // By default blending is used when some part of the quad is not opaque.
59 // With this setting, it is possible to force blending on regardless of the 79 // With this setting, it is possible to force blending on regardless of the
60 // opaque area. 80 // opaque area.
61 bool needs_blending; 81 bool needs_blending;
62 82
83 // By default anti-aliasing is not used. With this setting, it is possible
84 // to enable anti-aliasing for specific edges.
85 AntiAliasing anti_aliasing;
86
63 // Stores state common to a large bundle of quads; kept separate for memory 87 // Stores state common to a large bundle of quads; kept separate for memory
64 // efficiency. There is special treatment to reconstruct these pointers 88 // efficiency. There is special treatment to reconstruct these pointers
65 // during serialization. 89 // during serialization.
66 const SharedQuadState* shared_quad_state; 90 const SharedQuadState* shared_quad_state;
67 91
68 bool IsDebugQuad() const { return material == DEBUG_BORDER; } 92 bool IsDebugQuad() const { return material == DEBUG_BORDER; }
69 bool ShouldDrawWithBlending() const { 93 bool ShouldDrawWithBlending() const {
70 return needs_blending || shared_quad_state->opacity < 1.0f || 94 return needs_blending || shared_quad_state->opacity < 1.0f ||
71 !opaque_rect.Contains(visible_rect); 95 !opaque_rect.Contains(visible_rect);
72 } 96 }
97 bool IsAntialiased() const {
98 return
99 anti_aliasing.left_edge ||
100 anti_aliasing.top_edge ||
101 anti_aliasing.right_edge ||
102 anti_aliasing.bottom_edge;
103 }
73 104
74 protected: 105 protected:
75 DrawQuad(); 106 DrawQuad();
76 107
77 void SetAll(const SharedQuadState* shared_quad_state, 108 void SetAll(const SharedQuadState* shared_quad_state,
78 Material material, 109 Material material,
79 gfx::Rect rect, 110 gfx::Rect rect,
80 gfx::Rect opaque_rect, 111 gfx::Rect opaque_rect,
81 gfx::Rect visible_rect, 112 gfx::Rect visible_rect,
82 bool needs_blending); 113 bool needs_blending,
114 AntiAliasing anti_aliasing);
83 }; 115 };
84 116
85 } 117 }
86 118
87 #endif // CC_DRAW_QUAD_H_ 119 #endif // CC_DRAW_QUAD_H_
OLDNEW
« no previous file with comments | « cc/delegated_renderer_layer_impl_unittest.cc ('k') | cc/draw_quad.cc » ('j') | cc/gl_renderer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698