| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/common/cc_messages.h" | 5 #include "content/common/cc_messages.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 EXPECT_EQ(a->has_transparent_background, b->has_transparent_background); | 48 EXPECT_EQ(a->has_transparent_background, b->has_transparent_background); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void Compare(const SharedQuadState* a, const SharedQuadState* b) { | 51 void Compare(const SharedQuadState* a, const SharedQuadState* b) { |
| 52 EXPECT_EQ(a->content_to_target_transform, b->content_to_target_transform); | 52 EXPECT_EQ(a->content_to_target_transform, b->content_to_target_transform); |
| 53 EXPECT_EQ(a->content_bounds, b->content_bounds); | 53 EXPECT_EQ(a->content_bounds, b->content_bounds); |
| 54 EXPECT_EQ(a->visible_content_rect, b->visible_content_rect); | 54 EXPECT_EQ(a->visible_content_rect, b->visible_content_rect); |
| 55 EXPECT_EQ(a->clip_rect, b->clip_rect); | 55 EXPECT_EQ(a->clip_rect, b->clip_rect); |
| 56 EXPECT_EQ(a->is_clipped, b->is_clipped); | 56 EXPECT_EQ(a->is_clipped, b->is_clipped); |
| 57 EXPECT_EQ(a->opacity, b->opacity); | 57 EXPECT_EQ(a->opacity, b->opacity); |
| 58 EXPECT_EQ(a->blend_mode, b->blend_mode); |
| 58 } | 59 } |
| 59 | 60 |
| 60 void Compare(const DrawQuad* a, const DrawQuad* b) { | 61 void Compare(const DrawQuad* a, const DrawQuad* b) { |
| 61 ASSERT_NE(DrawQuad::INVALID, a->material); | 62 ASSERT_NE(DrawQuad::INVALID, a->material); |
| 62 ASSERT_EQ(a->material, b->material); | 63 ASSERT_EQ(a->material, b->material); |
| 63 EXPECT_EQ(a->rect.ToString(), b->rect.ToString()); | 64 EXPECT_EQ(a->rect.ToString(), b->rect.ToString()); |
| 64 EXPECT_EQ(a->opaque_rect.ToString(), b->opaque_rect.ToString()); | 65 EXPECT_EQ(a->opaque_rect.ToString(), b->opaque_rect.ToString()); |
| 65 EXPECT_EQ(a->visible_rect.ToString(), b->visible_rect.ToString()); | 66 EXPECT_EQ(a->visible_rect.ToString(), b->visible_rect.ToString()); |
| 66 EXPECT_EQ(a->needs_blending, b->needs_blending); | 67 EXPECT_EQ(a->needs_blending, b->needs_blending); |
| 67 | 68 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 gfx::PointF arbitrary_pointf2(26.5f, -35.8f); | 224 gfx::PointF arbitrary_pointf2(26.5f, -35.8f); |
| 224 float arbitrary_float1 = 0.7f; | 225 float arbitrary_float1 = 0.7f; |
| 225 float arbitrary_float2 = 0.3f; | 226 float arbitrary_float2 = 0.3f; |
| 226 float arbitrary_float3 = 0.9f; | 227 float arbitrary_float3 = 0.9f; |
| 227 float arbitrary_float_array[4] = {3.5f, 6.2f, 9.3f, 12.3f}; | 228 float arbitrary_float_array[4] = {3.5f, 6.2f, 9.3f, 12.3f}; |
| 228 bool arbitrary_bool1 = true; | 229 bool arbitrary_bool1 = true; |
| 229 bool arbitrary_bool2 = false; | 230 bool arbitrary_bool2 = false; |
| 230 bool arbitrary_bool3 = true; | 231 bool arbitrary_bool3 = true; |
| 231 int arbitrary_int = 5; | 232 int arbitrary_int = 5; |
| 232 SkColor arbitrary_color = SkColorSetARGB(25, 36, 47, 58); | 233 SkColor arbitrary_color = SkColorSetARGB(25, 36, 47, 58); |
| 234 SkXfermode::Mode arbitrary_blend_mode1 = SkXfermode::kScreen_Mode; |
| 235 SkXfermode::Mode arbitrary_blend_mode2 = SkXfermode::kLighten_Mode; |
| 236 SkXfermode::Mode arbitrary_blend_mode3 = SkXfermode::kOverlay_Mode; |
| 233 IOSurfaceDrawQuad::Orientation arbitrary_orientation = | 237 IOSurfaceDrawQuad::Orientation arbitrary_orientation = |
| 234 IOSurfaceDrawQuad::UNFLIPPED; | 238 IOSurfaceDrawQuad::UNFLIPPED; |
| 235 RenderPass::Id arbitrary_id(10, 14); | 239 RenderPass::Id arbitrary_id(10, 14); |
| 236 ResourceProvider::ResourceId arbitrary_resourceid1 = 55; | 240 ResourceProvider::ResourceId arbitrary_resourceid1 = 55; |
| 237 ResourceProvider::ResourceId arbitrary_resourceid2 = 47; | 241 ResourceProvider::ResourceId arbitrary_resourceid2 = 47; |
| 238 ResourceProvider::ResourceId arbitrary_resourceid3 = 23; | 242 ResourceProvider::ResourceId arbitrary_resourceid3 = 23; |
| 239 ResourceProvider::ResourceId arbitrary_resourceid4 = 16; | 243 ResourceProvider::ResourceId arbitrary_resourceid4 = 16; |
| 240 SkScalar arbitrary_sigma = SkFloatToScalar(2.0f); | 244 SkScalar arbitrary_sigma = SkFloatToScalar(2.0f); |
| 241 | 245 |
| 242 FilterOperations arbitrary_filters1; | 246 FilterOperations arbitrary_filters1; |
| 243 arbitrary_filters1.Append(FilterOperation::CreateGrayscaleFilter( | 247 arbitrary_filters1.Append(FilterOperation::CreateGrayscaleFilter( |
| 244 arbitrary_float1)); | 248 arbitrary_float1)); |
| 245 skia::RefPtr<SkImageFilter> arbitrary_filter = skia::AdoptRef( | 249 skia::RefPtr<SkImageFilter> arbitrary_filter = skia::AdoptRef( |
| 246 new SkBlurImageFilter(arbitrary_sigma, arbitrary_sigma)); | 250 new SkBlurImageFilter(arbitrary_sigma, arbitrary_sigma)); |
| 247 arbitrary_filters1.Append( | 251 arbitrary_filters1.Append( |
| 248 cc::FilterOperation::CreateReferenceFilter(arbitrary_filter)); | 252 cc::FilterOperation::CreateReferenceFilter(arbitrary_filter)); |
| 249 | 253 |
| 250 FilterOperations arbitrary_filters2; | 254 FilterOperations arbitrary_filters2; |
| 251 arbitrary_filters2.Append(FilterOperation::CreateBrightnessFilter( | 255 arbitrary_filters2.Append(FilterOperation::CreateBrightnessFilter( |
| 252 arbitrary_float2)); | 256 arbitrary_float2)); |
| 253 | 257 |
| 254 scoped_ptr<SharedQuadState> shared_state1_in = SharedQuadState::Create(); | 258 scoped_ptr<SharedQuadState> shared_state1_in = SharedQuadState::Create(); |
| 255 shared_state1_in->SetAll(arbitrary_matrix, | 259 shared_state1_in->SetAll(arbitrary_matrix, |
| 256 arbitrary_size1, | 260 arbitrary_size1, |
| 257 arbitrary_rect1, | 261 arbitrary_rect1, |
| 258 arbitrary_rect2, | 262 arbitrary_rect2, |
| 259 arbitrary_bool1, | 263 arbitrary_bool1, |
| 260 arbitrary_float1); | 264 arbitrary_float1, |
| 265 arbitrary_blend_mode1); |
| 261 scoped_ptr<SharedQuadState> shared_state1_cmp = shared_state1_in->Copy(); | 266 scoped_ptr<SharedQuadState> shared_state1_cmp = shared_state1_in->Copy(); |
| 262 | 267 |
| 263 scoped_ptr<CheckerboardDrawQuad> checkerboard_in = | 268 scoped_ptr<CheckerboardDrawQuad> checkerboard_in = |
| 264 CheckerboardDrawQuad::Create(); | 269 CheckerboardDrawQuad::Create(); |
| 265 checkerboard_in->SetAll(shared_state1_in.get(), | 270 checkerboard_in->SetAll(shared_state1_in.get(), |
| 266 arbitrary_rect1, | 271 arbitrary_rect1, |
| 267 arbitrary_rect2_inside_rect1, | 272 arbitrary_rect2_inside_rect1, |
| 268 arbitrary_rect1_inside_rect1, | 273 arbitrary_rect1_inside_rect1, |
| 269 arbitrary_bool1, | 274 arbitrary_bool1, |
| 270 arbitrary_color); | 275 arbitrary_color); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 arbitrary_filters2); | 317 arbitrary_filters2); |
| 313 scoped_ptr<RenderPassDrawQuad> renderpass_cmp = renderpass_in->Copy( | 318 scoped_ptr<RenderPassDrawQuad> renderpass_cmp = renderpass_in->Copy( |
| 314 renderpass_in->shared_quad_state, renderpass_in->render_pass_id); | 319 renderpass_in->shared_quad_state, renderpass_in->render_pass_id); |
| 315 | 320 |
| 316 scoped_ptr<SharedQuadState> shared_state2_in = SharedQuadState::Create(); | 321 scoped_ptr<SharedQuadState> shared_state2_in = SharedQuadState::Create(); |
| 317 shared_state2_in->SetAll(arbitrary_matrix, | 322 shared_state2_in->SetAll(arbitrary_matrix, |
| 318 arbitrary_size2, | 323 arbitrary_size2, |
| 319 arbitrary_rect2, | 324 arbitrary_rect2, |
| 320 arbitrary_rect3, | 325 arbitrary_rect3, |
| 321 arbitrary_bool1, | 326 arbitrary_bool1, |
| 322 arbitrary_float2); | 327 arbitrary_float2, |
| 328 arbitrary_blend_mode2); |
| 323 scoped_ptr<SharedQuadState> shared_state2_cmp = shared_state2_in->Copy(); | 329 scoped_ptr<SharedQuadState> shared_state2_cmp = shared_state2_in->Copy(); |
| 324 | 330 |
| 325 scoped_ptr<SharedQuadState> shared_state3_in = SharedQuadState::Create(); | 331 scoped_ptr<SharedQuadState> shared_state3_in = SharedQuadState::Create(); |
| 326 shared_state3_in->SetAll(arbitrary_matrix, | 332 shared_state3_in->SetAll(arbitrary_matrix, |
| 327 arbitrary_size3, | 333 arbitrary_size3, |
| 328 arbitrary_rect3, | 334 arbitrary_rect3, |
| 329 arbitrary_rect1, | 335 arbitrary_rect1, |
| 330 arbitrary_bool1, | 336 arbitrary_bool1, |
| 331 arbitrary_float3); | 337 arbitrary_float3, |
| 338 arbitrary_blend_mode3); |
| 332 scoped_ptr<SharedQuadState> shared_state3_cmp = shared_state3_in->Copy(); | 339 scoped_ptr<SharedQuadState> shared_state3_cmp = shared_state3_in->Copy(); |
| 333 | 340 |
| 334 scoped_ptr<SolidColorDrawQuad> solidcolor_in = | 341 scoped_ptr<SolidColorDrawQuad> solidcolor_in = |
| 335 SolidColorDrawQuad::Create(); | 342 SolidColorDrawQuad::Create(); |
| 336 solidcolor_in->SetAll(shared_state1_in.get(), | 343 solidcolor_in->SetAll(shared_state1_in.get(), |
| 337 arbitrary_rect3, | 344 arbitrary_rect3, |
| 338 arbitrary_rect1_inside_rect3, | 345 arbitrary_rect1_inside_rect3, |
| 339 arbitrary_rect2_inside_rect3, | 346 arbitrary_rect2_inside_rect3, |
| 340 arbitrary_bool1, | 347 arbitrary_bool1, |
| 341 arbitrary_color, | 348 arbitrary_color, |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 } | 602 } |
| 596 | 603 |
| 597 // Verify the largest DrawQuad type is RenderPassDrawQuad. If this ever | 604 // Verify the largest DrawQuad type is RenderPassDrawQuad. If this ever |
| 598 // changes, then the ReserveSizeForRenderPassWrite() method needs to be | 605 // changes, then the ReserveSizeForRenderPassWrite() method needs to be |
| 599 // updated as well to use the new largest quad. | 606 // updated as well to use the new largest quad. |
| 600 EXPECT_EQ(sizeof(RenderPassDrawQuad), largest); | 607 EXPECT_EQ(sizeof(RenderPassDrawQuad), largest); |
| 601 } | 608 } |
| 602 | 609 |
| 603 } // namespace | 610 } // namespace |
| 604 } // namespace content | 611 } // namespace content |
| OLD | NEW |