| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 paint); | 54 paint); |
| 55 inset_rect.Inset(3, 3, 2, 2); | 55 inset_rect.Inset(3, 3, 2, 2); |
| 56 } | 56 } |
| 57 | 57 |
| 58 scoped_refptr<DisplayItemList> display_list = | 58 scoped_refptr<DisplayItemList> display_list = |
| 59 DisplayItemList::Create(clip, DisplayItemListSettings()); | 59 DisplayItemList::Create(clip, DisplayItemListSettings()); |
| 60 auto* item = display_list->CreateAndAppendItem<DrawingDisplayItem>(); | 60 auto* item = display_list->CreateAndAppendItem<DrawingDisplayItem>(); |
| 61 | 61 |
| 62 skia::RefPtr<SkPicture> picture = | 62 skia::RefPtr<SkPicture> picture = |
| 63 skia::AdoptRef(recorder.endRecordingAsPicture()); | 63 skia::AdoptRef(recorder.endRecordingAsPicture()); |
| 64 item->SetNew(picture.Pass()); | 64 item->SetNew(std::move(picture)); |
| 65 | 65 |
| 66 display_list->Finalize(); | 66 display_list->Finalize(); |
| 67 return display_list; | 67 return display_list; |
| 68 } | 68 } |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 gfx::Size bounds_; | 71 gfx::Size bounds_; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayer) { | 74 TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayer) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 skia::AdoptRef(SkSurface::NewRasterN32Premul(200, 200)); | 108 skia::AdoptRef(SkSurface::NewRasterN32Premul(200, 200)); |
| 109 SkCanvas* canvas = surface->getCanvas(); | 109 SkCanvas* canvas = surface->getCanvas(); |
| 110 canvas->scale(SkIntToScalar(4), SkIntToScalar(4)); | 110 canvas->scale(SkIntToScalar(4), SkIntToScalar(4)); |
| 111 MaskContentLayerClient client(mask_bounds); | 111 MaskContentLayerClient client(mask_bounds); |
| 112 scoped_refptr<DisplayItemList> mask_display_list = | 112 scoped_refptr<DisplayItemList> mask_display_list = |
| 113 client.PaintContentsToDisplayList( | 113 client.PaintContentsToDisplayList( |
| 114 gfx::Rect(mask_bounds), ContentLayerClient::PAINTING_BEHAVIOR_NORMAL); | 114 gfx::Rect(mask_bounds), ContentLayerClient::PAINTING_BEHAVIOR_NORMAL); |
| 115 mask_display_list->Raster(canvas, nullptr, gfx::Rect(mask_bounds), 1.0f); | 115 mask_display_list->Raster(canvas, nullptr, gfx::Rect(mask_bounds), 1.0f); |
| 116 skia::RefPtr<const SkImage> image = | 116 skia::RefPtr<const SkImage> image = |
| 117 skia::AdoptRef(surface->newImageSnapshot()); | 117 skia::AdoptRef(surface->newImageSnapshot()); |
| 118 mask->SetImage(image.Pass()); | 118 mask->SetImage(std::move(image)); |
| 119 | 119 |
| 120 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayerWithBorder( | 120 scoped_refptr<SolidColorLayer> green = CreateSolidColorLayerWithBorder( |
| 121 gfx::Rect(25, 25, 50, 50), kCSSGreen, 1, SK_ColorBLACK); | 121 gfx::Rect(25, 25, 50, 50), kCSSGreen, 1, SK_ColorBLACK); |
| 122 green->SetMaskLayer(mask.get()); | 122 green->SetMaskLayer(mask.get()); |
| 123 background->AddChild(green); | 123 background->AddChild(green); |
| 124 | 124 |
| 125 RunPixelResourceTest( | 125 RunPixelResourceTest( |
| 126 background, base::FilePath(FILE_PATH_LITERAL("image_mask_of_layer.png"))); | 126 background, base::FilePath(FILE_PATH_LITERAL("image_mask_of_layer.png"))); |
| 127 } | 127 } |
| 128 | 128 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 canvas->drawLine(0, i, bounds_.width(), i, paint); | 332 canvas->drawLine(0, i, bounds_.width(), i, paint); |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 | 335 |
| 336 scoped_refptr<DisplayItemList> display_list = | 336 scoped_refptr<DisplayItemList> display_list = |
| 337 DisplayItemList::Create(clip, DisplayItemListSettings()); | 337 DisplayItemList::Create(clip, DisplayItemListSettings()); |
| 338 auto* item = display_list->CreateAndAppendItem<DrawingDisplayItem>(); | 338 auto* item = display_list->CreateAndAppendItem<DrawingDisplayItem>(); |
| 339 | 339 |
| 340 skia::RefPtr<SkPicture> picture = | 340 skia::RefPtr<SkPicture> picture = |
| 341 skia::AdoptRef(recorder.endRecordingAsPicture()); | 341 skia::AdoptRef(recorder.endRecordingAsPicture()); |
| 342 item->SetNew(picture.Pass()); | 342 item->SetNew(std::move(picture)); |
| 343 | 343 |
| 344 display_list->Finalize(); | 344 display_list->Finalize(); |
| 345 return display_list; | 345 return display_list; |
| 346 } | 346 } |
| 347 | 347 |
| 348 private: | 348 private: |
| 349 gfx::Size bounds_; | 349 gfx::Size bounds_; |
| 350 SkColor color_; | 350 SkColor color_; |
| 351 bool vertical_; | 351 bool vertical_; |
| 352 }; | 352 }; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 372 canvas->drawCircle(bounds_.width() / 2, | 372 canvas->drawCircle(bounds_.width() / 2, |
| 373 bounds_.height() / 2, | 373 bounds_.height() / 2, |
| 374 bounds_.width() / 4, | 374 bounds_.width() / 4, |
| 375 paint); | 375 paint); |
| 376 | 376 |
| 377 scoped_refptr<DisplayItemList> display_list = | 377 scoped_refptr<DisplayItemList> display_list = |
| 378 DisplayItemList::Create(clip, DisplayItemListSettings()); | 378 DisplayItemList::Create(clip, DisplayItemListSettings()); |
| 379 auto* item = display_list->CreateAndAppendItem<DrawingDisplayItem>(); | 379 auto* item = display_list->CreateAndAppendItem<DrawingDisplayItem>(); |
| 380 skia::RefPtr<SkPicture> picture = | 380 skia::RefPtr<SkPicture> picture = |
| 381 skia::AdoptRef(recorder.endRecordingAsPicture()); | 381 skia::AdoptRef(recorder.endRecordingAsPicture()); |
| 382 item->SetNew(picture.Pass()); | 382 item->SetNew(std::move(picture)); |
| 383 | 383 |
| 384 display_list->Finalize(); | 384 display_list->Finalize(); |
| 385 return display_list; | 385 return display_list; |
| 386 } | 386 } |
| 387 | 387 |
| 388 private: | 388 private: |
| 389 gfx::Size bounds_; | 389 gfx::Size bounds_; |
| 390 }; | 390 }; |
| 391 | 391 |
| 392 using LayerTreeHostMasksForBackgroundFiltersPixelTest = | 392 using LayerTreeHostMasksForBackgroundFiltersPixelTest = |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 | 500 |
| 501 RunPixelResourceTest(background, | 501 RunPixelResourceTest(background, |
| 502 base::FilePath( | 502 base::FilePath( |
| 503 FILE_PATH_LITERAL("mask_of_layer_with_blend.png"))); | 503 FILE_PATH_LITERAL("mask_of_layer_with_blend.png"))); |
| 504 } | 504 } |
| 505 | 505 |
| 506 } // namespace | 506 } // namespace |
| 507 } // namespace cc | 507 } // namespace cc |
| 508 | 508 |
| 509 #endif // !defined(OS_ANDROID) | 509 #endif // !defined(OS_ANDROID) |
| OLD | NEW |