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