Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1233 }; | 1233 }; |
| 1234 | 1234 |
| 1235 MULTI_THREAD_TEST_F(LayerTreeHostTestSetVisible); | 1235 MULTI_THREAD_TEST_F(LayerTreeHostTestSetVisible); |
| 1236 | 1236 |
| 1237 class TestOpacityChangeLayerDelegate : public ContentLayerClient { | 1237 class TestOpacityChangeLayerDelegate : public ContentLayerClient { |
| 1238 public: | 1238 public: |
| 1239 TestOpacityChangeLayerDelegate() : test_layer_(0) {} | 1239 TestOpacityChangeLayerDelegate() : test_layer_(0) {} |
| 1240 | 1240 |
| 1241 void SetTestLayer(Layer* test_layer) { test_layer_ = test_layer; } | 1241 void SetTestLayer(Layer* test_layer) { test_layer_ = test_layer; } |
| 1242 | 1242 |
| 1243 virtual void PaintContents(SkCanvas*, const gfx::Rect&, | 1243 virtual void PaintContents( |
| 1244 gfx::RectF*) OVERRIDE { | 1244 SkCanvas*, |
|
danakj
2014/05/01 17:07:11
mind giving these variables names while you're her
Stephen Chennney
2014/05/01 19:12:26
I finally found the reference to this in the Googl
| |
| 1245 const gfx::Rect&, | |
| 1246 gfx::RectF*, | |
| 1247 ContentLayerClient::GraphicsContextStatus) OVERRIDE { | |
| 1245 // Set layer opacity to 0. | 1248 // Set layer opacity to 0. |
| 1246 if (test_layer_) | 1249 if (test_layer_) |
| 1247 test_layer_->SetOpacity(0.f); | 1250 test_layer_->SetOpacity(0.f); |
| 1248 } | 1251 } |
| 1249 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} | 1252 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} |
| 1250 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } | 1253 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } |
| 1251 | 1254 |
| 1252 private: | 1255 private: |
| 1253 Layer* test_layer_; | 1256 Layer* test_layer_; |
| 1254 }; | 1257 }; |
| (...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2514 public: | 2517 public: |
| 2515 class NotificationClient : public ContentLayerClient { | 2518 class NotificationClient : public ContentLayerClient { |
| 2516 public: | 2519 public: |
| 2517 NotificationClient() | 2520 NotificationClient() |
| 2518 : layer_(0), paint_count_(0), lcd_notification_count_(0) {} | 2521 : layer_(0), paint_count_(0), lcd_notification_count_(0) {} |
| 2519 | 2522 |
| 2520 void set_layer(Layer* layer) { layer_ = layer; } | 2523 void set_layer(Layer* layer) { layer_ = layer; } |
| 2521 int paint_count() const { return paint_count_; } | 2524 int paint_count() const { return paint_count_; } |
| 2522 int lcd_notification_count() const { return lcd_notification_count_; } | 2525 int lcd_notification_count() const { return lcd_notification_count_; } |
| 2523 | 2526 |
| 2524 virtual void PaintContents(SkCanvas* canvas, | 2527 virtual void PaintContents( |
| 2525 const gfx::Rect& clip, | 2528 SkCanvas* canvas, |
| 2526 gfx::RectF* opaque) OVERRIDE { | 2529 const gfx::Rect& clip, |
| 2530 gfx::RectF* opaque, | |
| 2531 ContentLayerClient::GraphicsContextStatus) OVERRIDE { | |
|
danakj
2014/05/01 17:07:11
please give the variable a name always
Stephen Chennney
2014/05/01 19:12:26
Done.
| |
| 2527 ++paint_count_; | 2532 ++paint_count_; |
| 2528 } | 2533 } |
| 2529 virtual void DidChangeLayerCanUseLCDText() OVERRIDE { | 2534 virtual void DidChangeLayerCanUseLCDText() OVERRIDE { |
| 2530 ++lcd_notification_count_; | 2535 ++lcd_notification_count_; |
| 2531 layer_->SetNeedsDisplay(); | 2536 layer_->SetNeedsDisplay(); |
| 2532 } | 2537 } |
| 2533 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } | 2538 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } |
| 2534 | 2539 |
| 2535 private: | 2540 private: |
| 2536 Layer* layer_; | 2541 Layer* layer_; |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2755 | 2760 |
| 2756 class LayerTreeHostTestChangeLayerPropertiesInPaintContents | 2761 class LayerTreeHostTestChangeLayerPropertiesInPaintContents |
| 2757 : public LayerTreeHostTest { | 2762 : public LayerTreeHostTest { |
| 2758 public: | 2763 public: |
| 2759 class SetBoundsClient : public ContentLayerClient { | 2764 class SetBoundsClient : public ContentLayerClient { |
| 2760 public: | 2765 public: |
| 2761 SetBoundsClient() : layer_(0) {} | 2766 SetBoundsClient() : layer_(0) {} |
| 2762 | 2767 |
| 2763 void set_layer(Layer* layer) { layer_ = layer; } | 2768 void set_layer(Layer* layer) { layer_ = layer; } |
| 2764 | 2769 |
| 2765 virtual void PaintContents(SkCanvas* canvas, | 2770 virtual void PaintContents( |
| 2766 const gfx::Rect& clip, | 2771 SkCanvas* canvas, |
| 2767 gfx::RectF* opaque) OVERRIDE { | 2772 const gfx::Rect& clip, |
| 2773 gfx::RectF* opaque, | |
| 2774 ContentLayerClient::GraphicsContextStatus) OVERRIDE { | |
|
danakj
2014/05/01 17:07:11
and here, etc.
Stephen Chennney
2014/05/01 19:12:26
Done.
| |
| 2768 layer_->SetBounds(gfx::Size(2, 2)); | 2775 layer_->SetBounds(gfx::Size(2, 2)); |
| 2769 } | 2776 } |
| 2770 | 2777 |
| 2771 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} | 2778 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} |
| 2772 | 2779 |
| 2773 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } | 2780 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } |
| 2774 | 2781 |
| 2775 private: | 2782 private: |
| 2776 Layer* layer_; | 2783 Layer* layer_; |
| 2777 }; | 2784 }; |
| (...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5146 const gfx::Size bounds_; | 5153 const gfx::Size bounds_; |
| 5147 FakeContentLayerClient client_; | 5154 FakeContentLayerClient client_; |
| 5148 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 5155 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
| 5149 scoped_refptr<FakePictureLayer> picture_layer_; | 5156 scoped_refptr<FakePictureLayer> picture_layer_; |
| 5150 Layer* child_layer_; | 5157 Layer* child_layer_; |
| 5151 }; | 5158 }; |
| 5152 | 5159 |
| 5153 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 5160 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
| 5154 | 5161 |
| 5155 } // namespace cc | 5162 } // namespace cc |
| OLD | NEW |