| 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/render_pass.h" | 5 #include "cc/quads/render_pass.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 FilterOperations filters; | 76 FilterOperations filters; |
| 77 filters.Append(FilterOperation::CreateOpacityFilter(0.5)); | 77 filters.Append(FilterOperation::CreateOpacityFilter(0.5)); |
| 78 FilterOperations background_filters; | 78 FilterOperations background_filters; |
| 79 background_filters.Append(FilterOperation::CreateInvertFilter(1.0)); | 79 background_filters.Append(FilterOperation::CreateInvertFilter(1.0)); |
| 80 gfx::ColorSpace color_space = gfx::ColorSpace::CreateSRGB(); | 80 gfx::ColorSpace color_space = gfx::ColorSpace::CreateSRGB(); |
| 81 bool has_transparent_background = true; | 81 bool has_transparent_background = true; |
| 82 | 82 |
| 83 std::unique_ptr<RenderPass> pass = RenderPass::Create(); | 83 std::unique_ptr<RenderPass> pass = RenderPass::Create(); |
| 84 pass->SetAll(render_pass_id, output_rect, damage_rect, transform_to_root, | 84 pass->SetAll(render_pass_id, output_rect, damage_rect, transform_to_root, |
| 85 filters, background_filters, color_space, | 85 filters, background_filters, color_space, |
| 86 has_transparent_background); | 86 has_transparent_background, false, false); |
| 87 pass->copy_requests.push_back(CopyOutputRequest::CreateEmptyRequest()); | 87 pass->copy_requests.push_back(CopyOutputRequest::CreateEmptyRequest()); |
| 88 | 88 |
| 89 // Stick a quad in the pass, this should not get copied. | 89 // Stick a quad in the pass, this should not get copied. |
| 90 SharedQuadState* shared_state = pass->CreateAndAppendSharedQuadState(); | 90 SharedQuadState* shared_state = pass->CreateAndAppendSharedQuadState(); |
| 91 shared_state->SetAll(gfx::Transform(), gfx::Rect(), gfx::Rect(), gfx::Rect(), | 91 shared_state->SetAll(gfx::Transform(), gfx::Rect(), gfx::Rect(), gfx::Rect(), |
| 92 false, 1, SkBlendMode::kSrcOver, 0); | 92 false, 1, SkBlendMode::kSrcOver, 0); |
| 93 | 93 |
| 94 SolidColorDrawQuad* color_quad = | 94 SolidColorDrawQuad* color_quad = |
| 95 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 95 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 96 color_quad->SetNew(pass->shared_quad_state_list.back(), gfx::Rect(), | 96 color_quad->SetNew(pass->shared_quad_state_list.back(), gfx::Rect(), |
| (...skipping 28 matching lines...) Expand all Loading... |
| 125 gfx::Rect damage_rect(56, 123, 19, 43); | 125 gfx::Rect damage_rect(56, 123, 19, 43); |
| 126 FilterOperations filters; | 126 FilterOperations filters; |
| 127 filters.Append(FilterOperation::CreateOpacityFilter(0.5)); | 127 filters.Append(FilterOperation::CreateOpacityFilter(0.5)); |
| 128 FilterOperations background_filters; | 128 FilterOperations background_filters; |
| 129 background_filters.Append(FilterOperation::CreateInvertFilter(1.0)); | 129 background_filters.Append(FilterOperation::CreateInvertFilter(1.0)); |
| 130 gfx::ColorSpace color_space = gfx::ColorSpace::CreateXYZD50(); | 130 gfx::ColorSpace color_space = gfx::ColorSpace::CreateXYZD50(); |
| 131 bool has_transparent_background = true; | 131 bool has_transparent_background = true; |
| 132 | 132 |
| 133 std::unique_ptr<RenderPass> pass = RenderPass::Create(); | 133 std::unique_ptr<RenderPass> pass = RenderPass::Create(); |
| 134 pass->SetAll(id, output_rect, damage_rect, transform_to_root, filters, | 134 pass->SetAll(id, output_rect, damage_rect, transform_to_root, filters, |
| 135 background_filters, color_space, has_transparent_background); | 135 background_filters, color_space, has_transparent_background, |
| 136 false, false); |
| 136 | 137 |
| 137 // Two quads using one shared state. | 138 // Two quads using one shared state. |
| 138 SharedQuadState* shared_state1 = pass->CreateAndAppendSharedQuadState(); | 139 SharedQuadState* shared_state1 = pass->CreateAndAppendSharedQuadState(); |
| 139 shared_state1->SetAll(gfx::Transform(), gfx::Rect(0, 0, 1, 1), gfx::Rect(), | 140 shared_state1->SetAll(gfx::Transform(), gfx::Rect(0, 0, 1, 1), gfx::Rect(), |
| 140 gfx::Rect(), false, 1, SkBlendMode::kSrcOver, 0); | 141 gfx::Rect(), false, 1, SkBlendMode::kSrcOver, 0); |
| 141 | 142 |
| 142 SolidColorDrawQuad* color_quad1 = | 143 SolidColorDrawQuad* color_quad1 = |
| 143 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 144 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 144 color_quad1->SetNew(pass->shared_quad_state_list.back(), | 145 color_quad1->SetNew(pass->shared_quad_state_list.back(), |
| 145 gfx::Rect(1, 1, 1, 1), gfx::Rect(1, 1, 1, 1), SkColor(), | 146 gfx::Rect(1, 1, 1, 1), gfx::Rect(1, 1, 1, 1), SkColor(), |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 contrib_filters.Append(FilterOperation::CreateSepiaFilter(0.5)); | 179 contrib_filters.Append(FilterOperation::CreateSepiaFilter(0.5)); |
| 179 FilterOperations contrib_background_filters; | 180 FilterOperations contrib_background_filters; |
| 180 contrib_background_filters.Append(FilterOperation::CreateSaturateFilter(1)); | 181 contrib_background_filters.Append(FilterOperation::CreateSaturateFilter(1)); |
| 181 gfx::ColorSpace contrib_color_space = gfx::ColorSpace::CreateSCRGBLinear(); | 182 gfx::ColorSpace contrib_color_space = gfx::ColorSpace::CreateSCRGBLinear(); |
| 182 bool contrib_has_transparent_background = true; | 183 bool contrib_has_transparent_background = true; |
| 183 | 184 |
| 184 std::unique_ptr<RenderPass> contrib = RenderPass::Create(); | 185 std::unique_ptr<RenderPass> contrib = RenderPass::Create(); |
| 185 contrib->SetAll(contrib_id, contrib_output_rect, contrib_damage_rect, | 186 contrib->SetAll(contrib_id, contrib_output_rect, contrib_damage_rect, |
| 186 contrib_transform_to_root, contrib_filters, | 187 contrib_transform_to_root, contrib_filters, |
| 187 contrib_background_filters, contrib_color_space, | 188 contrib_background_filters, contrib_color_space, |
| 188 contrib_has_transparent_background); | 189 contrib_has_transparent_background, false, false); |
| 189 | 190 |
| 190 SharedQuadState* contrib_shared_state = | 191 SharedQuadState* contrib_shared_state = |
| 191 contrib->CreateAndAppendSharedQuadState(); | 192 contrib->CreateAndAppendSharedQuadState(); |
| 192 contrib_shared_state->SetAll(gfx::Transform(), gfx::Rect(0, 0, 2, 2), | 193 contrib_shared_state->SetAll(gfx::Transform(), gfx::Rect(0, 0, 2, 2), |
| 193 gfx::Rect(), gfx::Rect(), false, 1, | 194 gfx::Rect(), gfx::Rect(), false, 1, |
| 194 SkBlendMode::kSrcOver, 0); | 195 SkBlendMode::kSrcOver, 0); |
| 195 | 196 |
| 196 SolidColorDrawQuad* contrib_quad = | 197 SolidColorDrawQuad* contrib_quad = |
| 197 contrib->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 198 contrib->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 198 contrib_quad->SetNew(contrib->shared_quad_state_list.back(), | 199 contrib_quad->SetNew(contrib->shared_quad_state_list.back(), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 226 gfx::Rect damage_rect(56, 123, 19, 43); | 227 gfx::Rect damage_rect(56, 123, 19, 43); |
| 227 FilterOperations filters; | 228 FilterOperations filters; |
| 228 filters.Append(FilterOperation::CreateOpacityFilter(0.5)); | 229 filters.Append(FilterOperation::CreateOpacityFilter(0.5)); |
| 229 FilterOperations background_filters; | 230 FilterOperations background_filters; |
| 230 background_filters.Append(FilterOperation::CreateInvertFilter(1.0)); | 231 background_filters.Append(FilterOperation::CreateInvertFilter(1.0)); |
| 231 gfx::ColorSpace color_space = gfx::ColorSpace::CreateSCRGBLinear(); | 232 gfx::ColorSpace color_space = gfx::ColorSpace::CreateSCRGBLinear(); |
| 232 bool has_transparent_background = true; | 233 bool has_transparent_background = true; |
| 233 | 234 |
| 234 std::unique_ptr<RenderPass> pass = RenderPass::Create(); | 235 std::unique_ptr<RenderPass> pass = RenderPass::Create(); |
| 235 pass->SetAll(id, output_rect, damage_rect, transform_to_root, filters, | 236 pass->SetAll(id, output_rect, damage_rect, transform_to_root, filters, |
| 236 background_filters, color_space, has_transparent_background); | 237 background_filters, color_space, has_transparent_background, |
| 238 false, false); |
| 237 | 239 |
| 238 // A shared state with a quad. | 240 // A shared state with a quad. |
| 239 SharedQuadState* shared_state1 = pass->CreateAndAppendSharedQuadState(); | 241 SharedQuadState* shared_state1 = pass->CreateAndAppendSharedQuadState(); |
| 240 shared_state1->SetAll(gfx::Transform(), gfx::Rect(0, 0, 1, 1), gfx::Rect(), | 242 shared_state1->SetAll(gfx::Transform(), gfx::Rect(0, 0, 1, 1), gfx::Rect(), |
| 241 gfx::Rect(), false, 1, SkBlendMode::kSrcOver, 0); | 243 gfx::Rect(), false, 1, SkBlendMode::kSrcOver, 0); |
| 242 | 244 |
| 243 SolidColorDrawQuad* color_quad1 = | 245 SolidColorDrawQuad* color_quad1 = |
| 244 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 246 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 245 color_quad1->SetNew(pass->shared_quad_state_list.back(), | 247 color_quad1->SetNew(pass->shared_quad_state_list.back(), |
| 246 gfx::Rect(1, 1, 1, 1), gfx::Rect(1, 1, 1, 1), SkColor(), | 248 gfx::Rect(1, 1, 1, 1), gfx::Rect(1, 1, 1, 1), SkColor(), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 271 | 273 |
| 272 // Make a copy with CopyAll(). | 274 // Make a copy with CopyAll(). |
| 273 RenderPassList copy_list; | 275 RenderPassList copy_list; |
| 274 RenderPass::CopyAll(pass_list, ©_list); | 276 RenderPass::CopyAll(pass_list, ©_list); |
| 275 | 277 |
| 276 CompareRenderPassLists(pass_list, copy_list); | 278 CompareRenderPassLists(pass_list, copy_list); |
| 277 } | 279 } |
| 278 | 280 |
| 279 } // namespace | 281 } // namespace |
| 280 } // namespace cc | 282 } // namespace cc |
| OLD | NEW |