| 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 14 matching lines...) Expand all Loading... |
| 25 INSTANTIATE_PIXEL_RESOURCE_TEST_CASE_P(LayerTreeHostMasksPixelTest); | 25 INSTANTIATE_PIXEL_RESOURCE_TEST_CASE_P(LayerTreeHostMasksPixelTest); |
| 26 | 26 |
| 27 class MaskContentLayerClient : public ContentLayerClient { | 27 class MaskContentLayerClient : public ContentLayerClient { |
| 28 public: | 28 public: |
| 29 explicit MaskContentLayerClient(const gfx::Size& bounds) : bounds_(bounds) {} | 29 explicit MaskContentLayerClient(const gfx::Size& bounds) : bounds_(bounds) {} |
| 30 ~MaskContentLayerClient() override {} | 30 ~MaskContentLayerClient() override {} |
| 31 | 31 |
| 32 bool FillsBoundsCompletely() const override { return false; } | 32 bool FillsBoundsCompletely() const override { return false; } |
| 33 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; } | 33 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; } |
| 34 | 34 |
| 35 gfx::Rect PaintableRegion() override { return gfx::Rect(bounds_); } |
| 36 |
| 35 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 37 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( |
| 36 const gfx::Rect& clip, | 38 const gfx::Rect& clip, |
| 37 PaintingControlSetting picture_control) override { | 39 PaintingControlSetting picture_control) override { |
| 38 SkPictureRecorder recorder; | 40 SkPictureRecorder recorder; |
| 39 skia::RefPtr<SkCanvas> canvas = skia::SharePtr( | 41 skia::RefPtr<SkCanvas> canvas = skia::SharePtr( |
| 40 recorder.beginRecording(gfx::RectToSkRect(gfx::Rect(bounds_)))); | 42 recorder.beginRecording(gfx::RectToSkRect(gfx::Rect(bounds_)))); |
| 41 | 43 |
| 42 SkPaint paint; | 44 SkPaint paint; |
| 43 paint.setStyle(SkPaint::kStroke_Style); | 45 paint.setStyle(SkPaint::kStroke_Style); |
| 44 paint.setStrokeWidth(SkIntToScalar(2)); | 46 paint.setStrokeWidth(SkIntToScalar(2)); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 306 |
| 305 class CheckerContentLayerClient : public ContentLayerClient { | 307 class CheckerContentLayerClient : public ContentLayerClient { |
| 306 public: | 308 public: |
| 307 CheckerContentLayerClient(const gfx::Size& bounds, | 309 CheckerContentLayerClient(const gfx::Size& bounds, |
| 308 SkColor color, | 310 SkColor color, |
| 309 bool vertical) | 311 bool vertical) |
| 310 : bounds_(bounds), color_(color), vertical_(vertical) {} | 312 : bounds_(bounds), color_(color), vertical_(vertical) {} |
| 311 ~CheckerContentLayerClient() override {} | 313 ~CheckerContentLayerClient() override {} |
| 312 bool FillsBoundsCompletely() const override { return false; } | 314 bool FillsBoundsCompletely() const override { return false; } |
| 313 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; } | 315 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; } |
| 316 gfx::Rect PaintableRegion() override { return gfx::Rect(bounds_); } |
| 314 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 317 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( |
| 315 const gfx::Rect& clip, | 318 const gfx::Rect& clip, |
| 316 PaintingControlSetting picture_control) override { | 319 PaintingControlSetting picture_control) override { |
| 317 SkPictureRecorder recorder; | 320 SkPictureRecorder recorder; |
| 318 skia::RefPtr<SkCanvas> canvas = skia::SharePtr( | 321 skia::RefPtr<SkCanvas> canvas = skia::SharePtr( |
| 319 recorder.beginRecording(gfx::RectToSkRect(gfx::Rect(bounds_)))); | 322 recorder.beginRecording(gfx::RectToSkRect(gfx::Rect(bounds_)))); |
| 320 | 323 |
| 321 SkPaint paint; | 324 SkPaint paint; |
| 322 paint.setStyle(SkPaint::kStroke_Style); | 325 paint.setStyle(SkPaint::kStroke_Style); |
| 323 paint.setStrokeWidth(SkIntToScalar(4)); | 326 paint.setStrokeWidth(SkIntToScalar(4)); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 351 bool vertical_; | 354 bool vertical_; |
| 352 }; | 355 }; |
| 353 | 356 |
| 354 class CircleContentLayerClient : public ContentLayerClient { | 357 class CircleContentLayerClient : public ContentLayerClient { |
| 355 public: | 358 public: |
| 356 explicit CircleContentLayerClient(const gfx::Size& bounds) | 359 explicit CircleContentLayerClient(const gfx::Size& bounds) |
| 357 : bounds_(bounds) {} | 360 : bounds_(bounds) {} |
| 358 ~CircleContentLayerClient() override {} | 361 ~CircleContentLayerClient() override {} |
| 359 bool FillsBoundsCompletely() const override { return false; } | 362 bool FillsBoundsCompletely() const override { return false; } |
| 360 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; } | 363 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; } |
| 364 gfx::Rect PaintableRegion() override { return gfx::Rect(bounds_); } |
| 361 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 365 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( |
| 362 const gfx::Rect& clip, | 366 const gfx::Rect& clip, |
| 363 PaintingControlSetting picture_control) override { | 367 PaintingControlSetting picture_control) override { |
| 364 SkPictureRecorder recorder; | 368 SkPictureRecorder recorder; |
| 365 skia::RefPtr<SkCanvas> canvas = skia::SharePtr( | 369 skia::RefPtr<SkCanvas> canvas = skia::SharePtr( |
| 366 recorder.beginRecording(gfx::RectToSkRect(gfx::Rect(bounds_)))); | 370 recorder.beginRecording(gfx::RectToSkRect(gfx::Rect(bounds_)))); |
| 367 | 371 |
| 368 SkPaint paint; | 372 SkPaint paint; |
| 369 paint.setStyle(SkPaint::kFill_Style); | 373 paint.setStyle(SkPaint::kFill_Style); |
| 370 paint.setColor(SK_ColorWHITE); | 374 paint.setColor(SK_ColorWHITE); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 | 504 |
| 501 RunPixelResourceTest(background, | 505 RunPixelResourceTest(background, |
| 502 base::FilePath( | 506 base::FilePath( |
| 503 FILE_PATH_LITERAL("mask_of_layer_with_blend.png"))); | 507 FILE_PATH_LITERAL("mask_of_layer_with_blend.png"))); |
| 504 } | 508 } |
| 505 | 509 |
| 506 } // namespace | 510 } // namespace |
| 507 } // namespace cc | 511 } // namespace cc |
| 508 | 512 |
| 509 #endif // !defined(OS_ANDROID) | 513 #endif // !defined(OS_ANDROID) |
| OLD | NEW |