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

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

Issue 1142343008: cc: Rework overlays to not use the ResourceProvider and pass texture size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix more tests Created 5 years, 6 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/resource_provider.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/trace_event/trace_event_argument.h" 8 #include "base/trace_event/trace_event_argument.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 27 matching lines...) Expand all
38 bool needs_blending = vertex_opacity[0] != 1.0f || vertex_opacity[1] != 1.0f 38 bool needs_blending = vertex_opacity[0] != 1.0f || vertex_opacity[1] != 1.0f
39 || vertex_opacity[2] != 1.0f || vertex_opacity[3] != 1.0f; 39 || vertex_opacity[2] != 1.0f || vertex_opacity[3] != 1.0f;
40 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect, 40 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect,
41 opaque_rect, visible_rect, needs_blending); 41 opaque_rect, visible_rect, needs_blending);
42 resources.ids[kResourceIdIndex] = resource_id; 42 resources.ids[kResourceIdIndex] = resource_id;
43 resources.count = 1; 43 resources.count = 1;
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];
Nico 2015/07/29 19:35:51 Does SetNew() intentionally not write overlay_reso
danakj 2015/07/29 20:05:31 Ya they take default values. SetNew is like "most
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->y_flipped = y_flipped; 52 this->y_flipped = y_flipped;
53 this->nearest_neighbor = nearest_neighbor; 53 this->nearest_neighbor = nearest_neighbor;
54 } 54 }
55 55
56 void TextureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, 56 void TextureDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
57 const gfx::Rect& rect, 57 const gfx::Rect& rect,
58 const gfx::Rect& opaque_rect, 58 const gfx::Rect& opaque_rect,
59 const gfx::Rect& visible_rect, 59 const gfx::Rect& visible_rect,
60 bool needs_blending, 60 bool needs_blending,
61 unsigned resource_id, 61 unsigned resource_id,
62 gfx::Size resource_size_in_pixels,
63 bool allow_overlay,
62 bool premultiplied_alpha, 64 bool premultiplied_alpha,
63 const gfx::PointF& uv_top_left, 65 const gfx::PointF& uv_top_left,
64 const gfx::PointF& uv_bottom_right, 66 const gfx::PointF& uv_bottom_right,
65 SkColor background_color, 67 SkColor background_color,
66 const float vertex_opacity[4], 68 const float vertex_opacity[4],
67 bool y_flipped, 69 bool y_flipped,
68 bool nearest_neighbor) { 70 bool nearest_neighbor) {
69 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect, 71 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect,
70 opaque_rect, visible_rect, needs_blending); 72 opaque_rect, visible_rect, needs_blending);
71 resources.ids[kResourceIdIndex] = resource_id; 73 resources.ids[kResourceIdIndex] = resource_id;
74 overlay_resources.size_in_pixels[kResourceIdIndex] = resource_size_in_pixels;
75 overlay_resources.allow_overlay[kResourceIdIndex] = allow_overlay;
72 resources.count = 1; 76 resources.count = 1;
73 this->premultiplied_alpha = premultiplied_alpha; 77 this->premultiplied_alpha = premultiplied_alpha;
74 this->uv_top_left = uv_top_left; 78 this->uv_top_left = uv_top_left;
75 this->uv_bottom_right = uv_bottom_right; 79 this->uv_bottom_right = uv_bottom_right;
76 this->background_color = background_color; 80 this->background_color = background_color;
77 this->vertex_opacity[0] = vertex_opacity[0]; 81 this->vertex_opacity[0] = vertex_opacity[0];
78 this->vertex_opacity[1] = vertex_opacity[1]; 82 this->vertex_opacity[1] = vertex_opacity[1];
79 this->vertex_opacity[2] = vertex_opacity[2]; 83 this->vertex_opacity[2] = vertex_opacity[2];
80 this->vertex_opacity[3] = vertex_opacity[3]; 84 this->vertex_opacity[3] = vertex_opacity[3];
81 this->y_flipped = y_flipped; 85 this->y_flipped = y_flipped;
(...skipping 16 matching lines...) Expand all
98 102
99 value->BeginArray("vertex_opacity"); 103 value->BeginArray("vertex_opacity");
100 for (size_t i = 0; i < 4; ++i) 104 for (size_t i = 0; i < 4; ++i)
101 value->AppendDouble(vertex_opacity[i]); 105 value->AppendDouble(vertex_opacity[i]);
102 value->EndArray(); 106 value->EndArray();
103 107
104 value->SetBoolean("y_flipped", y_flipped); 108 value->SetBoolean("y_flipped", y_flipped);
105 value->SetBoolean("nearest_neighbor", nearest_neighbor); 109 value->SetBoolean("nearest_neighbor", nearest_neighbor);
106 } 110 }
107 111
112 TextureDrawQuad::OverlayResources::OverlayResources() {
113 for (size_t i = 0; i < Resources::kMaxResourceIdCount; ++i)
114 allow_overlay[i] = false;
115 }
116
108 } // namespace cc 117 } // namespace cc
OLDNEW
« no previous file with comments | « cc/quads/texture_draw_quad.h ('k') | cc/resources/resource_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698