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

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

Issue 1271843005: cc: Remove code for drawing checkerboard quads, it's not used. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rm-checkers: sizes Created 5 years, 4 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/shader.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 "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 2919 matching lines...) Expand 10 before | Expand all | Expand 10 after
2930 2930
2931 RenderPassList pass_list; 2931 RenderPassList pass_list;
2932 pass_list.push_back(pass.Pass()); 2932 pass_list.push_back(pass.Pass());
2933 2933
2934 EXPECT_TRUE(this->RunPixelTest( 2934 EXPECT_TRUE(this->RunPixelTest(
2935 &pass_list, 2935 &pass_list,
2936 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")), 2936 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")),
2937 FuzzyPixelOffByOneComparator(true))); 2937 FuzzyPixelOffByOneComparator(true)));
2938 } 2938 }
2939 2939
2940 TYPED_TEST(RendererPixelTest, Checkerboards) {
2941 gfx::Rect rect(this->device_viewport_size_);
2942
2943 RenderPassId id(1, 1);
2944 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect);
2945
2946 SharedQuadState* shared_state =
2947 CreateTestSharedQuadState(gfx::Transform(), rect, pass.get());
2948
2949 // The color's alpha value is not used.
2950 SkColor color1 = SK_ColorGREEN;
2951 color1 = SkColorSetA(color1, 0);
2952 SkColor color2 = SK_ColorBLUE;
2953 color2 = SkColorSetA(color2, 0);
2954
2955 gfx::Rect content_rect(rect);
2956
2957 gfx::Rect top_left(content_rect);
2958 gfx::Rect top_right(content_rect);
2959 gfx::Rect bottom_left(content_rect);
2960 gfx::Rect bottom_right(content_rect);
2961 // The format is Inset(left, top, right, bottom).
2962 top_left.Inset(0, 0, content_rect.width() / 2, content_rect.height() / 2);
2963 top_right.Inset(content_rect.width() / 2, 0, 0, content_rect.height() / 2);
2964 bottom_left.Inset(0, content_rect.height() / 2, content_rect.width() / 2, 0);
2965 bottom_right.Inset(content_rect.width() / 2, content_rect.height() / 2, 0, 0);
2966
2967 // Appends checkerboard quads with a scale of 1.
2968 CheckerboardDrawQuad* quad =
2969 pass->CreateAndAppendDrawQuad<CheckerboardDrawQuad>();
2970 quad->SetNew(shared_state, top_left, top_left, color1, 1.f);
2971 quad = pass->CreateAndAppendDrawQuad<CheckerboardDrawQuad>();
2972 quad->SetNew(shared_state, top_right, top_right, color2, 1.f);
2973 quad = pass->CreateAndAppendDrawQuad<CheckerboardDrawQuad>();
2974 quad->SetNew(shared_state, bottom_left, bottom_left, color2, 1.f);
2975 quad = pass->CreateAndAppendDrawQuad<CheckerboardDrawQuad>();
2976 quad->SetNew(shared_state, bottom_right, bottom_right, color1, 1.f);
2977
2978 RenderPassList pass_list;
2979 pass_list.push_back(pass.Pass());
2980
2981 base::FilePath::StringType path =
2982 IsSoftwareRenderer<TypeParam>()
2983 ? FILE_PATH_LITERAL("four_blue_green_checkers.png")
2984 : FILE_PATH_LITERAL("checkers.png");
2985 EXPECT_TRUE(this->RunPixelTest(&pass_list, base::FilePath(path),
2986 ExactPixelComparator(true)));
2987 }
2988
2989 TYPED_TEST(RendererPixelTest, CheckerboardsScaled) {
2990 gfx::Rect rect(this->device_viewport_size_);
2991
2992 RenderPassId id(1, 1);
2993 scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect);
2994
2995 gfx::Transform scale;
2996 scale.Scale(2.f, 2.f);
2997
2998 SharedQuadState* shared_state =
2999 CreateTestSharedQuadState(scale, rect, pass.get());
3000
3001 // The color's alpha value is not used.
3002 SkColor color1 = SK_ColorGREEN;
3003 color1 = SkColorSetA(color1, 0);
3004 SkColor color2 = SK_ColorBLUE;
3005 color2 = SkColorSetA(color2, 0);
3006
3007 gfx::Rect content_rect(rect);
3008 content_rect.Inset(0, 0, rect.width() / 2, rect.height() / 2);
3009
3010 gfx::Rect top_left(content_rect);
3011 gfx::Rect top_right(content_rect);
3012 gfx::Rect bottom_left(content_rect);
3013 gfx::Rect bottom_right(content_rect);
3014 // The format is Inset(left, top, right, bottom).
3015 top_left.Inset(0, 0, content_rect.width() / 2, content_rect.height() / 2);
3016 top_right.Inset(content_rect.width() / 2, 0, 0, content_rect.height() / 2);
3017 bottom_left.Inset(0, content_rect.height() / 2, content_rect.width() / 2, 0);
3018 bottom_right.Inset(content_rect.width() / 2, content_rect.height() / 2, 0, 0);
3019
3020 // Appends checkerboard quads with a scale of 2, and a shared quad state
3021 // with a scale of 2. The checkers should be scaled by 2 * 2 = 4.
3022 CheckerboardDrawQuad* quad =
3023 pass->CreateAndAppendDrawQuad<CheckerboardDrawQuad>();
3024 quad->SetNew(shared_state, top_left, top_left, color1, 2.f);
3025 quad = pass->CreateAndAppendDrawQuad<CheckerboardDrawQuad>();
3026 quad->SetNew(shared_state, top_right, top_right, color2, 2.f);
3027 quad = pass->CreateAndAppendDrawQuad<CheckerboardDrawQuad>();
3028 quad->SetNew(shared_state, bottom_left, bottom_left, color2, 2.f);
3029 quad = pass->CreateAndAppendDrawQuad<CheckerboardDrawQuad>();
3030 quad->SetNew(shared_state, bottom_right, bottom_right, color1, 2.f);
3031
3032 RenderPassList pass_list;
3033 pass_list.push_back(pass.Pass());
3034
3035 base::FilePath::StringType path =
3036 IsSoftwareRenderer<TypeParam>()
3037 ? FILE_PATH_LITERAL("four_blue_green_checkers.png")
3038 : FILE_PATH_LITERAL("checkers_big.png");
3039 EXPECT_TRUE(this->RunPixelTest(&pass_list, base::FilePath(path),
3040 ExactPixelComparator(true)));
3041 }
3042
3043 #endif // !defined(OS_ANDROID) 2940 #endif // !defined(OS_ANDROID)
3044 2941
3045 } // namespace 2942 } // namespace
3046 } // namespace cc 2943 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/overlay_unittest.cc ('k') | cc/output/shader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698