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

Side by Side Diff: cc/layers/video_layer_impl_unittest.cc

Issue 448303002: Use custom ListContainer to allocate DrawQuads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@perftest
Patch Set: fix rebase Created 6 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/layers/video_layer_impl.h" 5 #include "cc/layers/video_layer_impl.h"
6 6
7 #include "cc/layers/video_frame_provider_client_impl.h" 7 #include "cc/layers/video_frame_provider_client_impl.h"
8 #include "cc/output/context_provider.h" 8 #include "cc/output/context_provider.h"
9 #include "cc/output/output_surface.h" 9 #include "cc/output/output_surface.h"
10 #include "cc/quads/draw_quad.h" 10 #include "cc/quads/draw_quad.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 video_layer_impl->SetBounds(layer_size); 115 video_layer_impl->SetBounds(layer_size);
116 video_layer_impl->SetContentBounds(layer_size); 116 video_layer_impl->SetContentBounds(layer_size);
117 video_layer_impl->SetDrawsContent(true); 117 video_layer_impl->SetDrawsContent(true);
118 118
119 impl.CalcDrawProps(viewport_size); 119 impl.CalcDrawProps(viewport_size);
120 gfx::Rect occluded; 120 gfx::Rect occluded;
121 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); 121 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded);
122 122
123 EXPECT_EQ(1u, impl.quad_list().size()); 123 EXPECT_EQ(1u, impl.quad_list().size());
124 124
125 gfx::Point3F p1(0, impl.quad_list()[0]->rect.height(), 0); 125 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0);
126 gfx::Point3F p2(impl.quad_list()[0]->rect.width(), 0, 0); 126 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0);
127 impl.quad_list()[0]->quadTransform().TransformPoint(&p1); 127 impl.quad_list().front()->quadTransform().TransformPoint(&p1);
128 impl.quad_list()[0]->quadTransform().TransformPoint(&p2); 128 impl.quad_list().front()->quadTransform().TransformPoint(&p2);
129 EXPECT_EQ(gfx::Point3F(0, 50, 0), p1); 129 EXPECT_EQ(gfx::Point3F(0, 50, 0), p1);
130 EXPECT_EQ(gfx::Point3F(100, 0, 0), p2); 130 EXPECT_EQ(gfx::Point3F(100, 0, 0), p2);
131 } 131 }
132 132
133 TEST(VideoLayerImplTest, Rotated90) { 133 TEST(VideoLayerImplTest, Rotated90) {
134 gfx::Size layer_size(100, 50); 134 gfx::Size layer_size(100, 50);
135 gfx::Size viewport_size(1000, 500); 135 gfx::Size viewport_size(1000, 500);
136 136
137 LayerTestCommon::LayerImplTest impl; 137 LayerTestCommon::LayerImplTest impl;
138 DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy()); 138 DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy());
(...skipping 12 matching lines...) Expand all
151 video_layer_impl->SetBounds(layer_size); 151 video_layer_impl->SetBounds(layer_size);
152 video_layer_impl->SetContentBounds(layer_size); 152 video_layer_impl->SetContentBounds(layer_size);
153 video_layer_impl->SetDrawsContent(true); 153 video_layer_impl->SetDrawsContent(true);
154 154
155 impl.CalcDrawProps(viewport_size); 155 impl.CalcDrawProps(viewport_size);
156 gfx::Rect occluded; 156 gfx::Rect occluded;
157 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); 157 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded);
158 158
159 EXPECT_EQ(1u, impl.quad_list().size()); 159 EXPECT_EQ(1u, impl.quad_list().size());
160 160
161 gfx::Point3F p1(0, impl.quad_list()[0]->rect.height(), 0); 161 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0);
162 gfx::Point3F p2(impl.quad_list()[0]->rect.width(), 0, 0); 162 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0);
163 impl.quad_list()[0]->quadTransform().TransformPoint(&p1); 163 impl.quad_list().front()->quadTransform().TransformPoint(&p1);
164 impl.quad_list()[0]->quadTransform().TransformPoint(&p2); 164 impl.quad_list().front()->quadTransform().TransformPoint(&p2);
165 EXPECT_EQ(gfx::Point3F(0, 0, 0), p1); 165 EXPECT_EQ(gfx::Point3F(0, 0, 0), p1);
166 EXPECT_EQ(gfx::Point3F(100, 50, 0), p2); 166 EXPECT_EQ(gfx::Point3F(100, 50, 0), p2);
167 } 167 }
168 168
169 TEST(VideoLayerImplTest, Rotated180) { 169 TEST(VideoLayerImplTest, Rotated180) {
170 gfx::Size layer_size(100, 50); 170 gfx::Size layer_size(100, 50);
171 gfx::Size viewport_size(1000, 500); 171 gfx::Size viewport_size(1000, 500);
172 172
173 LayerTestCommon::LayerImplTest impl; 173 LayerTestCommon::LayerImplTest impl;
174 DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy()); 174 DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy());
(...skipping 12 matching lines...) Expand all
187 video_layer_impl->SetBounds(layer_size); 187 video_layer_impl->SetBounds(layer_size);
188 video_layer_impl->SetContentBounds(layer_size); 188 video_layer_impl->SetContentBounds(layer_size);
189 video_layer_impl->SetDrawsContent(true); 189 video_layer_impl->SetDrawsContent(true);
190 190
191 impl.CalcDrawProps(viewport_size); 191 impl.CalcDrawProps(viewport_size);
192 gfx::Rect occluded; 192 gfx::Rect occluded;
193 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); 193 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded);
194 194
195 EXPECT_EQ(1u, impl.quad_list().size()); 195 EXPECT_EQ(1u, impl.quad_list().size());
196 196
197 gfx::Point3F p1(0, impl.quad_list()[0]->rect.height(), 0); 197 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0);
198 gfx::Point3F p2(impl.quad_list()[0]->rect.width(), 0, 0); 198 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0);
199 impl.quad_list()[0]->quadTransform().TransformPoint(&p1); 199 impl.quad_list().front()->quadTransform().TransformPoint(&p1);
200 impl.quad_list()[0]->quadTransform().TransformPoint(&p2); 200 impl.quad_list().front()->quadTransform().TransformPoint(&p2);
201 EXPECT_EQ(gfx::Point3F(100, 0, 0), p1); 201 EXPECT_EQ(gfx::Point3F(100, 0, 0), p1);
202 EXPECT_EQ(gfx::Point3F(0, 50, 0), p2); 202 EXPECT_EQ(gfx::Point3F(0, 50, 0), p2);
203 } 203 }
204 204
205 TEST(VideoLayerImplTest, Rotated270) { 205 TEST(VideoLayerImplTest, Rotated270) {
206 gfx::Size layer_size(100, 50); 206 gfx::Size layer_size(100, 50);
207 gfx::Size viewport_size(1000, 500); 207 gfx::Size viewport_size(1000, 500);
208 208
209 LayerTestCommon::LayerImplTest impl; 209 LayerTestCommon::LayerImplTest impl;
210 DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy()); 210 DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy());
(...skipping 12 matching lines...) Expand all
223 video_layer_impl->SetBounds(layer_size); 223 video_layer_impl->SetBounds(layer_size);
224 video_layer_impl->SetContentBounds(layer_size); 224 video_layer_impl->SetContentBounds(layer_size);
225 video_layer_impl->SetDrawsContent(true); 225 video_layer_impl->SetDrawsContent(true);
226 226
227 impl.CalcDrawProps(viewport_size); 227 impl.CalcDrawProps(viewport_size);
228 gfx::Rect occluded; 228 gfx::Rect occluded;
229 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); 229 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded);
230 230
231 EXPECT_EQ(1u, impl.quad_list().size()); 231 EXPECT_EQ(1u, impl.quad_list().size());
232 232
233 gfx::Point3F p1(0, impl.quad_list()[0]->rect.height(), 0); 233 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0);
234 gfx::Point3F p2(impl.quad_list()[0]->rect.width(), 0, 0); 234 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0);
235 impl.quad_list()[0]->quadTransform().TransformPoint(&p1); 235 impl.quad_list().front()->quadTransform().TransformPoint(&p1);
236 impl.quad_list()[0]->quadTransform().TransformPoint(&p2); 236 impl.quad_list().front()->quadTransform().TransformPoint(&p2);
237 EXPECT_EQ(gfx::Point3F(100, 50, 0), p1); 237 EXPECT_EQ(gfx::Point3F(100, 50, 0), p1);
238 EXPECT_EQ(gfx::Point3F(0, 0, 0), p2); 238 EXPECT_EQ(gfx::Point3F(0, 0, 0), p2);
239 } 239 }
240 240
241 } // namespace 241 } // namespace
242 } // namespace cc 242 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698