| 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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 | 937 |
| 938 class TestOpacityChangeLayerDelegate : public ContentLayerClient { | 938 class TestOpacityChangeLayerDelegate : public ContentLayerClient { |
| 939 public: | 939 public: |
| 940 TestOpacityChangeLayerDelegate() : test_layer_(0) {} | 940 TestOpacityChangeLayerDelegate() : test_layer_(0) {} |
| 941 | 941 |
| 942 void SetTestLayer(Layer* test_layer) { test_layer_ = test_layer; } | 942 void SetTestLayer(Layer* test_layer) { test_layer_ = test_layer; } |
| 943 | 943 |
| 944 virtual void PaintContents( | 944 virtual void PaintContents( |
| 945 SkCanvas* canvas, | 945 SkCanvas* canvas, |
| 946 const gfx::Rect& clip, | 946 const gfx::Rect& clip, |
| 947 gfx::RectF* opaque, | |
| 948 ContentLayerClient::GraphicsContextStatus gc_status) OVERRIDE { | 947 ContentLayerClient::GraphicsContextStatus gc_status) OVERRIDE { |
| 949 // Set layer opacity to 0. | 948 // Set layer opacity to 0. |
| 950 if (test_layer_) | 949 if (test_layer_) |
| 951 test_layer_->SetOpacity(0.f); | 950 test_layer_->SetOpacity(0.f); |
| 952 } | 951 } |
| 953 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} | 952 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} |
| 954 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } | 953 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } |
| 955 | 954 |
| 956 private: | 955 private: |
| 957 Layer* test_layer_; | 956 Layer* test_layer_; |
| (...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2134 NotificationClient() | 2133 NotificationClient() |
| 2135 : layer_(0), paint_count_(0), lcd_notification_count_(0) {} | 2134 : layer_(0), paint_count_(0), lcd_notification_count_(0) {} |
| 2136 | 2135 |
| 2137 void set_layer(Layer* layer) { layer_ = layer; } | 2136 void set_layer(Layer* layer) { layer_ = layer; } |
| 2138 int paint_count() const { return paint_count_; } | 2137 int paint_count() const { return paint_count_; } |
| 2139 int lcd_notification_count() const { return lcd_notification_count_; } | 2138 int lcd_notification_count() const { return lcd_notification_count_; } |
| 2140 | 2139 |
| 2141 virtual void PaintContents( | 2140 virtual void PaintContents( |
| 2142 SkCanvas* canvas, | 2141 SkCanvas* canvas, |
| 2143 const gfx::Rect& clip, | 2142 const gfx::Rect& clip, |
| 2144 gfx::RectF* opaque, | |
| 2145 ContentLayerClient::GraphicsContextStatus gc_status) OVERRIDE { | 2143 ContentLayerClient::GraphicsContextStatus gc_status) OVERRIDE { |
| 2146 ++paint_count_; | 2144 ++paint_count_; |
| 2147 } | 2145 } |
| 2148 virtual void DidChangeLayerCanUseLCDText() OVERRIDE { | 2146 virtual void DidChangeLayerCanUseLCDText() OVERRIDE { |
| 2149 ++lcd_notification_count_; | 2147 ++lcd_notification_count_; |
| 2150 layer_->SetNeedsDisplay(); | 2148 layer_->SetNeedsDisplay(); |
| 2151 } | 2149 } |
| 2152 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } | 2150 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } |
| 2153 | 2151 |
| 2154 private: | 2152 private: |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2381 public: | 2379 public: |
| 2382 class SetBoundsClient : public ContentLayerClient { | 2380 class SetBoundsClient : public ContentLayerClient { |
| 2383 public: | 2381 public: |
| 2384 SetBoundsClient() : layer_(0) {} | 2382 SetBoundsClient() : layer_(0) {} |
| 2385 | 2383 |
| 2386 void set_layer(Layer* layer) { layer_ = layer; } | 2384 void set_layer(Layer* layer) { layer_ = layer; } |
| 2387 | 2385 |
| 2388 virtual void PaintContents( | 2386 virtual void PaintContents( |
| 2389 SkCanvas* canvas, | 2387 SkCanvas* canvas, |
| 2390 const gfx::Rect& clip, | 2388 const gfx::Rect& clip, |
| 2391 gfx::RectF* opaque, | |
| 2392 ContentLayerClient::GraphicsContextStatus gc_status) OVERRIDE { | 2389 ContentLayerClient::GraphicsContextStatus gc_status) OVERRIDE { |
| 2393 layer_->SetBounds(gfx::Size(2, 2)); | 2390 layer_->SetBounds(gfx::Size(2, 2)); |
| 2394 } | 2391 } |
| 2395 | 2392 |
| 2396 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} | 2393 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} |
| 2397 | 2394 |
| 2398 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } | 2395 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } |
| 2399 | 2396 |
| 2400 private: | 2397 private: |
| 2401 Layer* layer_; | 2398 Layer* layer_; |
| (...skipping 2632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5034 const gfx::Size bounds_; | 5031 const gfx::Size bounds_; |
| 5035 FakeContentLayerClient client_; | 5032 FakeContentLayerClient client_; |
| 5036 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 5033 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
| 5037 scoped_refptr<FakePictureLayer> picture_layer_; | 5034 scoped_refptr<FakePictureLayer> picture_layer_; |
| 5038 Layer* child_layer_; | 5035 Layer* child_layer_; |
| 5039 }; | 5036 }; |
| 5040 | 5037 |
| 5041 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 5038 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
| 5042 | 5039 |
| 5043 } // namespace cc | 5040 } // namespace cc |
| OLD | NEW |