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_common.h" | 5 #include "cc/test/render_pass_test_common.h" |
6 | 6 |
7 #include "cc/checkerboard_draw_quad.h" | 7 #include "cc/checkerboard_draw_quad.h" |
8 #include "cc/debug_border_draw_quad.h" | 8 #include "cc/debug_border_draw_quad.h" |
9 #include "cc/io_surface_draw_quad.h" | 9 #include "cc/io_surface_draw_quad.h" |
10 #include "cc/render_pass_draw_quad.h" | 10 #include "cc/render_pass_draw_quad.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 void TestRenderPass::AppendOneOfEveryQuadType( | 22 void TestRenderPass::AppendOneOfEveryQuadType( |
23 cc::ResourceProvider* resourceProvider) { | 23 cc::ResourceProvider* resourceProvider) { |
24 gfx::Rect rect(0, 0, 100, 100); | 24 gfx::Rect rect(0, 0, 100, 100); |
25 gfx::Rect opaque_rect(10, 10, 80, 80); | 25 gfx::Rect opaque_rect(10, 10, 80, 80); |
26 const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; | 26 const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
27 cc::ResourceProvider::ResourceId texture_resource = | 27 cc::ResourceProvider::ResourceId texture_resource = |
28 resourceProvider->createResource( | 28 resourceProvider->createResource( |
29 gfx::Size(20, 12), | 29 gfx::Size(20, 12), |
30 resourceProvider->bestTextureFormat(), | 30 resourceProvider->bestTextureFormat(), |
31 ResourceProvider::TextureUsageAny); | 31 ResourceProvider::TextureUsageAny); |
| 32 unsigned texture_id = ResourceProvider::ScopedReadLockGL( |
| 33 resourceProvider, texture_resource).textureId(); |
| 34 |
32 scoped_ptr<cc::SharedQuadState> shared_state = cc::SharedQuadState::Create(); | 35 scoped_ptr<cc::SharedQuadState> shared_state = cc::SharedQuadState::Create(); |
33 shared_state->SetAll(gfx::Transform(), | 36 shared_state->SetAll(gfx::Transform(), |
34 rect, | 37 rect, |
35 rect, | 38 rect, |
36 rect, | 39 rect, |
37 false, | 40 false, |
38 1); | 41 1); |
39 | 42 |
40 scoped_ptr<cc::CheckerboardDrawQuad> checkerboard_quad = | 43 scoped_ptr<cc::CheckerboardDrawQuad> checkerboard_quad = |
41 cc::CheckerboardDrawQuad::Create(); | 44 cc::CheckerboardDrawQuad::Create(); |
42 checkerboard_quad->SetNew(shared_state.get(), | 45 checkerboard_quad->SetNew(shared_state.get(), |
43 rect, | 46 rect, |
44 SK_ColorRED); | 47 SK_ColorRED); |
45 AppendQuad(checkerboard_quad.PassAs<DrawQuad>()); | 48 AppendQuad(checkerboard_quad.PassAs<DrawQuad>()); |
46 | 49 |
47 scoped_ptr<cc::DebugBorderDrawQuad> debug_border_quad = | 50 scoped_ptr<cc::DebugBorderDrawQuad> debug_border_quad = |
48 cc::DebugBorderDrawQuad::Create(); | 51 cc::DebugBorderDrawQuad::Create(); |
49 debug_border_quad->SetNew(shared_state.get(), | 52 debug_border_quad->SetNew(shared_state.get(), |
50 rect, | 53 rect, |
51 SK_ColorRED, | 54 SK_ColorRED, |
52 1); | 55 1); |
53 AppendQuad(debug_border_quad.PassAs<DrawQuad>()); | 56 AppendQuad(debug_border_quad.PassAs<DrawQuad>()); |
54 | 57 |
55 scoped_ptr<cc::IOSurfaceDrawQuad> io_surface_quad = | 58 scoped_ptr<cc::IOSurfaceDrawQuad> io_surface_quad = |
56 cc::IOSurfaceDrawQuad::Create(); | 59 cc::IOSurfaceDrawQuad::Create(); |
57 io_surface_quad->SetNew(shared_state.get(), | 60 io_surface_quad->SetNew(shared_state.get(), |
58 rect, | 61 rect, |
59 opaque_rect, | 62 opaque_rect, |
60 gfx::Size(50, 50), | 63 gfx::Size(50, 50), |
61 1, | 64 texture_id, |
62 cc::IOSurfaceDrawQuad::FLIPPED); | 65 cc::IOSurfaceDrawQuad::FLIPPED); |
63 AppendQuad(io_surface_quad.PassAs<DrawQuad>()); | 66 AppendQuad(io_surface_quad.PassAs<DrawQuad>()); |
64 | 67 |
65 scoped_ptr<cc::RenderPassDrawQuad> render_pass_quad = | 68 scoped_ptr<cc::RenderPassDrawQuad> render_pass_quad = |
66 cc::RenderPassDrawQuad::Create(); | 69 cc::RenderPassDrawQuad::Create(); |
67 render_pass_quad->SetNew(shared_state.get(), | 70 render_pass_quad->SetNew(shared_state.get(), |
68 rect, | 71 rect, |
69 cc::RenderPass::Id(1, 1), | 72 cc::RenderPass::Id(1, 1), |
70 false, | 73 false, |
71 0, | 74 0, |
72 rect, | 75 rect, |
73 gfx::RectF(), | 76 gfx::RectF(), |
74 WebKit::WebFilterOperations(), | 77 WebKit::WebFilterOperations(), |
75 skia::RefPtr<SkImageFilter>(), | 78 skia::RefPtr<SkImageFilter>(), |
76 WebKit::WebFilterOperations()); | 79 WebKit::WebFilterOperations()); |
77 AppendQuad(render_pass_quad.PassAs<DrawQuad>()); | 80 AppendQuad(render_pass_quad.PassAs<DrawQuad>()); |
78 | 81 |
79 scoped_ptr<cc::SolidColorDrawQuad> solid_color_quad = | 82 scoped_ptr<cc::SolidColorDrawQuad> solid_color_quad = |
80 cc::SolidColorDrawQuad::Create(); | 83 cc::SolidColorDrawQuad::Create(); |
81 solid_color_quad->SetNew(shared_state.get(), | 84 solid_color_quad->SetNew(shared_state.get(), |
82 rect, | 85 rect, |
83 SK_ColorRED); | 86 SK_ColorRED); |
84 AppendQuad(solid_color_quad.PassAs<DrawQuad>()); | 87 AppendQuad(solid_color_quad.PassAs<DrawQuad>()); |
85 | 88 |
86 scoped_ptr<cc::StreamVideoDrawQuad> stream_video_quad = | 89 scoped_ptr<cc::StreamVideoDrawQuad> stream_video_quad = |
87 cc::StreamVideoDrawQuad::Create(); | 90 cc::StreamVideoDrawQuad::Create(); |
88 stream_video_quad->SetNew(shared_state.get(), | 91 stream_video_quad->SetNew(shared_state.get(), |
89 rect, | 92 rect, |
90 opaque_rect, | 93 opaque_rect, |
91 1, | 94 texture_id, |
92 gfx::Transform()); | 95 gfx::Transform()); |
93 AppendQuad(stream_video_quad.PassAs<DrawQuad>()); | 96 AppendQuad(stream_video_quad.PassAs<DrawQuad>()); |
94 | 97 |
95 scoped_ptr<cc::TextureDrawQuad> texture_quad = | 98 scoped_ptr<cc::TextureDrawQuad> texture_quad = |
96 cc::TextureDrawQuad::Create(); | 99 cc::TextureDrawQuad::Create(); |
97 texture_quad->SetNew(shared_state.get(), | 100 texture_quad->SetNew(shared_state.get(), |
98 rect, | 101 rect, |
99 opaque_rect, | 102 opaque_rect, |
100 texture_resource, | 103 texture_resource, |
101 false, | 104 false, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 false, | 152 false, |
150 false, | 153 false, |
151 false, | 154 false, |
152 false, | 155 false, |
153 false); | 156 false); |
154 AppendQuad(tile_quad.PassAs<DrawQuad>()); | 157 AppendQuad(tile_quad.PassAs<DrawQuad>()); |
155 | 158 |
156 cc::VideoLayerImpl::FramePlane planes[3]; | 159 cc::VideoLayerImpl::FramePlane planes[3]; |
157 for (int i = 0; i < 3; ++i) { | 160 for (int i = 0; i < 3; ++i) { |
158 planes[i].resourceId = | 161 planes[i].resourceId = |
159 resourceProvider->createResourceFromExternalTexture(1); | 162 resourceProvider->createResource( |
| 163 gfx::Size(20, 12), |
| 164 resourceProvider->bestTextureFormat(), |
| 165 ResourceProvider::TextureUsageAny); |
160 planes[i].size = gfx::Size(100, 100); | 166 planes[i].size = gfx::Size(100, 100); |
161 planes[i].format = GL_LUMINANCE; | 167 planes[i].format = GL_LUMINANCE; |
162 } | 168 } |
163 scoped_ptr<cc::YUVVideoDrawQuad> yuv_quad = | 169 scoped_ptr<cc::YUVVideoDrawQuad> yuv_quad = |
164 cc::YUVVideoDrawQuad::Create(); | 170 cc::YUVVideoDrawQuad::Create(); |
165 yuv_quad->SetNew(shared_state.get(), | 171 yuv_quad->SetNew(shared_state.get(), |
166 rect, | 172 rect, |
167 opaque_rect, | 173 opaque_rect, |
168 gfx::Size(100, 100), | 174 gfx::Size(100, 100), |
169 planes[0], | 175 planes[0], |
170 planes[1], | 176 planes[1], |
171 planes[2]); | 177 planes[2]); |
172 AppendQuad(yuv_quad.PassAs<DrawQuad>()); | 178 AppendQuad(yuv_quad.PassAs<DrawQuad>()); |
173 | 179 |
174 AppendSharedQuadState(transformed_state.Pass()); | 180 AppendSharedQuadState(transformed_state.Pass()); |
175 AppendSharedQuadState(shared_state.Pass()); | 181 AppendSharedQuadState(shared_state.Pass()); |
176 } | 182 } |
177 | 183 |
178 } // namespace cc | 184 } // namespace cc |
OLD | NEW |