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

Side by Side Diff: cc/surfaces/surfaces_pixeltest.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « cc/surfaces/surface_unittest.cc ('k') | cc/test/begin_frame_args_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/output/compositor_frame.h" 5 #include "cc/output/compositor_frame.h"
6 #include "cc/quads/render_pass.h" 6 #include "cc/quads/render_pass.h"
7 #include "cc/quads/solid_color_draw_quad.h" 7 #include "cc/quads/solid_color_draw_quad.h"
8 #include "cc/quads/surface_draw_quad.h" 8 #include "cc/quads/surface_draw_quad.h"
9 #include "cc/surfaces/surface.h" 9 #include "cc/surfaces/surface.h"
10 #include "cc/surfaces/surface_aggregator.h" 10 #include "cc/surfaces/surface_aggregator.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 SK_ColorGREEN, 78 SK_ColorGREEN,
79 force_anti_aliasing_off); 79 force_anti_aliasing_off);
80 80
81 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); 81 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData);
82 delegated_frame_data->render_pass_list.push_back(pass.Pass()); 82 delegated_frame_data->render_pass_list.push_back(pass.Pass());
83 83
84 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); 84 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame);
85 root_frame->delegated_frame_data = delegated_frame_data.Pass(); 85 root_frame->delegated_frame_data = delegated_frame_data.Pass();
86 86
87 SurfaceId root_surface_id = allocator_.GenerateId(); 87 SurfaceId root_surface_id = allocator_.GenerateId();
88 factory_.Create(root_surface_id, device_viewport_size_); 88 factory_.Create(root_surface_id);
89 factory_.SubmitFrame(root_surface_id, root_frame.Pass(), base::Closure()); 89 factory_.SubmitFrame(root_surface_id, root_frame.Pass(), base::Closure());
90 90
91 SurfaceAggregator aggregator(&manager_, resource_provider_.get()); 91 SurfaceAggregator aggregator(&manager_, resource_provider_.get());
92 scoped_ptr<CompositorFrame> aggregated_frame = 92 scoped_ptr<CompositorFrame> aggregated_frame =
93 aggregator.Aggregate(root_surface_id); 93 aggregator.Aggregate(root_surface_id);
94 factory_.Destroy(root_surface_id); 94 factory_.Destroy(root_surface_id);
95 95
96 bool discard_alpha = false; 96 bool discard_alpha = false;
97 ExactPixelComparator pixel_comparator(discard_alpha); 97 ExactPixelComparator pixel_comparator(discard_alpha);
98 RenderPassList* pass_list = 98 RenderPassList* pass_list =
99 &aggregated_frame->delegated_frame_data->render_pass_list; 99 &aggregated_frame->delegated_frame_data->render_pass_list;
100 EXPECT_TRUE(RunPixelTest(pass_list, 100 EXPECT_TRUE(RunPixelTest(pass_list,
101 base::FilePath(FILE_PATH_LITERAL("green.png")), 101 base::FilePath(FILE_PATH_LITERAL("green.png")),
102 pixel_comparator)); 102 pixel_comparator));
103 } 103 }
104 104
105 // Draws a frame with simple surface embedding. 105 // Draws a frame with simple surface embedding.
106 TEST_F(SurfacesPixelTest, DrawSimpleAggregatedFrame) { 106 TEST_F(SurfacesPixelTest, DrawSimpleAggregatedFrame) {
107 gfx::Size child_size(200, 100); 107 gfx::Size child_size(200, 100);
108 SurfaceId child_surface_id = allocator_.GenerateId(); 108 SurfaceId child_surface_id = allocator_.GenerateId();
109 SurfaceId root_surface_id = allocator_.GenerateId(); 109 SurfaceId root_surface_id = allocator_.GenerateId();
110 factory_.Create(child_surface_id, child_size); 110 factory_.Create(child_surface_id);
111 factory_.Create(root_surface_id, device_viewport_size_); 111 factory_.Create(root_surface_id);
112 { 112 {
113 gfx::Rect rect(device_viewport_size_); 113 gfx::Rect rect(device_viewport_size_);
114 RenderPassId id(1, 1); 114 RenderPassId id(1, 1);
115 scoped_ptr<RenderPass> pass = RenderPass::Create(); 115 scoped_ptr<RenderPass> pass = RenderPass::Create();
116 pass->SetNew(id, rect, rect, gfx::Transform()); 116 pass->SetNew(id, rect, rect, gfx::Transform());
117 117
118 CreateAndAppendTestSharedQuadState( 118 CreateAndAppendTestSharedQuadState(
119 pass.get(), gfx::Transform(), device_viewport_size_); 119 pass.get(), gfx::Transform(), device_viewport_size_);
120 120
121 SurfaceDrawQuad* surface_quad = 121 SurfaceDrawQuad* surface_quad =
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // Structure: 192 // Structure:
193 // root (200x200) -> left_child (100x200 @ 0x0, 193 // root (200x200) -> left_child (100x200 @ 0x0,
194 // right_child (100x200 @ 0x100) 194 // right_child (100x200 @ 0x100)
195 // left_child -> top_green_quad (100x100 @ 0x0), 195 // left_child -> top_green_quad (100x100 @ 0x0),
196 // bottom_blue_quad (100x100 @ 0x100) 196 // bottom_blue_quad (100x100 @ 0x100)
197 // right_child -> top_blue_quad (100x100 @ 0x0), 197 // right_child -> top_blue_quad (100x100 @ 0x0),
198 // bottom_green_quad (100x100 @ 0x100) 198 // bottom_green_quad (100x100 @ 0x100)
199 SurfaceId left_child_id = allocator_.GenerateId(); 199 SurfaceId left_child_id = allocator_.GenerateId();
200 SurfaceId right_child_id = allocator_.GenerateId(); 200 SurfaceId right_child_id = allocator_.GenerateId();
201 SurfaceId root_surface_id = allocator_.GenerateId(); 201 SurfaceId root_surface_id = allocator_.GenerateId();
202 factory_.Create(left_child_id, child_size); 202 factory_.Create(left_child_id);
203 factory_.Create(right_child_id, child_size); 203 factory_.Create(right_child_id);
204 factory_.Create(root_surface_id, device_viewport_size_); 204 factory_.Create(root_surface_id);
205 205
206 { 206 {
207 gfx::Rect rect(device_viewport_size_); 207 gfx::Rect rect(device_viewport_size_);
208 RenderPassId id(1, 1); 208 RenderPassId id(1, 1);
209 scoped_ptr<RenderPass> pass = RenderPass::Create(); 209 scoped_ptr<RenderPass> pass = RenderPass::Create();
210 pass->SetNew(id, rect, rect, gfx::Transform()); 210 pass->SetNew(id, rect, rect, gfx::Transform());
211 211
212 gfx::Transform surface_transform; 212 gfx::Transform surface_transform;
213 CreateAndAppendTestSharedQuadState( 213 CreateAndAppendTestSharedQuadState(
214 pass.get(), surface_transform, device_viewport_size_); 214 pass.get(), surface_transform, device_viewport_size_);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 factory_.Destroy(root_surface_id); 326 factory_.Destroy(root_surface_id);
327 factory_.Destroy(left_child_id); 327 factory_.Destroy(left_child_id);
328 factory_.Destroy(right_child_id); 328 factory_.Destroy(right_child_id);
329 } 329 }
330 330
331 } // namespace 331 } // namespace
332 } // namespace cc 332 } // namespace cc
333 333
334 #endif // !defined(OS_ANDROID) 334 #endif // !defined(OS_ANDROID)
OLDNEW
« no previous file with comments | « cc/surfaces/surface_unittest.cc ('k') | cc/test/begin_frame_args_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698