| 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/checkerboard_draw_quad.h" | 13 #include "cc/quads/checkerboard_draw_quad.h" |
| 14 #include "cc/quads/debug_border_draw_quad.h" | 14 #include "cc/quads/debug_border_draw_quad.h" |
| 15 #include "cc/quads/io_surface_draw_quad.h" | 15 #include "cc/quads/io_surface_draw_quad.h" |
| 16 #include "cc/quads/largest_draw_quad.h" | 16 #include "cc/quads/largest_draw_quad.h" |
| 17 #include "cc/quads/picture_draw_quad.h" | 17 #include "cc/quads/picture_draw_quad.h" |
| 18 #include "cc/quads/render_pass.h" | 18 #include "cc/quads/render_pass.h" |
| 19 #include "cc/quads/render_pass_draw_quad.h" | 19 #include "cc/quads/render_pass_draw_quad.h" |
| 20 #include "cc/quads/solid_color_draw_quad.h" | 20 #include "cc/quads/solid_color_draw_quad.h" |
| 21 #include "cc/quads/stream_video_draw_quad.h" | 21 #include "cc/quads/stream_video_draw_quad.h" |
| 22 #include "cc/quads/surface_draw_quad.h" | 22 #include "cc/quads/surface_draw_quad.h" |
| 23 #include "cc/quads/texture_draw_quad.h" | 23 #include "cc/quads/texture_draw_quad.h" |
| 24 #include "cc/quads/tile_draw_quad.h" | 24 #include "cc/quads/tile_draw_quad.h" |
| 25 #include "cc/quads/yuv_video_draw_quad.h" | 25 #include "cc/quads/yuv_video_draw_quad.h" |
| 26 #include "cc/resources/picture_pile_impl.h" | 26 #include "cc/test/fake_picture_pile_impl.h" |
| 27 #include "cc/test/geometry_test_utils.h" | 27 #include "cc/test/geometry_test_utils.h" |
| 28 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
| 29 #include "third_party/skia/include/effects/SkBlurImageFilter.h" | 29 #include "third_party/skia/include/effects/SkBlurImageFilter.h" |
| 30 #include "ui/gfx/transform.h" | 30 #include "ui/gfx/transform.h" |
| 31 | 31 |
| 32 namespace cc { | 32 namespace cc { |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 TEST(DrawQuadTest, CopySharedQuadState) { | 35 TEST(DrawQuadTest, CopySharedQuadState) { |
| 36 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); | 36 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 | 682 |
| 683 TEST(DrawQuadTest, CopyPictureDrawQuad) { | 683 TEST(DrawQuadTest, CopyPictureDrawQuad) { |
| 684 gfx::Rect opaque_rect(33, 44, 22, 33); | 684 gfx::Rect opaque_rect(33, 44, 22, 33); |
| 685 gfx::Rect visible_rect(40, 50, 30, 20); | 685 gfx::Rect visible_rect(40, 50, 30, 20); |
| 686 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 686 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
| 687 gfx::Size texture_size(85, 32); | 687 gfx::Size texture_size(85, 32); |
| 688 bool nearest_neighbor = true; | 688 bool nearest_neighbor = true; |
| 689 ResourceFormat texture_format = RGBA_8888; | 689 ResourceFormat texture_format = RGBA_8888; |
| 690 gfx::Rect content_rect(30, 40, 20, 30); | 690 gfx::Rect content_rect(30, 40, 20, 30); |
| 691 float contents_scale = 3.141592f; | 691 float contents_scale = 3.141592f; |
| 692 scoped_refptr<RasterSource> raster_source = PicturePileImpl::Create(); | 692 scoped_refptr<RasterSource> raster_source = |
| 693 FakePicturePileImpl::CreateEmptyPile(gfx::Size(100, 100), |
| 694 gfx::Size(100, 100)); |
| 693 CREATE_SHARED_STATE(); | 695 CREATE_SHARED_STATE(); |
| 694 | 696 |
| 695 CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect, | 697 CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect, |
| 696 texture_size, nearest_neighbor, texture_format, | 698 texture_size, nearest_neighbor, texture_format, |
| 697 content_rect, contents_scale, raster_source); | 699 content_rect, contents_scale, raster_source); |
| 698 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); | 700 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); |
| 699 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect); | 701 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect); |
| 700 EXPECT_EQ(visible_rect, copy_quad->visible_rect); | 702 EXPECT_EQ(visible_rect, copy_quad->visible_rect); |
| 701 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); | 703 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); |
| 702 EXPECT_EQ(texture_size, copy_quad->texture_size); | 704 EXPECT_EQ(texture_size, copy_quad->texture_size); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715 | 933 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715 |
| 932 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) { | 934 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) { |
| 933 gfx::Rect opaque_rect(33, 44, 22, 33); | 935 gfx::Rect opaque_rect(33, 44, 22, 33); |
| 934 gfx::Rect visible_rect(40, 50, 30, 20); | 936 gfx::Rect visible_rect(40, 50, 30, 20); |
| 935 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 937 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
| 936 gfx::Size texture_size(85, 32); | 938 gfx::Size texture_size(85, 32); |
| 937 bool nearest_neighbor = true; | 939 bool nearest_neighbor = true; |
| 938 ResourceFormat texture_format = RGBA_8888; | 940 ResourceFormat texture_format = RGBA_8888; |
| 939 gfx::Rect content_rect(30, 40, 20, 30); | 941 gfx::Rect content_rect(30, 40, 20, 30); |
| 940 float contents_scale = 3.141592f; | 942 float contents_scale = 3.141592f; |
| 941 scoped_refptr<PicturePileImpl> raster_source = PicturePileImpl::Create(); | 943 scoped_refptr<RasterSource> raster_source = |
| 944 FakePicturePileImpl::CreateEmptyPile(gfx::Size(100, 100), |
| 945 gfx::Size(100, 100)); |
| 942 | 946 |
| 943 CREATE_SHARED_STATE(); | 947 CREATE_SHARED_STATE(); |
| 944 CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect, | 948 CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect, |
| 945 texture_size, nearest_neighbor, texture_format, | 949 texture_size, nearest_neighbor, texture_format, |
| 946 content_rect, contents_scale, raster_source); | 950 content_rect, contents_scale, raster_source); |
| 947 EXPECT_EQ(0, IterateAndCount(quad_new)); | 951 EXPECT_EQ(0, IterateAndCount(quad_new)); |
| 948 } | 952 } |
| 949 | 953 |
| 950 TEST(DrawQuadTest, LargestQuadType) { | 954 TEST(DrawQuadTest, LargestQuadType) { |
| 951 size_t largest = 0; | 955 size_t largest = 0; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); | 1037 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); |
| 1034 break; | 1038 break; |
| 1035 case DrawQuad::INVALID: | 1039 case DrawQuad::INVALID: |
| 1036 break; | 1040 break; |
| 1037 } | 1041 } |
| 1038 } | 1042 } |
| 1039 } | 1043 } |
| 1040 | 1044 |
| 1041 } // namespace | 1045 } // namespace |
| 1042 } // namespace cc | 1046 } // namespace cc |
| OLD | NEW |