| 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/test/render_pass_test_utils.h" | 5 #include "cc/test/render_pass_test_utils.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "cc/quads/debug_border_draw_quad.h" | 10 #include "cc/quads/debug_border_draw_quad.h" |
| 11 #include "cc/quads/render_pass_draw_quad.h" | 11 #include "cc/quads/render_pass_draw_quad.h" |
| 12 #include "cc/quads/shared_quad_state.h" | 12 #include "cc/quads/shared_quad_state.h" |
| 13 #include "cc/quads/solid_color_draw_quad.h" | 13 #include "cc/quads/solid_color_draw_quad.h" |
| 14 #include "cc/quads/stream_video_draw_quad.h" | 14 #include "cc/quads/stream_video_draw_quad.h" |
| 15 #include "cc/quads/texture_draw_quad.h" | 15 #include "cc/quads/texture_draw_quad.h" |
| 16 #include "cc/quads/tile_draw_quad.h" | 16 #include "cc/quads/tile_draw_quad.h" |
| 17 #include "cc/quads/yuv_video_draw_quad.h" | 17 #include "cc/quads/yuv_video_draw_quad.h" |
| 18 #include "cc/resources/resource_provider.h" | 18 #include "cc/resources/resource_provider.h" |
| 19 #include "third_party/skia/include/core/SkColor.h" | 19 #include "third_party/skia/include/core/SkColor.h" |
| 20 #include "third_party/skia/include/core/SkImageFilter.h" | 20 #include "third_party/skia/include/core/SkImageFilter.h" |
| 21 #include "ui/gfx/geometry/rect.h" | 21 #include "ui/gfx/geometry/rect.h" |
| 22 | 22 |
| 23 namespace cc { | 23 namespace cc { |
| 24 | 24 |
| 25 RenderPass* AddRenderPass(RenderPassList* pass_list, | 25 RenderPass* AddRenderPass(RenderPassList* pass_list, |
| 26 RenderPassId id, | 26 RenderPassId id, |
| 27 const gfx::Rect& output_rect, | 27 const gfx::Rect& output_rect, |
| 28 const gfx::Transform& root_transform) { | 28 const gfx::Transform& root_transform, |
| 29 const FilterOperations& filters) { |
| 29 std::unique_ptr<RenderPass> pass(RenderPass::Create()); | 30 std::unique_ptr<RenderPass> pass(RenderPass::Create()); |
| 30 pass->SetNew(id, output_rect, output_rect, root_transform); | 31 pass->SetNew(id, output_rect, output_rect, root_transform, filters, |
| 32 FilterOperations()); |
| 31 RenderPass* saved = pass.get(); | 33 RenderPass* saved = pass.get(); |
| 32 pass_list->push_back(std::move(pass)); | 34 pass_list->push_back(std::move(pass)); |
| 33 return saved; | 35 return saved; |
| 34 } | 36 } |
| 35 | 37 |
| 36 SolidColorDrawQuad* AddQuad(RenderPass* pass, | 38 SolidColorDrawQuad* AddQuad(RenderPass* pass, |
| 37 const gfx::Rect& rect, | 39 const gfx::Rect& rect, |
| 38 SkColor color) { | 40 SkColor color) { |
| 39 SharedQuadState* shared_state = pass->CreateAndAppendSharedQuadState(); | 41 SharedQuadState* shared_state = pass->CreateAndAppendSharedQuadState(); |
| 40 shared_state->SetAll(gfx::Transform(), rect.size(), rect, rect, false, 1, | 42 shared_state->SetAll(gfx::Transform(), rect.size(), rect, rect, false, 1, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 71 } | 73 } |
| 72 | 74 |
| 73 void AddRenderPassQuad(RenderPass* to_pass, RenderPass* contributing_pass) { | 75 void AddRenderPassQuad(RenderPass* to_pass, RenderPass* contributing_pass) { |
| 74 gfx::Rect output_rect = contributing_pass->output_rect; | 76 gfx::Rect output_rect = contributing_pass->output_rect; |
| 75 SharedQuadState* shared_state = to_pass->CreateAndAppendSharedQuadState(); | 77 SharedQuadState* shared_state = to_pass->CreateAndAppendSharedQuadState(); |
| 76 shared_state->SetAll(gfx::Transform(), output_rect.size(), output_rect, | 78 shared_state->SetAll(gfx::Transform(), output_rect.size(), output_rect, |
| 77 output_rect, false, 1, SkBlendMode::kSrcOver, 0); | 79 output_rect, false, 1, SkBlendMode::kSrcOver, 0); |
| 78 RenderPassDrawQuad* quad = | 80 RenderPassDrawQuad* quad = |
| 79 to_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 81 to_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
| 80 quad->SetNew(shared_state, output_rect, output_rect, contributing_pass->id, 0, | 82 quad->SetNew(shared_state, output_rect, output_rect, contributing_pass->id, 0, |
| 81 gfx::Vector2dF(), gfx::Size(), FilterOperations(), | 83 gfx::Vector2dF(), gfx::Size(), gfx::Vector2dF(), gfx::PointF()); |
| 82 gfx::Vector2dF(), gfx::PointF(), FilterOperations()); | |
| 83 } | 84 } |
| 84 | 85 |
| 85 void AddRenderPassQuad(RenderPass* to_pass, | 86 void AddRenderPassQuad(RenderPass* to_pass, |
| 86 RenderPass* contributing_pass, | 87 RenderPass* contributing_pass, |
| 87 ResourceId mask_resource_id, | 88 ResourceId mask_resource_id, |
| 88 const FilterOperations& filters, | |
| 89 gfx::Transform transform, | 89 gfx::Transform transform, |
| 90 SkBlendMode blend_mode) { | 90 SkBlendMode blend_mode) { |
| 91 gfx::Rect output_rect = contributing_pass->output_rect; | 91 gfx::Rect output_rect = contributing_pass->output_rect; |
| 92 SharedQuadState* shared_state = to_pass->CreateAndAppendSharedQuadState(); | 92 SharedQuadState* shared_state = to_pass->CreateAndAppendSharedQuadState(); |
| 93 shared_state->SetAll(transform, | 93 shared_state->SetAll(transform, |
| 94 output_rect.size(), | 94 output_rect.size(), |
| 95 output_rect, | 95 output_rect, |
| 96 output_rect, | 96 output_rect, |
| 97 false, | 97 false, |
| 98 1, | 98 1, |
| 99 blend_mode, | 99 blend_mode, |
| 100 0); | 100 0); |
| 101 RenderPassDrawQuad* quad = | 101 RenderPassDrawQuad* quad = |
| 102 to_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 102 to_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
| 103 gfx::Size arbitrary_nonzero_size(1, 1); | 103 gfx::Size arbitrary_nonzero_size(1, 1); |
| 104 quad->SetNew(shared_state, output_rect, output_rect, contributing_pass->id, | 104 quad->SetNew(shared_state, output_rect, output_rect, contributing_pass->id, |
| 105 mask_resource_id, gfx::Vector2dF(1.f, 1.f), | 105 mask_resource_id, gfx::Vector2dF(1.f, 1.f), |
| 106 arbitrary_nonzero_size, filters, gfx::Vector2dF(), gfx::PointF(), | 106 arbitrary_nonzero_size, gfx::Vector2dF(), gfx::PointF()); |
| 107 FilterOperations()); | |
| 108 } | 107 } |
| 109 | 108 |
| 110 static void EmptyReleaseCallback(const gpu::SyncToken& sync_token, | 109 static void EmptyReleaseCallback(const gpu::SyncToken& sync_token, |
| 111 bool lost_resource, | 110 bool lost_resource, |
| 112 BlockingTaskRunner* main_thread_task_runner) {} | 111 BlockingTaskRunner* main_thread_task_runner) {} |
| 113 | 112 |
| 114 void AddOneOfEveryQuadType(RenderPass* to_pass, | 113 void AddOneOfEveryQuadType(RenderPass* to_pass, |
| 115 ResourceProvider* resource_provider, | 114 ResourceProvider* resource_provider, |
| 116 RenderPassId child_pass, | 115 RenderPassId child_pass, |
| 117 gpu::SyncToken* sync_token_for_mailbox_tebxture) { | 116 gpu::SyncToken* sync_token_for_mailbox_tebxture) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 shared_state->SetAll(gfx::Transform(), rect.size(), rect, rect, false, 1, | 168 shared_state->SetAll(gfx::Transform(), rect.size(), rect, rect, false, 1, |
| 170 SkBlendMode::kSrcOver, 0); | 169 SkBlendMode::kSrcOver, 0); |
| 171 | 170 |
| 172 DebugBorderDrawQuad* debug_border_quad = | 171 DebugBorderDrawQuad* debug_border_quad = |
| 173 to_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); | 172 to_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); |
| 174 debug_border_quad->SetNew(shared_state, rect, visible_rect, SK_ColorRED, 1); | 173 debug_border_quad->SetNew(shared_state, rect, visible_rect, SK_ColorRED, 1); |
| 175 | 174 |
| 176 if (child_pass.layer_id) { | 175 if (child_pass.layer_id) { |
| 177 RenderPassDrawQuad* render_pass_quad = | 176 RenderPassDrawQuad* render_pass_quad = |
| 178 to_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 177 to_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
| 179 render_pass_quad->SetNew( | 178 render_pass_quad->SetNew(shared_state, rect, visible_rect, child_pass, |
| 180 shared_state, rect, visible_rect, child_pass, resource5, | 179 resource5, gfx::Vector2dF(1.f, 1.f), |
| 181 gfx::Vector2dF(1.f, 1.f), resource5_size, FilterOperations(), | 180 resource5_size, gfx::Vector2dF(), gfx::PointF()); |
| 182 gfx::Vector2dF(), gfx::PointF(), FilterOperations()); | |
| 183 } | 181 } |
| 184 | 182 |
| 185 SolidColorDrawQuad* solid_color_quad = | 183 SolidColorDrawQuad* solid_color_quad = |
| 186 to_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 184 to_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 187 solid_color_quad->SetNew(shared_state, rect, visible_rect, SK_ColorRED, | 185 solid_color_quad->SetNew(shared_state, rect, visible_rect, SK_ColorRED, |
| 188 false); | 186 false); |
| 189 | 187 |
| 190 StreamVideoDrawQuad* stream_video_quad = | 188 StreamVideoDrawQuad* stream_video_quad = |
| 191 to_pass->CreateAndAppendDrawQuad<StreamVideoDrawQuad>(); | 189 to_pass->CreateAndAppendDrawQuad<StreamVideoDrawQuad>(); |
| 192 stream_video_quad->SetNew(shared_state, rect, opaque_rect, visible_rect, | 190 stream_video_quad->SetNew(shared_state, rect, opaque_rect, visible_rect, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 to_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); | 245 to_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); |
| 248 yuv_quad->SetNew(shared_state2, rect, opaque_rect, visible_rect, | 246 yuv_quad->SetNew(shared_state2, rect, opaque_rect, visible_rect, |
| 249 gfx::RectF(.0f, .0f, 100.0f, 100.0f), | 247 gfx::RectF(.0f, .0f, 100.0f, 100.0f), |
| 250 gfx::RectF(.0f, .0f, 50.0f, 50.0f), gfx::Size(100, 100), | 248 gfx::RectF(.0f, .0f, 50.0f, 50.0f), gfx::Size(100, 100), |
| 251 gfx::Size(50, 50), plane_resources[0], plane_resources[1], | 249 gfx::Size(50, 50), plane_resources[0], plane_resources[1], |
| 252 plane_resources[2], plane_resources[3], color_space, | 250 plane_resources[2], plane_resources[3], color_space, |
| 253 gfx::ColorSpace::CreateJpeg(), 0.0, 1.0, 8); | 251 gfx::ColorSpace::CreateJpeg(), 0.0, 1.0, 8); |
| 254 } | 252 } |
| 255 | 253 |
| 256 } // namespace cc | 254 } // namespace cc |
| OLD | NEW |