OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 const gfx::Rect& rect, | 31 const gfx::Rect& rect, |
32 const gfx::Rect& opaque_rect, | 32 const gfx::Rect& opaque_rect, |
33 const gfx::Rect& visible_rect, | 33 const gfx::Rect& visible_rect, |
34 unsigned resource_id, | 34 unsigned resource_id, |
35 bool premultiplied_alpha, | 35 bool premultiplied_alpha, |
36 const gfx::PointF& uv_top_left, | 36 const gfx::PointF& uv_top_left, |
37 const gfx::PointF& uv_bottom_right, | 37 const gfx::PointF& uv_bottom_right, |
38 SkColor background_color, | 38 SkColor background_color, |
39 const float vertex_opacity[4], | 39 const float vertex_opacity[4], |
40 bool y_flipped, | 40 bool y_flipped, |
41 bool nearest_neighbor) { | 41 bool nearest_neighbor, |
| 42 bool secure_output_only) { |
42 bool needs_blending = vertex_opacity[0] != 1.0f || vertex_opacity[1] != 1.0f | 43 bool needs_blending = vertex_opacity[0] != 1.0f || vertex_opacity[1] != 1.0f |
43 || vertex_opacity[2] != 1.0f || vertex_opacity[3] != 1.0f; | 44 || vertex_opacity[2] != 1.0f || vertex_opacity[3] != 1.0f; |
44 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect, | 45 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect, |
45 opaque_rect, visible_rect, needs_blending); | 46 opaque_rect, visible_rect, needs_blending); |
46 resources.ids[kResourceIdIndex] = resource_id; | 47 resources.ids[kResourceIdIndex] = resource_id; |
47 resources.count = 1; | 48 resources.count = 1; |
48 this->premultiplied_alpha = premultiplied_alpha; | 49 this->premultiplied_alpha = premultiplied_alpha; |
49 this->uv_top_left = uv_top_left; | 50 this->uv_top_left = uv_top_left; |
50 this->uv_bottom_right = uv_bottom_right; | 51 this->uv_bottom_right = uv_bottom_right; |
51 this->background_color = background_color; | 52 this->background_color = background_color; |
52 this->vertex_opacity[0] = vertex_opacity[0]; | 53 this->vertex_opacity[0] = vertex_opacity[0]; |
53 this->vertex_opacity[1] = vertex_opacity[1]; | 54 this->vertex_opacity[1] = vertex_opacity[1]; |
54 this->vertex_opacity[2] = vertex_opacity[2]; | 55 this->vertex_opacity[2] = vertex_opacity[2]; |
55 this->vertex_opacity[3] = vertex_opacity[3]; | 56 this->vertex_opacity[3] = vertex_opacity[3]; |
56 this->y_flipped = y_flipped; | 57 this->y_flipped = y_flipped; |
57 this->nearest_neighbor = nearest_neighbor; | 58 this->nearest_neighbor = nearest_neighbor; |
| 59 this->secure_output_only = secure_output_only; |
58 } | 60 } |
59 | 61 |
60 void TextureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, | 62 void TextureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, |
61 const gfx::Rect& rect, | 63 const gfx::Rect& rect, |
62 const gfx::Rect& opaque_rect, | 64 const gfx::Rect& opaque_rect, |
63 const gfx::Rect& visible_rect, | 65 const gfx::Rect& visible_rect, |
64 bool needs_blending, | 66 bool needs_blending, |
65 unsigned resource_id, | 67 unsigned resource_id, |
66 gfx::Size resource_size_in_pixels, | 68 gfx::Size resource_size_in_pixels, |
67 bool premultiplied_alpha, | 69 bool premultiplied_alpha, |
68 const gfx::PointF& uv_top_left, | 70 const gfx::PointF& uv_top_left, |
69 const gfx::PointF& uv_bottom_right, | 71 const gfx::PointF& uv_bottom_right, |
70 SkColor background_color, | 72 SkColor background_color, |
71 const float vertex_opacity[4], | 73 const float vertex_opacity[4], |
72 bool y_flipped, | 74 bool y_flipped, |
73 bool nearest_neighbor) { | 75 bool nearest_neighbor, |
| 76 bool secure_output_only) { |
74 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect, | 77 DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect, |
75 opaque_rect, visible_rect, needs_blending); | 78 opaque_rect, visible_rect, needs_blending); |
76 resources.ids[kResourceIdIndex] = resource_id; | 79 resources.ids[kResourceIdIndex] = resource_id; |
77 overlay_resources.size_in_pixels[kResourceIdIndex] = resource_size_in_pixels; | 80 overlay_resources.size_in_pixels[kResourceIdIndex] = resource_size_in_pixels; |
78 resources.count = 1; | 81 resources.count = 1; |
79 this->premultiplied_alpha = premultiplied_alpha; | 82 this->premultiplied_alpha = premultiplied_alpha; |
80 this->uv_top_left = uv_top_left; | 83 this->uv_top_left = uv_top_left; |
81 this->uv_bottom_right = uv_bottom_right; | 84 this->uv_bottom_right = uv_bottom_right; |
82 this->background_color = background_color; | 85 this->background_color = background_color; |
83 this->vertex_opacity[0] = vertex_opacity[0]; | 86 this->vertex_opacity[0] = vertex_opacity[0]; |
84 this->vertex_opacity[1] = vertex_opacity[1]; | 87 this->vertex_opacity[1] = vertex_opacity[1]; |
85 this->vertex_opacity[2] = vertex_opacity[2]; | 88 this->vertex_opacity[2] = vertex_opacity[2]; |
86 this->vertex_opacity[3] = vertex_opacity[3]; | 89 this->vertex_opacity[3] = vertex_opacity[3]; |
87 this->y_flipped = y_flipped; | 90 this->y_flipped = y_flipped; |
88 this->nearest_neighbor = nearest_neighbor; | 91 this->nearest_neighbor = nearest_neighbor; |
| 92 this->secure_output_only = secure_output_only; |
89 } | 93 } |
90 | 94 |
91 const TextureDrawQuad* TextureDrawQuad::MaterialCast(const DrawQuad* quad) { | 95 const TextureDrawQuad* TextureDrawQuad::MaterialCast(const DrawQuad* quad) { |
92 DCHECK(quad->material == DrawQuad::TEXTURE_CONTENT); | 96 DCHECK(quad->material == DrawQuad::TEXTURE_CONTENT); |
93 return static_cast<const TextureDrawQuad*>(quad); | 97 return static_cast<const TextureDrawQuad*>(quad); |
94 } | 98 } |
95 | 99 |
96 void TextureDrawQuad::ExtendValue(base::trace_event::TracedValue* value) const { | 100 void TextureDrawQuad::ExtendValue(base::trace_event::TracedValue* value) const { |
97 value->SetInteger("resource_id", resources.ids[kResourceIdIndex]); | 101 value->SetInteger("resource_id", resources.ids[kResourceIdIndex]); |
98 value->SetBoolean("premultiplied_alpha", premultiplied_alpha); | 102 value->SetBoolean("premultiplied_alpha", premultiplied_alpha); |
99 | 103 |
100 MathUtil::AddToTracedValue("uv_top_left", uv_top_left, value); | 104 MathUtil::AddToTracedValue("uv_top_left", uv_top_left, value); |
101 MathUtil::AddToTracedValue("uv_bottom_right", uv_bottom_right, value); | 105 MathUtil::AddToTracedValue("uv_bottom_right", uv_bottom_right, value); |
102 | 106 |
103 value->SetInteger("background_color", background_color); | 107 value->SetInteger("background_color", background_color); |
104 | 108 |
105 value->BeginArray("vertex_opacity"); | 109 value->BeginArray("vertex_opacity"); |
106 for (size_t i = 0; i < 4; ++i) | 110 for (size_t i = 0; i < 4; ++i) |
107 value->AppendDouble(vertex_opacity[i]); | 111 value->AppendDouble(vertex_opacity[i]); |
108 value->EndArray(); | 112 value->EndArray(); |
109 | 113 |
110 value->SetBoolean("y_flipped", y_flipped); | 114 value->SetBoolean("y_flipped", y_flipped); |
111 value->SetBoolean("nearest_neighbor", nearest_neighbor); | 115 value->SetBoolean("nearest_neighbor", nearest_neighbor); |
112 } | 116 } |
113 | 117 |
114 TextureDrawQuad::OverlayResources::OverlayResources() { | 118 TextureDrawQuad::OverlayResources::OverlayResources() { |
115 } | 119 } |
116 | 120 |
117 } // namespace cc | 121 } // namespace cc |
OLD | NEW |