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

Side by Side Diff: cc/texture_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: 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 #include "cc/texture_draw_quad.h" 5 #include "cc/texture_draw_quad.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
11 TextureDrawQuad::TextureDrawQuad() 11 TextureDrawQuad::TextureDrawQuad()
12 : resource_id(0), 12 : resource_id(0),
13 premultiplied_alpha(false), 13 premultiplied_alpha(false),
14 flipped(false) { 14 flipped(false) {
15 } 15 }
16 16
17 scoped_ptr<TextureDrawQuad> TextureDrawQuad::Create() { 17 scoped_ptr<TextureDrawQuad> TextureDrawQuad::Create() {
18 return make_scoped_ptr(new TextureDrawQuad); 18 return make_scoped_ptr(new TextureDrawQuad);
19 } 19 }
20 20
21 void TextureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, 21 void TextureDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
22 gfx::Rect rect, gfx::Rect opaque_rect, 22 gfx::Rect rect, gfx::Rect opaque_rect,
23 unsigned resource_id, bool premultiplied_alpha, 23 unsigned resource_id, bool premultiplied_alpha,
24 const gfx::RectF& uv_rect, 24 const gfx::RectF& uv_rect,
25 const float vertex_opacity[4], bool flipped) { 25 const float vertex_opacity[4], bool flipped) {
26 gfx::Rect visible_rect = rect; 26 gfx::Rect visible_rect = rect;
27 bool needs_blending = vertex_opacity[0] != 1.0f || vertex_opacity[1] != 1.0f 27 bool needs_blending = vertex_opacity[0] != 1.0f || vertex_opacity[1] != 1.0f
28 || vertex_opacity[2] != 1.0f || vertex_opacity[3] != 1.0f; 28 || vertex_opacity[2] != 1.0f || vertex_opacity[3] != 1.0f;
29 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect, 29 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect,
30 opaque_rect, visible_rect, needs_blending); 30 opaque_rect, visible_rect, needs_blending, AntiAliasing());
31 this->resource_id = resource_id; 31 this->resource_id = resource_id;
32 this->premultiplied_alpha = premultiplied_alpha; 32 this->premultiplied_alpha = premultiplied_alpha;
33 this->uv_rect = uv_rect; 33 this->uv_rect = uv_rect;
34 this->vertex_opacity[0] = vertex_opacity[0]; 34 this->vertex_opacity[0] = vertex_opacity[0];
35 this->vertex_opacity[1] = vertex_opacity[1]; 35 this->vertex_opacity[1] = vertex_opacity[1];
36 this->vertex_opacity[2] = vertex_opacity[2]; 36 this->vertex_opacity[2] = vertex_opacity[2];
37 this->vertex_opacity[3] = vertex_opacity[3]; 37 this->vertex_opacity[3] = vertex_opacity[3];
38 this->flipped = flipped; 38 this->flipped = flipped;
39 } 39 }
40 40
41 void TextureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, 41 void TextureDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
42 gfx::Rect rect, gfx::Rect opaque_rect, 42 gfx::Rect rect, gfx::Rect opaque_rect,
43 gfx::Rect visible_rect, bool needs_blending, 43 gfx::Rect visible_rect, bool needs_blending,
44 unsigned resource_id, bool premultiplied_alpha, 44 unsigned resource_id, bool premultiplied_alpha,
45 const gfx::RectF& uv_rect, 45 const gfx::RectF& uv_rect,
46 const float vertex_opacity[4], bool flipped) { 46 const float vertex_opacity[4], bool flipped) {
47 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect, 47 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect,
48 opaque_rect, visible_rect, needs_blending); 48 opaque_rect, visible_rect, needs_blending, AntiAliasing());
49 this->resource_id = resource_id; 49 this->resource_id = resource_id;
50 this->premultiplied_alpha = premultiplied_alpha; 50 this->premultiplied_alpha = premultiplied_alpha;
51 this->uv_rect = uv_rect; 51 this->uv_rect = uv_rect;
52 this->vertex_opacity[0] = vertex_opacity[0]; 52 this->vertex_opacity[0] = vertex_opacity[0];
53 this->vertex_opacity[1] = vertex_opacity[1]; 53 this->vertex_opacity[1] = vertex_opacity[1];
54 this->vertex_opacity[2] = vertex_opacity[2]; 54 this->vertex_opacity[2] = vertex_opacity[2];
55 this->vertex_opacity[3] = vertex_opacity[3]; 55 this->vertex_opacity[3] = vertex_opacity[3];
56 this->flipped = flipped; 56 this->flipped = flipped;
57 } 57 }
58 58
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 clippedRect -= offset; 124 clippedRect -= offset;
125 clippedRect.Scale(1.0f / x_scale, 1.0f / y_scale); 125 clippedRect.Scale(1.0f / x_scale, 1.0f / y_scale);
126 rect = gfx::Rect(static_cast<int>(clippedRect.x() + 0.5f), 126 rect = gfx::Rect(static_cast<int>(clippedRect.x() + 0.5f),
127 static_cast<int>(clippedRect.y() + 0.5f), 127 static_cast<int>(clippedRect.y() + 0.5f),
128 static_cast<int>(clippedRect.width() + 0.5f), 128 static_cast<int>(clippedRect.width() + 0.5f),
129 static_cast<int>(clippedRect.height() + 0.5f)); 129 static_cast<int>(clippedRect.height() + 0.5f));
130 return true; 130 return true;
131 } 131 }
132 132
133 } // namespace cc 133 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698