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

Side by Side Diff: cc/output/renderer_pixeltest.cc

Issue 1314943008: cc: Remove implicit conversions from Rect to RectF in src/cc/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rectfconvert-cc: rebase-and-sandwich-strategy Created 5 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
« no previous file with comments | « cc/output/overlay_unittest.cc ('k') | cc/output/software_renderer.cc » ('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 "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "cc/output/gl_renderer.h" 6 #include "cc/output/gl_renderer.h"
7 #include "cc/quads/draw_quad.h" 7 #include "cc/quads/draw_quad.h"
8 #include "cc/quads/picture_draw_quad.h" 8 #include "cc/quads/picture_draw_quad.h"
9 #include "cc/quads/texture_draw_quad.h" 9 #include "cc/quads/texture_draw_quad.h"
10 #include "cc/resources/video_resource_updater.h" 10 #include "cc/resources/video_resource_updater.h"
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 true, this->back_quad_state_, this->resource_provider_.get(), 742 true, this->back_quad_state_, this->resource_provider_.get(),
743 this->render_pass_.get()); 743 this->render_pass_.get());
744 744
745 SCOPED_TRACE("IntersectingTexturedQuads"); 745 SCOPED_TRACE("IntersectingTexturedQuads");
746 this->template AppendBackgroundAndRunTest<TextureDrawQuad>( 746 this->template AppendBackgroundAndRunTest<TextureDrawQuad>(
747 FuzzyPixelComparator(false, 2.f, 0.f, 256.f, 256, 0.f)); 747 FuzzyPixelComparator(false, 2.f, 0.f, 256.f, 256, 0.f));
748 } 748 }
749 749
750 TYPED_TEST(IntersectingQuadSoftwareTest, PictureQuads) { 750 TYPED_TEST(IntersectingQuadSoftwareTest, PictureQuads) {
751 this->SetupQuadStateAndRenderPass(); 751 this->SetupQuadStateAndRenderPass();
752 gfx::RectF outer_rect(this->quad_rect_); 752 gfx::Rect outer_rect(this->quad_rect_);
753 gfx::RectF inner_rect(this->quad_rect_.x() + (this->quad_rect_.width() / 4), 753 gfx::Rect inner_rect(this->quad_rect_.x() + (this->quad_rect_.width() / 4),
754 this->quad_rect_.y() + (this->quad_rect_.height() / 4), 754 this->quad_rect_.y() + (this->quad_rect_.height() / 4),
755 this->quad_rect_.width() / 2, 755 this->quad_rect_.width() / 2,
756 this->quad_rect_.height() / 2); 756 this->quad_rect_.height() / 2);
757 757
758 SkPaint black_paint; 758 SkPaint black_paint;
759 black_paint.setColor(SK_ColorBLACK); 759 black_paint.setColor(SK_ColorBLACK);
760 SkPaint blue_paint; 760 SkPaint blue_paint;
761 blue_paint.setColor(SK_ColorBLUE); 761 blue_paint.setColor(SK_ColorBLUE);
762 SkPaint green_paint; 762 SkPaint green_paint;
763 green_paint.setColor(SK_ColorGREEN); 763 green_paint.setColor(SK_ColorGREEN);
764 764
765 scoped_ptr<FakePicturePile> blue_recording = 765 scoped_ptr<FakePicturePile> blue_recording =
766 FakePicturePile::CreateFilledPile(gfx::Size(1000, 1000), 766 FakePicturePile::CreateFilledPile(gfx::Size(1000, 1000),
767 this->quad_rect_.size()); 767 this->quad_rect_.size());
768 blue_recording->add_draw_rect_with_paint(outer_rect, black_paint); 768 blue_recording->add_draw_rect_with_paint(outer_rect, black_paint);
769 blue_recording->add_draw_rect_with_paint(inner_rect, blue_paint); 769 blue_recording->add_draw_rect_with_paint(inner_rect, blue_paint);
770 blue_recording->Rerecord(); 770 blue_recording->Rerecord();
771 scoped_refptr<FakePicturePileImpl> blue_pile = 771 scoped_refptr<FakePicturePileImpl> blue_pile =
772 FakePicturePileImpl::CreateFromPile(blue_recording.get(), nullptr); 772 FakePicturePileImpl::CreateFromPile(blue_recording.get(), nullptr);
773 773
774 PictureDrawQuad* blue_quad = 774 PictureDrawQuad* blue_quad =
775 this->render_pass_->template CreateAndAppendDrawQuad<PictureDrawQuad>(); 775 this->render_pass_->template CreateAndAppendDrawQuad<PictureDrawQuad>();
776 776
777 blue_quad->SetNew(this->front_quad_state_, this->quad_rect_, gfx::Rect(), 777 blue_quad->SetNew(this->front_quad_state_, this->quad_rect_, gfx::Rect(),
778 this->quad_rect_, this->quad_rect_, this->quad_rect_.size(), 778 this->quad_rect_, gfx::RectF(this->quad_rect_),
779 false, RGBA_8888, this->quad_rect_, 1.f, blue_pile); 779 this->quad_rect_.size(), false, RGBA_8888, this->quad_rect_,
780 1.f, blue_pile);
780 781
781 scoped_ptr<FakePicturePile> green_recording = 782 scoped_ptr<FakePicturePile> green_recording =
782 FakePicturePile::CreateFilledPile(this->quad_rect_.size(), 783 FakePicturePile::CreateFilledPile(this->quad_rect_.size(),
783 this->quad_rect_.size()); 784 this->quad_rect_.size());
784 green_recording->add_draw_rect_with_paint(outer_rect, green_paint); 785 green_recording->add_draw_rect_with_paint(outer_rect, green_paint);
785 green_recording->add_draw_rect_with_paint(inner_rect, black_paint); 786 green_recording->add_draw_rect_with_paint(inner_rect, black_paint);
786 green_recording->Rerecord(); 787 green_recording->Rerecord();
787 scoped_refptr<FakePicturePileImpl> green_pile = 788 scoped_refptr<FakePicturePileImpl> green_pile =
788 FakePicturePileImpl::CreateFromPile(green_recording.get(), nullptr); 789 FakePicturePileImpl::CreateFromPile(green_recording.get(), nullptr);
789 790
790 PictureDrawQuad* green_quad = 791 PictureDrawQuad* green_quad =
791 this->render_pass_->template CreateAndAppendDrawQuad<PictureDrawQuad>(); 792 this->render_pass_->template CreateAndAppendDrawQuad<PictureDrawQuad>();
792 green_quad->SetNew(this->back_quad_state_, this->quad_rect_, gfx::Rect(), 793 green_quad->SetNew(this->back_quad_state_, this->quad_rect_, gfx::Rect(),
793 this->quad_rect_, this->quad_rect_, 794 this->quad_rect_, gfx::RectF(this->quad_rect_),
794 this->quad_rect_.size(), false, RGBA_8888, 795 this->quad_rect_.size(), false, RGBA_8888,
795 this->quad_rect_, 1.f, green_pile); 796 this->quad_rect_, 1.f, green_pile);
796 SCOPED_TRACE("IntersectingPictureQuadsPass"); 797 SCOPED_TRACE("IntersectingPictureQuadsPass");
797 this->template AppendBackgroundAndRunTest<PictureDrawQuad>( 798 this->template AppendBackgroundAndRunTest<PictureDrawQuad>(
798 FuzzyPixelComparator(false, 2.f, 0.f, 256.f, 256, 0.f)); 799 FuzzyPixelComparator(false, 2.f, 0.f, 256.f, 256, 0.f));
799 } 800 }
800 801
801 TYPED_TEST(IntersectingQuadPixelTest, RenderPassQuads) { 802 TYPED_TEST(IntersectingQuadPixelTest, RenderPassQuads) {
802 this->SetupQuadStateAndRenderPass(); 803 this->SetupQuadStateAndRenderPass();
803 RenderPassId child_pass_id1(2, 2); 804 RenderPassId child_pass_id1(2, 2);
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 red_paint.setColor(SK_ColorRED); 2192 red_paint.setColor(SK_ColorRED);
2192 blue_recording->add_draw_rect_with_paint(blue_rect, red_paint); 2193 blue_recording->add_draw_rect_with_paint(blue_rect, red_paint);
2193 SkPaint blue_paint; 2194 SkPaint blue_paint;
2194 blue_paint.setColor(SK_ColorBLUE); 2195 blue_paint.setColor(SK_ColorBLUE);
2195 blue_recording->add_draw_rect_with_paint(blue_clip_rect, blue_paint); 2196 blue_recording->add_draw_rect_with_paint(blue_clip_rect, blue_paint);
2196 blue_recording->Rerecord(); 2197 blue_recording->Rerecord();
2197 2198
2198 scoped_refptr<FakePicturePileImpl> blue_pile = 2199 scoped_refptr<FakePicturePileImpl> blue_pile =
2199 FakePicturePileImpl::CreateFromPile(blue_recording.get(), nullptr); 2200 FakePicturePileImpl::CreateFromPile(blue_recording.get(), nullptr);
2200 2201
2202 gfx::Vector2d offset(viewport.bottom_right() - blue_rect.bottom_right());
2201 gfx::Transform blue_quad_to_target_transform; 2203 gfx::Transform blue_quad_to_target_transform;
2202 gfx::Vector2d offset(viewport.bottom_right() - blue_rect.bottom_right());
2203 blue_quad_to_target_transform.Translate(offset.x(), offset.y()); 2204 blue_quad_to_target_transform.Translate(offset.x(), offset.y());
2204 gfx::RectF blue_scissor_rect = blue_clip_rect; 2205 gfx::Rect blue_target_clip_rect = MathUtil::MapEnclosingClippedRect(
2205 blue_quad_to_target_transform.TransformRect(&blue_scissor_rect); 2206 blue_quad_to_target_transform, blue_clip_rect);
2206 SharedQuadState* blue_shared_state = CreateTestSharedQuadStateClipped( 2207 SharedQuadState* blue_shared_state =
2207 blue_quad_to_target_transform, blue_rect, 2208 CreateTestSharedQuadStateClipped(blue_quad_to_target_transform, blue_rect,
2208 gfx::ToEnclosingRect(blue_scissor_rect), pass.get()); 2209 blue_target_clip_rect, pass.get());
2209 2210
2210 PictureDrawQuad* blue_quad = pass->CreateAndAppendDrawQuad<PictureDrawQuad>(); 2211 PictureDrawQuad* blue_quad = pass->CreateAndAppendDrawQuad<PictureDrawQuad>();
2211 2212
2212 blue_quad->SetNew(blue_shared_state, 2213 blue_quad->SetNew(blue_shared_state,
2213 viewport, // Intentionally bigger than clip. 2214 viewport, // Intentionally bigger than clip.
2214 gfx::Rect(), viewport, gfx::RectF(viewport), 2215 gfx::Rect(), viewport, gfx::RectF(viewport),
2215 viewport.size(), nearest_neighbor, texture_format, viewport, 2216 viewport.size(), nearest_neighbor, texture_format, viewport,
2216 1.f, blue_pile.get()); 2217 1.f, blue_pile.get());
2217 2218
2218 // One viewport-filling green quad. 2219 // One viewport-filling green quad.
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 gfx::Transform transform_to_root; 2462 gfx::Transform transform_to_root;
2462 scoped_ptr<RenderPass> pass = 2463 scoped_ptr<RenderPass> pass =
2463 CreateTestRenderPass(id, viewport, transform_to_root); 2464 CreateTestRenderPass(id, viewport, transform_to_root);
2464 2465
2465 gfx::Transform quad_to_target_transform; 2466 gfx::Transform quad_to_target_transform;
2466 SharedQuadState* shared_state = 2467 SharedQuadState* shared_state =
2467 CreateTestSharedQuadState(quad_to_target_transform, viewport, pass.get()); 2468 CreateTestSharedQuadState(quad_to_target_transform, viewport, pass.get());
2468 2469
2469 TileDrawQuad* quad = pass->CreateAndAppendDrawQuad<TileDrawQuad>(); 2470 TileDrawQuad* quad = pass->CreateAndAppendDrawQuad<TileDrawQuad>();
2470 quad->SetNew(shared_state, viewport, gfx::Rect(), viewport, resource, 2471 quad->SetNew(shared_state, viewport, gfx::Rect(), viewport, resource,
2471 gfx::Rect(tile_size), tile_size, swizzle_contents, 2472 gfx::RectF(gfx::Rect(tile_size)), tile_size, swizzle_contents,
2472 nearest_neighbor); 2473 nearest_neighbor);
2473 2474
2474 RenderPassList pass_list; 2475 RenderPassList pass_list;
2475 pass_list.push_back(pass.Pass()); 2476 pass_list.push_back(pass.Pass());
2476 2477
2477 EXPECT_TRUE(this->RunPixelTest( 2478 EXPECT_TRUE(this->RunPixelTest(
2478 &pass_list, 2479 &pass_list,
2479 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), 2480 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")),
2480 ExactPixelComparator(true))); 2481 ExactPixelComparator(true)));
2481 } 2482 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
2675 FakePicturePile::CreateFilledPile(pile_tile_size, layer_rect.size()); 2676 FakePicturePile::CreateFilledPile(pile_tile_size, layer_rect.size());
2676 2677
2677 Region outside(layer_rect); 2678 Region outside(layer_rect);
2678 outside.Subtract(gfx::ToEnclosingRect(union_layer_rect)); 2679 outside.Subtract(gfx::ToEnclosingRect(union_layer_rect));
2679 for (Region::Iterator iter(outside); iter.has_rect(); iter.next()) { 2680 for (Region::Iterator iter(outside); iter.has_rect(); iter.next()) {
2680 recording->add_draw_rect_with_paint(iter.rect(), red_paint); 2681 recording->add_draw_rect_with_paint(iter.rect(), red_paint);
2681 } 2682 }
2682 2683
2683 SkPaint blue_paint; 2684 SkPaint blue_paint;
2684 blue_paint.setColor(SK_ColorBLUE); 2685 blue_paint.setColor(SK_ColorBLUE);
2685 recording->add_draw_rect_with_paint(blue_layer_rect1, blue_paint); 2686 recording->add_draw_rectf_with_paint(blue_layer_rect1, blue_paint);
2686 recording->add_draw_rect_with_paint(blue_layer_rect2, blue_paint); 2687 recording->add_draw_rectf_with_paint(blue_layer_rect2, blue_paint);
2687 recording->Rerecord(); 2688 recording->Rerecord();
2688 scoped_refptr<FakePicturePileImpl> pile = 2689 scoped_refptr<FakePicturePileImpl> pile =
2689 FakePicturePileImpl::CreateFromPile(recording.get(), nullptr); 2690 FakePicturePileImpl::CreateFromPile(recording.get(), nullptr);
2690 2691
2691 gfx::Rect content_rect( 2692 gfx::Rect content_rect(
2692 gfx::ScaleToEnclosingRect(layer_rect, contents_scale)); 2693 gfx::ScaleToEnclosingRect(layer_rect, contents_scale));
2693 gfx::Rect content_union_rect( 2694 gfx::Rect content_union_rect(
2694 gfx::ToEnclosingRect(gfx::ScaleRect(union_layer_rect, contents_scale))); 2695 gfx::ToEnclosingRect(gfx::ScaleRect(union_layer_rect, contents_scale)));
2695 2696
2696 // At a scale of 4x the rectangles with a width of 2.5 will take up 10 pixels, 2697 // At a scale of 4x the rectangles with a width of 2.5 will take up 10 pixels,
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
2934 EXPECT_TRUE(this->RunPixelTest( 2935 EXPECT_TRUE(this->RunPixelTest(
2935 &pass_list, 2936 &pass_list,
2936 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")), 2937 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")),
2937 FuzzyPixelOffByOneComparator(true))); 2938 FuzzyPixelOffByOneComparator(true)));
2938 } 2939 }
2939 2940
2940 #endif // !defined(OS_ANDROID) 2941 #endif // !defined(OS_ANDROID)
2941 2942
2942 } // namespace 2943 } // namespace
2943 } // namespace cc 2944 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/overlay_unittest.cc ('k') | cc/output/software_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698