| 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_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "cc/animation/layer_animation_controller.h" | 9 #include "cc/animation/layer_animation_controller.h" |
| 10 #include "cc/animation/transform_operations.h" | 10 #include "cc/animation/transform_operations.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "ui/gfx/quad_f.h" | 33 #include "ui/gfx/quad_f.h" |
| 34 #include "ui/gfx/transform.h" | 34 #include "ui/gfx/transform.h" |
| 35 | 35 |
| 36 namespace cc { | 36 namespace cc { |
| 37 namespace { | 37 namespace { |
| 38 | 38 |
| 39 class LayerWithForcedDrawsContent : public Layer { | 39 class LayerWithForcedDrawsContent : public Layer { |
| 40 public: | 40 public: |
| 41 LayerWithForcedDrawsContent() {} | 41 LayerWithForcedDrawsContent() {} |
| 42 | 42 |
| 43 virtual bool DrawsContent() const OVERRIDE; | 43 virtual bool DrawsContent() const override; |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 virtual ~LayerWithForcedDrawsContent() {} | 46 virtual ~LayerWithForcedDrawsContent() {} |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 bool LayerWithForcedDrawsContent::DrawsContent() const { return true; } | 49 bool LayerWithForcedDrawsContent::DrawsContent() const { return true; } |
| 50 | 50 |
| 51 class MockContentLayerClient : public ContentLayerClient { | 51 class MockContentLayerClient : public ContentLayerClient { |
| 52 public: | 52 public: |
| 53 MockContentLayerClient() {} | 53 MockContentLayerClient() {} |
| 54 virtual ~MockContentLayerClient() {} | 54 virtual ~MockContentLayerClient() {} |
| 55 virtual void PaintContents( | 55 virtual void PaintContents( |
| 56 SkCanvas* canvas, | 56 SkCanvas* canvas, |
| 57 const gfx::Rect& clip, | 57 const gfx::Rect& clip, |
| 58 ContentLayerClient::GraphicsContextStatus gc_status) OVERRIDE {} | 58 ContentLayerClient::GraphicsContextStatus gc_status) override {} |
| 59 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {} | 59 virtual void DidChangeLayerCanUseLCDText() override {} |
| 60 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } | 60 virtual bool FillsBoundsCompletely() const override { return false; } |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 scoped_refptr<ContentLayer> CreateDrawableContentLayer( | 63 scoped_refptr<ContentLayer> CreateDrawableContentLayer( |
| 64 ContentLayerClient* delegate) { | 64 ContentLayerClient* delegate) { |
| 65 scoped_refptr<ContentLayer> to_return = ContentLayer::Create(delegate); | 65 scoped_refptr<ContentLayer> to_return = ContentLayer::Create(delegate); |
| 66 to_return->SetIsDrawable(true); | 66 to_return->SetIsDrawable(true); |
| 67 return to_return; | 67 return to_return; |
| 68 } | 68 } |
| 69 | 69 |
| 70 #define EXPECT_CONTENTS_SCALE_EQ(expected, layer) \ | 70 #define EXPECT_CONTENTS_SCALE_EQ(expected, layer) \ |
| (...skipping 3940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4011 | 4011 |
| 4012 class NoScaleContentLayer : public ContentLayer { | 4012 class NoScaleContentLayer : public ContentLayer { |
| 4013 public: | 4013 public: |
| 4014 static scoped_refptr<NoScaleContentLayer> Create(ContentLayerClient* client) { | 4014 static scoped_refptr<NoScaleContentLayer> Create(ContentLayerClient* client) { |
| 4015 return make_scoped_refptr(new NoScaleContentLayer(client)); | 4015 return make_scoped_refptr(new NoScaleContentLayer(client)); |
| 4016 } | 4016 } |
| 4017 | 4017 |
| 4018 virtual void CalculateContentsScale(float ideal_contents_scale, | 4018 virtual void CalculateContentsScale(float ideal_contents_scale, |
| 4019 float* contents_scale_x, | 4019 float* contents_scale_x, |
| 4020 float* contents_scale_y, | 4020 float* contents_scale_y, |
| 4021 gfx::Size* content_bounds) OVERRIDE { | 4021 gfx::Size* content_bounds) override { |
| 4022 // Skip over the ContentLayer to the base Layer class. | 4022 // Skip over the ContentLayer to the base Layer class. |
| 4023 Layer::CalculateContentsScale(ideal_contents_scale, | 4023 Layer::CalculateContentsScale(ideal_contents_scale, |
| 4024 contents_scale_x, | 4024 contents_scale_x, |
| 4025 contents_scale_y, | 4025 contents_scale_y, |
| 4026 content_bounds); | 4026 content_bounds); |
| 4027 } | 4027 } |
| 4028 | 4028 |
| 4029 protected: | 4029 protected: |
| 4030 explicit NoScaleContentLayer(ContentLayerClient* client) | 4030 explicit NoScaleContentLayer(ContentLayerClient* client) |
| 4031 : ContentLayer(client) {} | 4031 : ContentLayer(client) {} |
| (...skipping 4578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8610 // by the viewport. | 8610 // by the viewport. |
| 8611 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect()); | 8611 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect()); |
| 8612 | 8612 |
| 8613 // Layers drawing to a child render surface should still have their visible | 8613 // Layers drawing to a child render surface should still have their visible |
| 8614 // content rect clipped by the viewport. | 8614 // content rect clipped by the viewport. |
| 8615 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect()); | 8615 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect()); |
| 8616 } | 8616 } |
| 8617 | 8617 |
| 8618 } // namespace | 8618 } // namespace |
| 8619 } // namespace cc | 8619 } // namespace cc |
| OLD | NEW |