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

Unified Diff: cc/solid_color_draw_quad.cc

Issue 11649005: cc: Support anti-aliasing for solid color layers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: per edge anti-aliasing Created 8 years 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
Index: cc/solid_color_draw_quad.cc
diff --git a/cc/solid_color_draw_quad.cc b/cc/solid_color_draw_quad.cc
index 54a9b75166f1587067c34f79dfe44edee047901a..6cb7a3313e91ee7d8a34c61c76e8e077c9c6bcae 100644
--- a/cc/solid_color_draw_quad.cc
+++ b/cc/solid_color_draw_quad.cc
@@ -8,7 +8,13 @@
namespace cc {
-SolidColorDrawQuad::SolidColorDrawQuad() : color(0) {}
+SolidColorDrawQuad::SolidColorDrawQuad()
+ : color(0),
+ left_edge_aa(false),
+ top_edge_aa(false),
+ right_edge_aa(false),
+ bottom_edge_aa(false) {
+}
scoped_ptr<SolidColorDrawQuad> SolidColorDrawQuad::Create() {
return make_scoped_ptr(new SolidColorDrawQuad);
@@ -16,13 +22,24 @@ scoped_ptr<SolidColorDrawQuad> SolidColorDrawQuad::Create() {
void SolidColorDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
gfx::Rect rect,
- SkColor color) {
+ SkColor color,
+ bool left_edge_aa,
+ bool top_edge_aa,
+ bool right_edge_aa,
+ bool bottom_edge_aa) {
gfx::Rect opaque_rect = SkColorGetA(color) == 255 ? rect : gfx::Rect();
gfx::Rect visible_rect = rect;
bool needs_blending = false;
DrawQuad::SetAll(shared_quad_state, DrawQuad::SOLID_COLOR, rect, opaque_rect,
visible_rect, needs_blending);
this->color = color;
+ this->left_edge_aa = left_edge_aa;
+ this->top_edge_aa = top_edge_aa;
+ this->right_edge_aa = right_edge_aa;
+ this->bottom_edge_aa = bottom_edge_aa;
+
+ // Override needs_blending after initializing the quad.
+ this->needs_blending = IsAntialiased();
}
void SolidColorDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
@@ -30,10 +47,18 @@ void SolidColorDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
gfx::Rect opaque_rect,
gfx::Rect visible_rect,
bool needs_blending,
- SkColor color) {
+ SkColor color,
+ bool left_edge_aa,
+ bool top_edge_aa,
+ bool right_edge_aa,
+ bool bottom_edge_aa) {
DrawQuad::SetAll(shared_quad_state, DrawQuad::SOLID_COLOR, rect, opaque_rect,
visible_rect, needs_blending);
this->color = color;
+ this->left_edge_aa = left_edge_aa;
+ this->top_edge_aa = top_edge_aa;
+ this->right_edge_aa = right_edge_aa;
+ this->bottom_edge_aa = bottom_edge_aa;
}
const SolidColorDrawQuad* SolidColorDrawQuad::MaterialCast(

Powered by Google App Engine
This is Rietveld 408576698