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

Side by Side Diff: cc/delegated_renderer_layer_impl_unittest.cc

Issue 12328098: cc: Moving anti-aliasing decision to parent compositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@solidaa
Patch Set: Rebase to tip of tree Created 7 years, 9 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
« no previous file with comments | « no previous file | cc/draw_quad.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 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/delegated_renderer_layer_impl.h" 5 #include "cc/delegated_renderer_layer_impl.h"
6 6
7 #include "cc/append_quads_data.h" 7 #include "cc/append_quads_data.h"
8 #include "cc/layer_tree_host_impl.h" 8 #include "cc/layer_tree_host_impl.h"
9 #include "cc/layer_tree_impl.h" 9 #include "cc/layer_tree_impl.h"
10 #include "cc/quad_sink.h" 10 #include "cc/quad_sink.h"
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 delegated_renderer_layer->setBounds(gfx::Size(30, 30)); 466 delegated_renderer_layer->setBounds(gfx::Size(30, 30));
467 delegated_renderer_layer->setContentBounds(gfx::Size(30, 30)); 467 delegated_renderer_layer->setContentBounds(gfx::Size(30, 30));
468 delegated_renderer_layer->setDrawsContent(true); 468 delegated_renderer_layer->setDrawsContent(true);
469 gfx::Transform transform; 469 gfx::Transform transform;
470 transform.Scale(2.0, 2.0); 470 transform.Scale(2.0, 2.0);
471 transform.Translate(8.0, 8.0); 471 transform.Translate(8.0, 8.0);
472 delegated_renderer_layer->setTransform(transform); 472 delegated_renderer_layer->setTransform(transform);
473 473
474 ScopedPtrVector<RenderPass> delegated_render_passes; 474 ScopedPtrVector<RenderPass> delegated_render_passes;
475 475
476 gfx::Size child_pass_content_bounds(7, 7);
476 gfx::Rect child_pass_rect(20, 20, 7, 7); 477 gfx::Rect child_pass_rect(20, 20, 7, 7);
477 gfx::Transform child_pass_transform; 478 gfx::Transform child_pass_transform;
478 child_pass_transform.Scale(0.8, 0.8); 479 child_pass_transform.Scale(0.8, 0.8);
479 child_pass_transform.Translate(9.0, 9.0); 480 child_pass_transform.Translate(9.0, 9.0);
480 gfx::Rect child_pass_clip_rect(21, 21, 3, 3); 481 gfx::Rect child_pass_clip_rect(21, 21, 3, 3);
481 bool child_pass_clipped = false; 482 bool child_pass_clipped = false;
482 483
483 { 484 {
484 TestRenderPass* pass = addRenderPass( 485 TestRenderPass* pass = addRenderPass(
485 delegated_render_passes, 486 delegated_render_passes,
486 RenderPass::Id(10, 7), 487 RenderPass::Id(10, 7),
487 child_pass_rect, 488 child_pass_rect,
488 gfx::Transform()); 489 gfx::Transform());
489 MockQuadCuller quad_sink(pass->quad_list, pass->shared_quad_state_list); 490 MockQuadCuller quad_sink(pass->quad_list, pass->shared_quad_state_list);
490 AppendQuadsData data(pass->id); 491 AppendQuadsData data(pass->id);
491 SharedQuadState* shared_quad_state = quad_sink.useSharedQuadState( 492 SharedQuadState* shared_quad_state = quad_sink.useSharedQuadState(
492 SharedQuadState::Create()); 493 SharedQuadState::Create());
493 shared_quad_state->SetAll( 494 shared_quad_state->SetAll(
494 child_pass_transform, 495 child_pass_transform,
496 child_pass_content_bounds,
495 child_pass_rect, 497 child_pass_rect,
496 child_pass_clip_rect, 498 child_pass_clip_rect,
497 child_pass_clipped, 499 child_pass_clipped,
498 1.f); 500 1.f);
499 501
500 scoped_ptr<SolidColorDrawQuad> color_quad; 502 scoped_ptr<SolidColorDrawQuad> color_quad;
501 color_quad = SolidColorDrawQuad::Create(); 503 color_quad = SolidColorDrawQuad::Create();
502 color_quad->SetNew(shared_quad_state, gfx::Rect(20, 20, 3, 7), 1u); 504 color_quad->SetNew(shared_quad_state, gfx::Rect(20, 20, 3, 7), 1u);
503 quad_sink.append(color_quad.PassAs<DrawQuad>(), data); 505 quad_sink.append(color_quad.PassAs<DrawQuad>(), data);
504 506
505 color_quad = SolidColorDrawQuad::Create(); 507 color_quad = SolidColorDrawQuad::Create();
506 color_quad->SetNew(shared_quad_state, gfx::Rect(23, 20, 4, 7), 1u); 508 color_quad->SetNew(shared_quad_state, gfx::Rect(23, 20, 4, 7), 1u);
507 quad_sink.append(color_quad.PassAs<DrawQuad>(), data); 509 quad_sink.append(color_quad.PassAs<DrawQuad>(), data);
508 } 510 }
509 511
512 gfx::Size root_pass_content_bounds(50, 50);
510 gfx::Rect root_pass_rect(0, 0, 50, 50); 513 gfx::Rect root_pass_rect(0, 0, 50, 50);
511 gfx::Transform root_pass_transform; 514 gfx::Transform root_pass_transform;
512 root_pass_transform.Scale(1.5, 1.5); 515 root_pass_transform.Scale(1.5, 1.5);
513 root_pass_transform.Translate(7.0, 7.0); 516 root_pass_transform.Translate(7.0, 7.0);
514 gfx::Rect root_pass_clip_rect(10, 10, 35, 35); 517 gfx::Rect root_pass_clip_rect(10, 10, 35, 35);
515 bool root_pass_clipped = root_delegated_render_pass_is_clipped_; 518 bool root_pass_clipped = root_delegated_render_pass_is_clipped_;
516 519
517 TestRenderPass* pass = addRenderPass( 520 TestRenderPass* pass = addRenderPass(
518 delegated_render_passes, 521 delegated_render_passes,
519 RenderPass::Id(9, 6), 522 RenderPass::Id(9, 6),
520 root_pass_rect, 523 root_pass_rect,
521 gfx::Transform()); 524 gfx::Transform());
522 MockQuadCuller quad_sink(pass->quad_list, pass->shared_quad_state_list); 525 MockQuadCuller quad_sink(pass->quad_list, pass->shared_quad_state_list);
523 AppendQuadsData data(pass->id); 526 AppendQuadsData data(pass->id);
524 SharedQuadState* shared_quad_state = quad_sink.useSharedQuadState(SharedQuad State::Create()); 527 SharedQuadState* shared_quad_state = quad_sink.useSharedQuadState(SharedQuad State::Create());
525 shared_quad_state->SetAll( 528 shared_quad_state->SetAll(
526 root_pass_transform, 529 root_pass_transform,
530 root_pass_content_bounds,
527 root_pass_rect, 531 root_pass_rect,
528 root_pass_clip_rect, 532 root_pass_clip_rect,
529 root_pass_clipped, 533 root_pass_clipped,
530 1.f); 534 1.f);
531 535
532 scoped_ptr<RenderPassDrawQuad> render_pass_quad = 536 scoped_ptr<RenderPassDrawQuad> render_pass_quad =
533 RenderPassDrawQuad::Create(); 537 RenderPassDrawQuad::Create();
534 render_pass_quad->SetNew( 538 render_pass_quad->SetNew(
535 shared_quad_state, 539 shared_quad_state,
536 gfx::Rect(5, 5, 7, 7), // rect 540 gfx::Rect(5, 5, 7, 7), // rect
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 DelegatedRendererLayerImpl::Create(host_impl_->activeTree(), 2); 856 DelegatedRendererLayerImpl::Create(host_impl_->activeTree(), 2);
853 scoped_ptr<LayerImpl> clip_layer = 857 scoped_ptr<LayerImpl> clip_layer =
854 LayerImpl::create(host_impl_->activeTree(), 3); 858 LayerImpl::create(host_impl_->activeTree(), 3);
855 scoped_ptr<LayerImpl> origin_layer = 859 scoped_ptr<LayerImpl> origin_layer =
856 LayerImpl::create(host_impl_->activeTree(), 4); 860 LayerImpl::create(host_impl_->activeTree(), 4);
857 861
858 host_impl_->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); 862 host_impl_->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
859 root_layer->setBounds(gfx::Size(100, 100)); 863 root_layer->setBounds(gfx::Size(100, 100));
860 864
861 delegated_renderer_layer->setPosition(gfx::Point(20, 20)); 865 delegated_renderer_layer->setPosition(gfx::Point(20, 20));
862 delegated_renderer_layer->setBounds(gfx::Size(50, 50)); 866 delegated_renderer_layer->setBounds(gfx::Size(50, 50));
863 delegated_renderer_layer->setContentBounds(gfx::Size(50, 50)); 867 delegated_renderer_layer->setContentBounds(gfx::Size(50, 50));
864 delegated_renderer_layer->setDrawsContent(true); 868 delegated_renderer_layer->setDrawsContent(true);
865 869
866 ScopedPtrVector<RenderPass> delegated_render_passes; 870 ScopedPtrVector<RenderPass> delegated_render_passes;
867 871
872 gfx::Size child_pass_content_bounds(7, 7);
868 gfx::Rect child_pass_rect(20, 20, 7, 7); 873 gfx::Rect child_pass_rect(20, 20, 7, 7);
869 gfx::Transform child_pass_transform; 874 gfx::Transform child_pass_transform;
870 gfx::Rect child_pass_clip_rect(21, 21, 3, 3); 875 gfx::Rect child_pass_clip_rect(21, 21, 3, 3);
871 bool child_pass_clipped = false; 876 bool child_pass_clipped = false;
872 877
873 { 878 {
874 TestRenderPass* pass = addRenderPass( 879 TestRenderPass* pass = addRenderPass(
875 delegated_render_passes, 880 delegated_render_passes,
876 RenderPass::Id(10, 7), 881 RenderPass::Id(10, 7),
877 child_pass_rect, 882 child_pass_rect,
878 gfx::Transform()); 883 gfx::Transform());
879 MockQuadCuller quad_sink(pass->quad_list, pass->shared_quad_state_list); 884 MockQuadCuller quad_sink(pass->quad_list, pass->shared_quad_state_list);
880 AppendQuadsData data(pass->id); 885 AppendQuadsData data(pass->id);
881 SharedQuadState* shared_quad_state = 886 SharedQuadState* shared_quad_state =
882 quad_sink.useSharedQuadState(SharedQuadState::Create()); 887 quad_sink.useSharedQuadState(SharedQuadState::Create());
883 shared_quad_state->SetAll( 888 shared_quad_state->SetAll(
884 child_pass_transform, 889 child_pass_transform,
890 child_pass_content_bounds,
885 child_pass_rect, 891 child_pass_rect,
886 child_pass_clip_rect, 892 child_pass_clip_rect,
887 child_pass_clipped, 893 child_pass_clipped,
888 1.f); 894 1.f);
889 895
890 scoped_ptr<SolidColorDrawQuad> color_quad; 896 scoped_ptr<SolidColorDrawQuad> color_quad;
891 color_quad = SolidColorDrawQuad::Create(); 897 color_quad = SolidColorDrawQuad::Create();
892 color_quad->SetNew(shared_quad_state, gfx::Rect(20, 20, 3, 7), 1u); 898 color_quad->SetNew(shared_quad_state, gfx::Rect(20, 20, 3, 7), 1u);
893 quad_sink.append(color_quad.PassAs<DrawQuad>(), data); 899 quad_sink.append(color_quad.PassAs<DrawQuad>(), data);
894 900
895 color_quad = SolidColorDrawQuad::Create(); 901 color_quad = SolidColorDrawQuad::Create();
896 color_quad->SetNew(shared_quad_state, gfx::Rect(23, 20, 4, 7), 1u); 902 color_quad->SetNew(shared_quad_state, gfx::Rect(23, 20, 4, 7), 1u);
897 quad_sink.append(color_quad.PassAs<DrawQuad>(), data); 903 quad_sink.append(color_quad.PassAs<DrawQuad>(), data);
898 } 904 }
899 905
906 gfx::Size root_pass_content_bounds(50, 50);
900 gfx::Rect root_pass_rect(0, 0, 50, 50); 907 gfx::Rect root_pass_rect(0, 0, 50, 50);
901 gfx::Transform root_pass_transform; 908 gfx::Transform root_pass_transform;
902 gfx::Rect root_pass_clip_rect(5, 5, 40, 40); 909 gfx::Rect root_pass_clip_rect(5, 5, 40, 40);
903 bool root_pass_clipped = root_delegated_render_pass_is_clipped_; 910 bool root_pass_clipped = root_delegated_render_pass_is_clipped_;
904 911
905 TestRenderPass* pass = addRenderPass( 912 TestRenderPass* pass = addRenderPass(
906 delegated_render_passes, 913 delegated_render_passes,
907 RenderPass::Id(9, 6), 914 RenderPass::Id(9, 6),
908 root_pass_rect, 915 root_pass_rect,
909 gfx::Transform()); 916 gfx::Transform());
910 MockQuadCuller quad_sink(pass->quad_list, pass->shared_quad_state_list); 917 MockQuadCuller quad_sink(pass->quad_list, pass->shared_quad_state_list);
911 AppendQuadsData data(pass->id); 918 AppendQuadsData data(pass->id);
912 SharedQuadState* shared_quad_state = 919 SharedQuadState* shared_quad_state =
913 quad_sink.useSharedQuadState(SharedQuadState::Create()); 920 quad_sink.useSharedQuadState(SharedQuadState::Create());
914 shared_quad_state->SetAll(root_pass_transform, root_pass_rect, root_pass_cli p_rect, root_pass_clipped, 1); 921 shared_quad_state->SetAll(root_pass_transform,
922 root_pass_content_bounds,
923 root_pass_rect,
924 root_pass_clip_rect,
925 root_pass_clipped,
926 1.f);
915 927
916 scoped_ptr<RenderPassDrawQuad> render_pass_quad = 928 scoped_ptr<RenderPassDrawQuad> render_pass_quad =
917 RenderPassDrawQuad::Create(); 929 RenderPassDrawQuad::Create();
918 render_pass_quad->SetNew( 930 render_pass_quad->SetNew(
919 shared_quad_state, 931 shared_quad_state,
920 gfx::Rect(5, 5, 7, 7), // rect 932 gfx::Rect(5, 5, 7, 7), // rect
921 RenderPass::Id(10, 7), // render_pass_id 933 RenderPass::Id(10, 7), // render_pass_id
922 false, // is_replica 934 false, // is_replica
923 0, // mask_resource_id 935 0, // mask_resource_id
924 child_pass_rect, // contents_changed_since_last_frame 936 child_pass_rect, // contents_changed_since_last_frame
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 root_delegated_shared_quad_state->clip_rect.ToString()); 1238 root_delegated_shared_quad_state->clip_rect.ToString());
1227 // Quads came with a clip rect. 1239 // Quads came with a clip rect.
1228 EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped); 1240 EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped);
1229 1241
1230 host_impl_->drawLayers(frame); 1242 host_impl_->drawLayers(frame);
1231 host_impl_->didDrawAllLayers(frame); 1243 host_impl_->didDrawAllLayers(frame);
1232 } 1244 }
1233 1245
1234 } // namespace 1246 } // namespace
1235 } // namespace cc 1247 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/draw_quad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698