| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 #include "cc/layers/content_layer_client.h" | 6 #include "cc/layers/content_layer_client.h" |
| 7 #include "cc/layers/picture_image_layer.h" | 7 #include "cc/layers/picture_image_layer.h" |
| 8 #include "cc/layers/picture_layer.h" | 8 #include "cc/layers/picture_layer.h" |
| 9 #include "cc/layers/solid_color_layer.h" | 9 #include "cc/layers/solid_color_layer.h" |
| 10 #include "cc/playback/display_item_list_settings.h" | 10 #include "cc/playback/display_item_list_settings.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 inset_rect.Inset(3, 3, 2, 2); | 51 inset_rect.Inset(3, 3, 2, 2); |
| 52 canvas->drawRect( | 52 canvas->drawRect( |
| 53 SkRect::MakeXYWH(inset_rect.x(), inset_rect.y(), | 53 SkRect::MakeXYWH(inset_rect.x(), inset_rect.y(), |
| 54 inset_rect.width(), inset_rect.height()), | 54 inset_rect.width(), inset_rect.height()), |
| 55 paint); | 55 paint); |
| 56 inset_rect.Inset(3, 3, 2, 2); | 56 inset_rect.Inset(3, 3, 2, 2); |
| 57 } | 57 } |
| 58 | 58 |
| 59 scoped_refptr<DisplayItemList> display_list = | 59 scoped_refptr<DisplayItemList> display_list = |
| 60 DisplayItemList::Create(PaintableRegion(), DisplayItemListSettings()); | 60 DisplayItemList::Create(PaintableRegion(), DisplayItemListSettings()); |
| 61 auto* item = display_list->CreateAndAppendItem<DrawingDisplayItem>( | 61 display_list->CreateAndAppendItem<DrawingDisplayItem>( |
| 62 PaintableRegion()); | 62 PaintableRegion(), skia::AdoptRef(recorder.endRecordingAsPicture())); |
| 63 | |
| 64 skia::RefPtr<SkPicture> picture = | |
| 65 skia::AdoptRef(recorder.endRecordingAsPicture()); | |
| 66 item->SetNew(std::move(picture)); | |
| 67 | 63 |
| 68 display_list->Finalize(); | 64 display_list->Finalize(); |
| 69 return display_list; | 65 return display_list; |
| 70 } | 66 } |
| 71 | 67 |
| 72 private: | 68 private: |
| 73 gfx::Size bounds_; | 69 gfx::Size bounds_; |
| 74 }; | 70 }; |
| 75 | 71 |
| 76 TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayer) { | 72 TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayer) { |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 canvas->drawLine(i, 0, i, bounds_.height(), paint); | 326 canvas->drawLine(i, 0, i, bounds_.height(), paint); |
| 331 } | 327 } |
| 332 } else { | 328 } else { |
| 333 for (int i = 4; i < bounds_.height(); i += 16) { | 329 for (int i = 4; i < bounds_.height(); i += 16) { |
| 334 canvas->drawLine(0, i, bounds_.width(), i, paint); | 330 canvas->drawLine(0, i, bounds_.width(), i, paint); |
| 335 } | 331 } |
| 336 } | 332 } |
| 337 | 333 |
| 338 scoped_refptr<DisplayItemList> display_list = | 334 scoped_refptr<DisplayItemList> display_list = |
| 339 DisplayItemList::Create(PaintableRegion(), DisplayItemListSettings()); | 335 DisplayItemList::Create(PaintableRegion(), DisplayItemListSettings()); |
| 340 auto* item = display_list->CreateAndAppendItem<DrawingDisplayItem>( | 336 display_list->CreateAndAppendItem<DrawingDisplayItem>( |
| 341 PaintableRegion()); | 337 PaintableRegion(), skia::AdoptRef(recorder.endRecordingAsPicture())); |
| 342 | |
| 343 skia::RefPtr<SkPicture> picture = | |
| 344 skia::AdoptRef(recorder.endRecordingAsPicture()); | |
| 345 item->SetNew(std::move(picture)); | |
| 346 | 338 |
| 347 display_list->Finalize(); | 339 display_list->Finalize(); |
| 348 return display_list; | 340 return display_list; |
| 349 } | 341 } |
| 350 | 342 |
| 351 private: | 343 private: |
| 352 gfx::Size bounds_; | 344 gfx::Size bounds_; |
| 353 SkColor color_; | 345 SkColor color_; |
| 354 bool vertical_; | 346 bool vertical_; |
| 355 }; | 347 }; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 372 paint.setStyle(SkPaint::kFill_Style); | 364 paint.setStyle(SkPaint::kFill_Style); |
| 373 paint.setColor(SK_ColorWHITE); | 365 paint.setColor(SK_ColorWHITE); |
| 374 canvas->clear(SK_ColorTRANSPARENT); | 366 canvas->clear(SK_ColorTRANSPARENT); |
| 375 canvas->drawCircle(bounds_.width() / 2, | 367 canvas->drawCircle(bounds_.width() / 2, |
| 376 bounds_.height() / 2, | 368 bounds_.height() / 2, |
| 377 bounds_.width() / 4, | 369 bounds_.width() / 4, |
| 378 paint); | 370 paint); |
| 379 | 371 |
| 380 scoped_refptr<DisplayItemList> display_list = | 372 scoped_refptr<DisplayItemList> display_list = |
| 381 DisplayItemList::Create(PaintableRegion(), DisplayItemListSettings()); | 373 DisplayItemList::Create(PaintableRegion(), DisplayItemListSettings()); |
| 382 auto* item = display_list->CreateAndAppendItem<DrawingDisplayItem>( | 374 display_list->CreateAndAppendItem<DrawingDisplayItem>( |
| 383 PaintableRegion()); | 375 PaintableRegion(), skia::AdoptRef(recorder.endRecordingAsPicture())); |
| 384 skia::RefPtr<SkPicture> picture = | |
| 385 skia::AdoptRef(recorder.endRecordingAsPicture()); | |
| 386 item->SetNew(std::move(picture)); | |
| 387 | 376 |
| 388 display_list->Finalize(); | 377 display_list->Finalize(); |
| 389 return display_list; | 378 return display_list; |
| 390 } | 379 } |
| 391 | 380 |
| 392 private: | 381 private: |
| 393 gfx::Size bounds_; | 382 gfx::Size bounds_; |
| 394 }; | 383 }; |
| 395 | 384 |
| 396 using LayerTreeHostMasksForBackgroundFiltersPixelTest = | 385 using LayerTreeHostMasksForBackgroundFiltersPixelTest = |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 | 493 |
| 505 RunPixelResourceTest(background, | 494 RunPixelResourceTest(background, |
| 506 base::FilePath( | 495 base::FilePath( |
| 507 FILE_PATH_LITERAL("mask_of_layer_with_blend.png"))); | 496 FILE_PATH_LITERAL("mask_of_layer_with_blend.png"))); |
| 508 } | 497 } |
| 509 | 498 |
| 510 } // namespace | 499 } // namespace |
| 511 } // namespace cc | 500 } // namespace cc |
| 512 | 501 |
| 513 #endif // !defined(OS_ANDROID) | 502 #endif // !defined(OS_ANDROID) |
| OLD | NEW |