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

Side by Side Diff: cc/quads/draw_quad_unittest.cc

Issue 809433003: cc: Make the PictureLayerImpl raster source null until commit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nullrastersource: . 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
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/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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 } 676 }
677 677
678 TEST(DrawQuadTest, CopyPictureDrawQuad) { 678 TEST(DrawQuadTest, CopyPictureDrawQuad) {
679 gfx::Rect opaque_rect(33, 44, 22, 33); 679 gfx::Rect opaque_rect(33, 44, 22, 33);
680 gfx::Rect visible_rect(40, 50, 30, 20); 680 gfx::Rect visible_rect(40, 50, 30, 20);
681 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); 681 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f);
682 gfx::Size texture_size(85, 32); 682 gfx::Size texture_size(85, 32);
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 = PicturePileImpl::Create(); 686 scoped_refptr<RasterSource> raster_source =
687 FakePicturePileImpl::CreateEmptyPile(gfx::Size(100, 100),
688 gfx::Size(100, 100));
687 CREATE_SHARED_STATE(); 689 CREATE_SHARED_STATE();
688 690
689 CREATE_QUAD_8_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect, 691 CREATE_QUAD_8_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect,
690 texture_size, texture_format, content_rect, contents_scale, 692 texture_size, texture_format, content_rect, contents_scale,
691 raster_source); 693 raster_source);
692 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material); 694 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material);
693 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect); 695 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
694 EXPECT_EQ(visible_rect, copy_quad->visible_rect); 696 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
695 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect); 697 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
696 EXPECT_EQ(texture_size, copy_quad->texture_size); 698 EXPECT_EQ(texture_size, copy_quad->texture_size);
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 922
921 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715 923 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715
922 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) { 924 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) {
923 gfx::Rect opaque_rect(33, 44, 22, 33); 925 gfx::Rect opaque_rect(33, 44, 22, 33);
924 gfx::Rect visible_rect(40, 50, 30, 20); 926 gfx::Rect visible_rect(40, 50, 30, 20);
925 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);
926 gfx::Size texture_size(85, 32); 928 gfx::Size texture_size(85, 32);
927 ResourceFormat texture_format = RGBA_8888; 929 ResourceFormat texture_format = RGBA_8888;
928 gfx::Rect content_rect(30, 40, 20, 30); 930 gfx::Rect content_rect(30, 40, 20, 30);
929 float contents_scale = 3.141592f; 931 float contents_scale = 3.141592f;
930 scoped_refptr<PicturePileImpl> raster_source = PicturePileImpl::Create(); 932 scoped_refptr<RasterSource> raster_source =
933 FakePicturePileImpl::CreateEmptyPile(gfx::Size(100, 100),
934 gfx::Size(100, 100));
931 935
932 CREATE_SHARED_STATE(); 936 CREATE_SHARED_STATE();
933 CREATE_QUAD_8_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect, 937 CREATE_QUAD_8_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect,
934 texture_size, texture_format, content_rect, contents_scale, 938 texture_size, texture_format, content_rect, contents_scale,
935 raster_source); 939 raster_source);
936 EXPECT_EQ(0, IterateAndCount(quad_new)); 940 EXPECT_EQ(0, IterateAndCount(quad_new));
937 } 941 }
938 942
939 TEST(DrawQuadTest, LargestQuadType) { 943 TEST(DrawQuadTest, LargestQuadType) {
940 size_t largest = 0; 944 size_t largest = 0;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); 1026 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad);
1023 break; 1027 break;
1024 case DrawQuad::INVALID: 1028 case DrawQuad::INVALID:
1025 break; 1029 break;
1026 } 1030 }
1027 } 1031 }
1028 } 1032 }
1029 1033
1030 } // namespace 1034 } // namespace
1031 } // namespace cc 1035 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698