| 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/quads/draw_quad.h" | 5 #include "cc/quads/draw_quad.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "cc/base/math_util.h" | 11 #include "cc/base/math_util.h" |
| 12 #include "cc/output/filter_operations.h" | 12 #include "cc/output/filter_operations.h" |
| 13 #include "cc/quads/debug_border_draw_quad.h" | 13 #include "cc/quads/debug_border_draw_quad.h" |
| 14 #include "cc/quads/io_surface_draw_quad.h" | 14 #include "cc/quads/io_surface_draw_quad.h" |
| 15 #include "cc/quads/largest_draw_quad.h" | 15 #include "cc/quads/largest_draw_quad.h" |
| 16 #include "cc/quads/picture_draw_quad.h" | 16 #include "cc/quads/picture_draw_quad.h" |
| 17 #include "cc/quads/render_pass.h" | 17 #include "cc/quads/render_pass.h" |
| 18 #include "cc/quads/render_pass_draw_quad.h" | 18 #include "cc/quads/render_pass_draw_quad.h" |
| 19 #include "cc/quads/solid_color_draw_quad.h" | 19 #include "cc/quads/solid_color_draw_quad.h" |
| 20 #include "cc/quads/stream_video_draw_quad.h" | 20 #include "cc/quads/stream_video_draw_quad.h" |
| 21 #include "cc/quads/surface_draw_quad.h" | 21 #include "cc/quads/surface_draw_quad.h" |
| 22 #include "cc/quads/texture_draw_quad.h" | 22 #include "cc/quads/texture_draw_quad.h" |
| 23 #include "cc/quads/tile_draw_quad.h" | 23 #include "cc/quads/tile_draw_quad.h" |
| 24 #include "cc/quads/yuv_video_draw_quad.h" | 24 #include "cc/quads/yuv_video_draw_quad.h" |
| 25 #include "cc/test/fake_picture_pile_impl.h" | 25 #include "cc/test/fake_display_list_raster_source.h" |
| 26 #include "cc/test/geometry_test_utils.h" | 26 #include "cc/test/geometry_test_utils.h" |
| 27 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 28 #include "third_party/skia/include/effects/SkBlurImageFilter.h" | 28 #include "third_party/skia/include/effects/SkBlurImageFilter.h" |
| 29 #include "ui/gfx/transform.h" | 29 #include "ui/gfx/transform.h" |
| 30 | 30 |
| 31 namespace cc { | 31 namespace cc { |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 TEST(DrawQuadTest, CopySharedQuadState) { | 34 TEST(DrawQuadTest, CopySharedQuadState) { |
| 35 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); | 35 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 TEST(DrawQuadTest, CopyPictureDrawQuad) { | 677 TEST(DrawQuadTest, CopyPictureDrawQuad) { |
| 678 gfx::Rect opaque_rect(33, 44, 22, 33); | 678 gfx::Rect opaque_rect(33, 44, 22, 33); |
| 679 gfx::Rect visible_rect(40, 50, 30, 20); | 679 gfx::Rect visible_rect(40, 50, 30, 20); |
| 680 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 680 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
| 681 gfx::Size texture_size(85, 32); | 681 gfx::Size texture_size(85, 32); |
| 682 bool nearest_neighbor = true; | 682 bool nearest_neighbor = true; |
| 683 ResourceFormat texture_format = RGBA_8888; | 683 ResourceFormat texture_format = RGBA_8888; |
| 684 gfx::Rect content_rect(30, 40, 20, 30); | 684 gfx::Rect content_rect(30, 40, 20, 30); |
| 685 float contents_scale = 3.141592f; | 685 float contents_scale = 3.141592f; |
| 686 scoped_refptr<RasterSource> raster_source = | 686 scoped_refptr<RasterSource> raster_source = |
| 687 FakePicturePileImpl::CreateEmptyPile(gfx::Size(100, 100), | 687 FakeDisplayListRasterSource::CreateEmpty(gfx::Size(100, 100)); |
| 688 gfx::Size(100, 100)); | |
| 689 CREATE_SHARED_STATE(); | 688 CREATE_SHARED_STATE(); |
| 690 | 689 |
| 691 CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect, | 690 CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect, |
| 692 texture_size, nearest_neighbor, texture_format, | 691 texture_size, nearest_neighbor, texture_format, |
| 693 content_rect, contents_scale, raster_source); | 692 content_rect, contents_scale, raster_source); |
| 694 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); | 693 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); |
| 695 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect); | 694 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect); |
| 696 EXPECT_EQ(visible_rect, copy_quad->visible_rect); | 695 EXPECT_EQ(visible_rect, copy_quad->visible_rect); |
| 697 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 696 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
| 698 EXPECT_EQ(texture_size, copy_quad->texture_size); | 697 EXPECT_EQ(texture_size, copy_quad->texture_size); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) { | 924 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) { |
| 926 gfx::Rect opaque_rect(33, 44, 22, 33); | 925 gfx::Rect opaque_rect(33, 44, 22, 33); |
| 927 gfx::Rect visible_rect(40, 50, 30, 20); | 926 gfx::Rect visible_rect(40, 50, 30, 20); |
| 928 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 927 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
| 929 gfx::Size texture_size(85, 32); | 928 gfx::Size texture_size(85, 32); |
| 930 bool nearest_neighbor = true; | 929 bool nearest_neighbor = true; |
| 931 ResourceFormat texture_format = RGBA_8888; | 930 ResourceFormat texture_format = RGBA_8888; |
| 932 gfx::Rect content_rect(30, 40, 20, 30); | 931 gfx::Rect content_rect(30, 40, 20, 30); |
| 933 float contents_scale = 3.141592f; | 932 float contents_scale = 3.141592f; |
| 934 scoped_refptr<RasterSource> raster_source = | 933 scoped_refptr<RasterSource> raster_source = |
| 935 FakePicturePileImpl::CreateEmptyPile(gfx::Size(100, 100), | 934 FakeDisplayListRasterSource::CreateEmpty(gfx::Size(100, 100)); |
| 936 gfx::Size(100, 100)); | |
| 937 | 935 |
| 938 CREATE_SHARED_STATE(); | 936 CREATE_SHARED_STATE(); |
| 939 CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect, | 937 CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect, |
| 940 texture_size, nearest_neighbor, texture_format, | 938 texture_size, nearest_neighbor, texture_format, |
| 941 content_rect, contents_scale, raster_source); | 939 content_rect, contents_scale, raster_source); |
| 942 EXPECT_EQ(0, IterateAndCount(quad_new)); | 940 EXPECT_EQ(0, IterateAndCount(quad_new)); |
| 943 } | 941 } |
| 944 | 942 |
| 945 TEST(DrawQuadTest, LargestQuadType) { | 943 TEST(DrawQuadTest, LargestQuadType) { |
| 946 size_t largest = 0; | 944 size_t largest = 0; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); | 1020 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); |
| 1023 break; | 1021 break; |
| 1024 case DrawQuad::INVALID: | 1022 case DrawQuad::INVALID: |
| 1025 break; | 1023 break; |
| 1026 } | 1024 } |
| 1027 } | 1025 } |
| 1028 } | 1026 } |
| 1029 | 1027 |
| 1030 } // namespace | 1028 } // namespace |
| 1031 } // namespace cc | 1029 } // namespace cc |
| OLD | NEW |