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

Side by Side Diff: cc/draw_quad_unittest.cc

Issue 11366199: Avoid redundantly setting tex parameters (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removes now-dead textureFilter code, tests that we don't call texParameteri during draw Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/gl_renderer.cc » ('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/draw_quad.h" 5 #include "cc/draw_quad.h"
6 6
7 #include "cc/checkerboard_draw_quad.h" 7 #include "cc/checkerboard_draw_quad.h"
8 #include "cc/debug_border_draw_quad.h" 8 #include "cc/debug_border_draw_quad.h"
9 #include "cc/io_surface_draw_quad.h" 9 #include "cc/io_surface_draw_quad.h"
10 #include "cc/render_pass_draw_quad.h" 10 #include "cc/render_pass_draw_quad.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 #define CREATE_QUAD_8_1(Type, a, b, c, d, e, f, g, h, copyA) \ 143 #define CREATE_QUAD_8_1(Type, a, b, c, d, e, f, g, h, copyA) \
144 QUAD_DATA \ 144 QUAD_DATA \
145 scoped_ptr<Type> quad(Type::create(sharedState.get(), quadRect, a, b, c, d, e, f, g, h)); \ 145 scoped_ptr<Type> quad(Type::create(sharedState.get(), quadRect, a, b, c, d, e, f, g, h)); \
146 SETUP_AND_COPY_QUAD_1(Type, quad, copyA); 146 SETUP_AND_COPY_QUAD_1(Type, quad, copyA);
147 147
148 #define CREATE_QUAD_9(Type, a, b, c, d, e, f, g, h, i) \ 148 #define CREATE_QUAD_9(Type, a, b, c, d, e, f, g, h, i) \
149 QUAD_DATA \ 149 QUAD_DATA \
150 scoped_ptr<Type> quad(Type::create(sharedState.get(), quadRect, a, b, c, d, e, f, g, h, i)); \ 150 scoped_ptr<Type> quad(Type::create(sharedState.get(), quadRect, a, b, c, d, e, f, g, h, i)); \
151 SETUP_AND_COPY_QUAD(Type, quad); 151 SETUP_AND_COPY_QUAD(Type, quad);
152 152
153 #define CREATE_QUAD_10(Type, a, b, c, d, e, f, g, h, i, j) \
154 QUAD_DATA \
155 scoped_ptr<Type> quad(Type::create(sharedState.get(), quadRect, a, b, c, d, e, f, g, h, i, j)); \
156 SETUP_AND_COPY_QUAD(Type, quad);
157
158 TEST(DrawQuadTest, copyCheckerboardDrawQuad) 153 TEST(DrawQuadTest, copyCheckerboardDrawQuad)
159 { 154 {
160 SkColor color = 0xfabb0011; 155 SkColor color = 0xfabb0011;
161 CREATE_SHARED_STATE(); 156 CREATE_SHARED_STATE();
162 CREATE_QUAD_1(CheckerboardDrawQuad, color); 157 CREATE_QUAD_1(CheckerboardDrawQuad, color);
163 EXPECT_EQ(color, copyQuad->color()); 158 EXPECT_EQ(color, copyQuad->color());
164 } 159 }
165 160
166 TEST(DrawQuadTest, copyDebugBorderDrawQuad) 161 TEST(DrawQuadTest, copyDebugBorderDrawQuad)
167 { 162 {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 EXPECT_FLOAT_RECT_EQ(uvRect, copyQuad->uvRect()); 240 EXPECT_FLOAT_RECT_EQ(uvRect, copyQuad->uvRect());
246 EXPECT_EQ(flipped, copyQuad->flipped()); 241 EXPECT_EQ(flipped, copyQuad->flipped());
247 } 242 }
248 243
249 TEST(DrawQuadTest, copyTileDrawQuad) 244 TEST(DrawQuadTest, copyTileDrawQuad)
250 { 245 {
251 gfx::Rect opaqueRect(33, 44, 22, 33); 246 gfx::Rect opaqueRect(33, 44, 22, 33);
252 unsigned resourceId = 104; 247 unsigned resourceId = 104;
253 gfx::Vector2d textureOffset(-31, 47); 248 gfx::Vector2d textureOffset(-31, 47);
254 gfx::Size textureSize(85, 32); 249 gfx::Size textureSize(85, 32);
255 GLint textureFilter = 82;
256 bool swizzleContents = true; 250 bool swizzleContents = true;
257 bool leftEdgeAA = true; 251 bool leftEdgeAA = true;
258 bool topEdgeAA = true; 252 bool topEdgeAA = true;
259 bool rightEdgeAA = false; 253 bool rightEdgeAA = false;
260 bool bottomEdgeAA = true; 254 bool bottomEdgeAA = true;
261 255
262 CREATE_SHARED_STATE(); 256 CREATE_SHARED_STATE();
263 CREATE_QUAD_10(TileDrawQuad, opaqueRect, resourceId, textureOffset, textureS ize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomE dgeAA); 257 CREATE_QUAD_9(TileDrawQuad, opaqueRect, resourceId, textureOffset, textureSi ze, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA);
264 EXPECT_RECT_EQ(opaqueRect, copyQuad->opaqueRect()); 258 EXPECT_RECT_EQ(opaqueRect, copyQuad->opaqueRect());
265 EXPECT_EQ(resourceId, copyQuad->resourceId()); 259 EXPECT_EQ(resourceId, copyQuad->resourceId());
266 EXPECT_EQ(textureOffset, copyQuad->textureOffset()); 260 EXPECT_EQ(textureOffset, copyQuad->textureOffset());
267 EXPECT_EQ(textureSize, copyQuad->textureSize()); 261 EXPECT_EQ(textureSize, copyQuad->textureSize());
268 EXPECT_EQ(textureFilter, copyQuad->textureFilter());
269 EXPECT_EQ(swizzleContents, copyQuad->swizzleContents()); 262 EXPECT_EQ(swizzleContents, copyQuad->swizzleContents());
270 EXPECT_EQ(leftEdgeAA, copyQuad->leftEdgeAA()); 263 EXPECT_EQ(leftEdgeAA, copyQuad->leftEdgeAA());
271 EXPECT_EQ(topEdgeAA, copyQuad->topEdgeAA()); 264 EXPECT_EQ(topEdgeAA, copyQuad->topEdgeAA());
272 EXPECT_EQ(rightEdgeAA, copyQuad->rightEdgeAA()); 265 EXPECT_EQ(rightEdgeAA, copyQuad->rightEdgeAA());
273 EXPECT_EQ(bottomEdgeAA, copyQuad->bottomEdgeAA()); 266 EXPECT_EQ(bottomEdgeAA, copyQuad->bottomEdgeAA());
274 } 267 }
275 268
276 TEST(DrawQuadTest, copyYUVVideoDrawQuad) 269 TEST(DrawQuadTest, copyYUVVideoDrawQuad)
277 { 270 {
278 gfx::SizeF texScale(0.75, 0.5); 271 gfx::SizeF texScale(0.75, 0.5);
(...skipping 19 matching lines...) Expand all
298 EXPECT_EQ(uPlane.resourceId, copyQuad->uPlane().resourceId); 291 EXPECT_EQ(uPlane.resourceId, copyQuad->uPlane().resourceId);
299 EXPECT_EQ(uPlane.size, copyQuad->uPlane().size); 292 EXPECT_EQ(uPlane.size, copyQuad->uPlane().size);
300 EXPECT_EQ(uPlane.format, copyQuad->uPlane().format); 293 EXPECT_EQ(uPlane.format, copyQuad->uPlane().format);
301 EXPECT_EQ(vPlane.resourceId, copyQuad->vPlane().resourceId); 294 EXPECT_EQ(vPlane.resourceId, copyQuad->vPlane().resourceId);
302 EXPECT_EQ(vPlane.size, copyQuad->vPlane().size); 295 EXPECT_EQ(vPlane.size, copyQuad->vPlane().size);
303 EXPECT_EQ(vPlane.format, copyQuad->vPlane().format); 296 EXPECT_EQ(vPlane.format, copyQuad->vPlane().format);
304 } 297 }
305 298
306 } // namespace 299 } // namespace
307 } // namespace cc 300 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/gl_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698