| 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/test/layer_tree_pixel_resource_test.h" | 10 #include "cc/test/layer_tree_pixel_resource_test.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 while (!inset_rect.IsEmpty()) { | 39 while (!inset_rect.IsEmpty()) { |
| 40 inset_rect.Inset(3, 3, 2, 2); | 40 inset_rect.Inset(3, 3, 2, 2); |
| 41 canvas->drawRect( | 41 canvas->drawRect( |
| 42 SkRect::MakeXYWH(inset_rect.x(), inset_rect.y(), | 42 SkRect::MakeXYWH(inset_rect.x(), inset_rect.y(), |
| 43 inset_rect.width(), inset_rect.height()), | 43 inset_rect.width(), inset_rect.height()), |
| 44 paint); | 44 paint); |
| 45 inset_rect.Inset(3, 3, 2, 2); | 45 inset_rect.Inset(3, 3, 2, 2); |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 49 void PaintContentsToDisplayList( |
| 50 DisplayItemList* display_list, |
| 50 const gfx::Rect& clip, | 51 const gfx::Rect& clip, |
| 51 PaintingControlSetting picture_control) override { | 52 PaintingControlSetting picture_control) override { |
| 52 NOTIMPLEMENTED(); | 53 NOTIMPLEMENTED(); |
| 53 return DisplayItemList::Create(); | |
| 54 } | 54 } |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 gfx::Size bounds_; | 57 gfx::Size bounds_; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayer) { | 60 TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayer) { |
| 61 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( | 61 scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( |
| 62 gfx::Rect(100, 100), SK_ColorWHITE); | 62 gfx::Rect(100, 100), SK_ColorWHITE); |
| 63 | 63 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 if (vertical_) { | 296 if (vertical_) { |
| 297 for (int i = 4; i < bounds_.width(); i += 16) { | 297 for (int i = 4; i < bounds_.width(); i += 16) { |
| 298 canvas->drawLine(i, 0, i, bounds_.height(), paint); | 298 canvas->drawLine(i, 0, i, bounds_.height(), paint); |
| 299 } | 299 } |
| 300 } else { | 300 } else { |
| 301 for (int i = 4; i < bounds_.height(); i += 16) { | 301 for (int i = 4; i < bounds_.height(); i += 16) { |
| 302 canvas->drawLine(0, i, bounds_.width(), i, paint); | 302 canvas->drawLine(0, i, bounds_.width(), i, paint); |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 306 void PaintContentsToDisplayList( |
| 307 DisplayItemList* display_list, |
| 307 const gfx::Rect& clip, | 308 const gfx::Rect& clip, |
| 308 PaintingControlSetting picture_control) override { | 309 PaintingControlSetting picture_control) override { |
| 309 NOTIMPLEMENTED(); | 310 NOTIMPLEMENTED(); |
| 310 return DisplayItemList::Create(); | |
| 311 } | 311 } |
| 312 | 312 |
| 313 private: | 313 private: |
| 314 gfx::Size bounds_; | 314 gfx::Size bounds_; |
| 315 SkColor color_; | 315 SkColor color_; |
| 316 bool vertical_; | 316 bool vertical_; |
| 317 }; | 317 }; |
| 318 | 318 |
| 319 class CircleContentLayerClient : public ContentLayerClient { | 319 class CircleContentLayerClient : public ContentLayerClient { |
| 320 public: | 320 public: |
| 321 explicit CircleContentLayerClient(const gfx::Size& bounds) | 321 explicit CircleContentLayerClient(const gfx::Size& bounds) |
| 322 : bounds_(bounds) {} | 322 : bounds_(bounds) {} |
| 323 ~CircleContentLayerClient() override {} | 323 ~CircleContentLayerClient() override {} |
| 324 bool FillsBoundsCompletely() const override { return false; } | 324 bool FillsBoundsCompletely() const override { return false; } |
| 325 void PaintContents(SkCanvas* canvas, | 325 void PaintContents(SkCanvas* canvas, |
| 326 const gfx::Rect& rect, | 326 const gfx::Rect& rect, |
| 327 PaintingControlSetting picture_control) override { | 327 PaintingControlSetting picture_control) override { |
| 328 SkPaint paint; | 328 SkPaint paint; |
| 329 paint.setStyle(SkPaint::kFill_Style); | 329 paint.setStyle(SkPaint::kFill_Style); |
| 330 paint.setColor(SK_ColorWHITE); | 330 paint.setColor(SK_ColorWHITE); |
| 331 canvas->clear(SK_ColorTRANSPARENT); | 331 canvas->clear(SK_ColorTRANSPARENT); |
| 332 canvas->drawCircle(bounds_.width() / 2, | 332 canvas->drawCircle(bounds_.width() / 2, |
| 333 bounds_.height() / 2, | 333 bounds_.height() / 2, |
| 334 bounds_.width() / 4, | 334 bounds_.width() / 4, |
| 335 paint); | 335 paint); |
| 336 } | 336 } |
| 337 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 337 void PaintContentsToDisplayList( |
| 338 DisplayItemList* display_list, |
| 338 const gfx::Rect& clip, | 339 const gfx::Rect& clip, |
| 339 PaintingControlSetting picture_control) override { | 340 PaintingControlSetting picture_control) override { |
| 340 NOTIMPLEMENTED(); | 341 NOTIMPLEMENTED(); |
| 341 return DisplayItemList::Create(); | |
| 342 } | 342 } |
| 343 | 343 |
| 344 private: | 344 private: |
| 345 gfx::Size bounds_; | 345 gfx::Size bounds_; |
| 346 }; | 346 }; |
| 347 | 347 |
| 348 using LayerTreeHostMasksForBackgroundFiltersPixelTest = | 348 using LayerTreeHostMasksForBackgroundFiltersPixelTest = |
| 349 ParameterizedPixelResourceTest; | 349 ParameterizedPixelResourceTest; |
| 350 | 350 |
| 351 INSTANTIATE_TEST_CASE_P( | 351 INSTANTIATE_TEST_CASE_P( |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 | 456 |
| 457 RunPixelResourceTest(background, | 457 RunPixelResourceTest(background, |
| 458 base::FilePath( | 458 base::FilePath( |
| 459 FILE_PATH_LITERAL("mask_of_layer_with_blend.png"))); | 459 FILE_PATH_LITERAL("mask_of_layer_with_blend.png"))); |
| 460 } | 460 } |
| 461 | 461 |
| 462 } // namespace | 462 } // namespace |
| 463 } // namespace cc | 463 } // namespace cc |
| 464 | 464 |
| 465 #endif // !defined(OS_ANDROID) | 465 #endif // !defined(OS_ANDROID) |
| OLD | NEW |