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

Side by Side Diff: cc/quads/texture_draw_quad.cc

Issue 139233002: [#4] Pass gfx structs by const ref (gfx::PointF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Corrected as per review comments! Created 6 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
« no previous file with comments | « cc/quads/texture_draw_quad.h ('k') | cc/resources/layer_quad.h » ('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 #include "cc/quads/texture_draw_quad.h" 5 #include "cc/quads/texture_draw_quad.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "ui/gfx/vector2d_f.h" 10 #include "ui/gfx/vector2d_f.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 scoped_ptr<TextureDrawQuad> TextureDrawQuad::Create() { 25 scoped_ptr<TextureDrawQuad> TextureDrawQuad::Create() {
26 return make_scoped_ptr(new TextureDrawQuad); 26 return make_scoped_ptr(new TextureDrawQuad);
27 } 27 }
28 28
29 void TextureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, 29 void TextureDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
30 const gfx::Rect& rect, 30 const gfx::Rect& rect,
31 const gfx::Rect& opaque_rect, 31 const gfx::Rect& opaque_rect,
32 unsigned resource_id, bool premultiplied_alpha, 32 unsigned resource_id, bool premultiplied_alpha,
33 gfx::PointF uv_top_left, 33 const gfx::PointF& uv_top_left,
34 gfx::PointF uv_bottom_right, 34 const gfx::PointF& uv_bottom_right,
35 SkColor background_color, 35 SkColor background_color,
36 const float vertex_opacity[4], 36 const float vertex_opacity[4],
37 bool flipped) { 37 bool flipped) {
38 gfx::Rect visible_rect = rect; 38 gfx::Rect visible_rect = rect;
39 bool needs_blending = vertex_opacity[0] != 1.0f || vertex_opacity[1] != 1.0f 39 bool needs_blending = vertex_opacity[0] != 1.0f || vertex_opacity[1] != 1.0f
40 || vertex_opacity[2] != 1.0f || vertex_opacity[3] != 1.0f; 40 || vertex_opacity[2] != 1.0f || vertex_opacity[3] != 1.0f;
41 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect, 41 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect,
42 opaque_rect, visible_rect, needs_blending); 42 opaque_rect, visible_rect, needs_blending);
43 this->resource_id = resource_id; 43 this->resource_id = resource_id;
44 this->premultiplied_alpha = premultiplied_alpha; 44 this->premultiplied_alpha = premultiplied_alpha;
45 this->uv_top_left = uv_top_left; 45 this->uv_top_left = uv_top_left;
46 this->uv_bottom_right = uv_bottom_right; 46 this->uv_bottom_right = uv_bottom_right;
47 this->background_color = background_color; 47 this->background_color = background_color;
48 this->vertex_opacity[0] = vertex_opacity[0]; 48 this->vertex_opacity[0] = vertex_opacity[0];
49 this->vertex_opacity[1] = vertex_opacity[1]; 49 this->vertex_opacity[1] = vertex_opacity[1];
50 this->vertex_opacity[2] = vertex_opacity[2]; 50 this->vertex_opacity[2] = vertex_opacity[2];
51 this->vertex_opacity[3] = vertex_opacity[3]; 51 this->vertex_opacity[3] = vertex_opacity[3];
52 this->flipped = flipped; 52 this->flipped = flipped;
53 } 53 }
54 54
55 void TextureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, 55 void TextureDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
56 const gfx::Rect& rect, 56 const gfx::Rect& rect,
57 const gfx::Rect& opaque_rect, 57 const gfx::Rect& opaque_rect,
58 const gfx::Rect& visible_rect, bool needs_blending, 58 const gfx::Rect& visible_rect, bool needs_blending,
59 unsigned resource_id, bool premultiplied_alpha, 59 unsigned resource_id, bool premultiplied_alpha,
60 gfx::PointF uv_top_left, 60 const gfx::PointF& uv_top_left,
61 gfx::PointF uv_bottom_right, 61 const gfx::PointF& uv_bottom_right,
62 SkColor background_color, 62 SkColor background_color,
63 const float vertex_opacity[4], 63 const float vertex_opacity[4],
64 bool flipped) { 64 bool flipped) {
65 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect, 65 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect,
66 opaque_rect, visible_rect, needs_blending); 66 opaque_rect, visible_rect, needs_blending);
67 this->resource_id = resource_id; 67 this->resource_id = resource_id;
68 this->premultiplied_alpha = premultiplied_alpha; 68 this->premultiplied_alpha = premultiplied_alpha;
69 this->uv_top_left = uv_top_left; 69 this->uv_top_left = uv_top_left;
70 this->uv_bottom_right = uv_bottom_right; 70 this->uv_bottom_right = uv_bottom_right;
71 this->background_color = background_color; 71 this->background_color = background_color;
(...skipping 21 matching lines...) Expand all
93 value->Set("uv_bottom_right", MathUtil::AsValue(uv_bottom_right).release()); 93 value->Set("uv_bottom_right", MathUtil::AsValue(uv_bottom_right).release());
94 value->SetInteger("background_color", background_color); 94 value->SetInteger("background_color", background_color);
95 scoped_ptr<base::ListValue> vertex_opacity_value(new base::ListValue); 95 scoped_ptr<base::ListValue> vertex_opacity_value(new base::ListValue);
96 for (size_t i = 0; i < 4; ++i) 96 for (size_t i = 0; i < 4; ++i)
97 vertex_opacity_value->AppendDouble(vertex_opacity[i]); 97 vertex_opacity_value->AppendDouble(vertex_opacity[i]);
98 value->Set("vertex_opacity", vertex_opacity_value.release()); 98 value->Set("vertex_opacity", vertex_opacity_value.release());
99 value->SetBoolean("flipped", flipped); 99 value->SetBoolean("flipped", flipped);
100 } 100 }
101 101
102 } // namespace cc 102 } // namespace cc
OLDNEW
« no previous file with comments | « cc/quads/texture_draw_quad.h ('k') | cc/resources/layer_quad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698