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

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

Issue 698053002: Choose Largest DrawQuad Type No Longer Depended on Compiler Flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no const needed Created 6 years, 1 month 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/cc.gyp ('k') | cc/quads/largest_draw_quad.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 "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"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 EXPECT_EQ(copy_shared_state, copy->shared_quad_state); 95 EXPECT_EQ(copy_shared_state, copy->shared_quad_state);
96 } 96 }
97 97
98 #define CREATE_SHARED_STATE() \ 98 #define CREATE_SHARED_STATE() \
99 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); \ 99 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); \
100 SharedQuadState* shared_state(CreateSharedQuadState(render_pass.get())); \ 100 SharedQuadState* shared_state(CreateSharedQuadState(render_pass.get())); \
101 SharedQuadState* copy_shared_state = \ 101 SharedQuadState* copy_shared_state = \
102 render_pass->CreateAndAppendSharedQuadState(); \ 102 render_pass->CreateAndAppendSharedQuadState(); \
103 copy_shared_state->CopyFrom(shared_state); 103 copy_shared_state->CopyFrom(shared_state);
104 104
105 #define QUAD_DATA \ 105 #define QUAD_DATA \
106 gfx::Rect quad_rect(30, 40, 50, 60); \ 106 gfx::Rect quad_rect(30, 40, 50, 60); \
107 gfx::Rect quad_visible_rect(40, 50, 30, 20); \ 107 gfx::Rect quad_visible_rect(40, 50, 30, 20); \
108 gfx::Rect quad_opaque_rect( 60, 55, 10, 10); \ 108 gfx::Rect quad_opaque_rect(60, 55, 10, 10); \
109 ALLOW_UNUSED_LOCAL(quad_opaque_rect); \ 109 ALLOW_UNUSED_LOCAL(quad_opaque_rect); \
110 bool needs_blending = true; \ 110 bool needs_blending = true; \
111 ALLOW_UNUSED_LOCAL(needs_blending); 111 ALLOW_UNUSED_LOCAL(needs_blending);
112 112
113 #define SETUP_AND_COPY_QUAD_NEW(Type, quad) \ 113 #define SETUP_AND_COPY_QUAD_NEW(Type, quad) \
114 DrawQuad* copy_new = \ 114 DrawQuad* copy_new = \
115 render_pass->CopyFromAndAppendDrawQuad(quad_new, copy_shared_state); \ 115 render_pass->CopyFromAndAppendDrawQuad(quad_new, copy_shared_state); \
116 CompareDrawQuad(quad_new, copy_new, copy_shared_state); \ 116 CompareDrawQuad(quad_new, copy_new, copy_shared_state); \
117 const Type* copy_quad = Type::MaterialCast(copy_new); \ 117 const Type* copy_quad = Type::MaterialCast(copy_new); \
118 ALLOW_UNUSED_LOCAL(copy_quad); 118 ALLOW_UNUSED_LOCAL(copy_quad);
119 119
120 #define SETUP_AND_COPY_QUAD_ALL(Type, quad) \ 120 #define SETUP_AND_COPY_QUAD_ALL(Type, quad) \
121 DrawQuad* copy_all = \ 121 DrawQuad* copy_all = \
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 case DrawQuad::STREAM_VIDEO_CONTENT: 972 case DrawQuad::STREAM_VIDEO_CONTENT:
973 largest = std::max(largest, sizeof(StreamVideoDrawQuad)); 973 largest = std::max(largest, sizeof(StreamVideoDrawQuad));
974 break; 974 break;
975 case DrawQuad::YUV_VIDEO_CONTENT: 975 case DrawQuad::YUV_VIDEO_CONTENT:
976 largest = std::max(largest, sizeof(YUVVideoDrawQuad)); 976 largest = std::max(largest, sizeof(YUVVideoDrawQuad));
977 break; 977 break;
978 case DrawQuad::INVALID: 978 case DrawQuad::INVALID:
979 break; 979 break;
980 } 980 }
981 } 981 }
982 EXPECT_EQ(sizeof(kLargestDrawQuad), largest); 982 EXPECT_EQ(LargestDrawQuadSize(), largest);
983 983
984 if (!HasFailure()) 984 if (!HasFailure())
985 return; 985 return;
986 986
987 // On failure, output the size of all quads for debugging. 987 // On failure, output the size of all quads for debugging.
988 LOG(ERROR) << "largest " << largest; 988 LOG(ERROR) << "largest " << largest;
989 LOG(ERROR) << "kLargestDrawQuad " << sizeof(kLargestDrawQuad); 989 LOG(ERROR) << "kLargestDrawQuad " << LargestDrawQuadSize();
990 for (int i = 0; i <= DrawQuad::MATERIAL_LAST; ++i) { 990 for (int i = 0; i <= DrawQuad::MATERIAL_LAST; ++i) {
991 switch (static_cast<DrawQuad::Material>(i)) { 991 switch (static_cast<DrawQuad::Material>(i)) {
992 case DrawQuad::CHECKERBOARD: 992 case DrawQuad::CHECKERBOARD:
993 LOG(ERROR) << "CheckerboardDrawQuad " << sizeof(CheckerboardDrawQuad); 993 LOG(ERROR) << "CheckerboardDrawQuad " << sizeof(CheckerboardDrawQuad);
994 break; 994 break;
995 case DrawQuad::DEBUG_BORDER: 995 case DrawQuad::DEBUG_BORDER:
996 LOG(ERROR) << "DebugBorderDrawQuad " << sizeof(DebugBorderDrawQuad); 996 LOG(ERROR) << "DebugBorderDrawQuad " << sizeof(DebugBorderDrawQuad);
997 break; 997 break;
998 case DrawQuad::IO_SURFACE_CONTENT: 998 case DrawQuad::IO_SURFACE_CONTENT:
999 LOG(ERROR) << "IOSurfaceDrawQuad " << sizeof(IOSurfaceDrawQuad); 999 LOG(ERROR) << "IOSurfaceDrawQuad " << sizeof(IOSurfaceDrawQuad);
(...skipping 23 matching lines...) Expand all
1023 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); 1023 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad);
1024 break; 1024 break;
1025 case DrawQuad::INVALID: 1025 case DrawQuad::INVALID:
1026 break; 1026 break;
1027 } 1027 }
1028 } 1028 }
1029 } 1029 }
1030 1030
1031 } // namespace 1031 } // namespace
1032 } // namespace cc 1032 } // namespace cc
OLDNEW
« no previous file with comments | « cc/cc.gyp ('k') | cc/quads/largest_draw_quad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698