| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_THUMBNAIL_LAYER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_THUMBNAIL_LAYER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_THUMBNAIL_LAYER_H_ | 6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_THUMBNAIL_LAYER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 // A layer to render a thumbnail. | 26 // A layer to render a thumbnail. |
| 27 class ThumbnailLayer : public Layer { | 27 class ThumbnailLayer : public Layer { |
| 28 public: | 28 public: |
| 29 // Creates a ThumbnailLayer. | 29 // Creates a ThumbnailLayer. |
| 30 static scoped_refptr<ThumbnailLayer> Create(); | 30 static scoped_refptr<ThumbnailLayer> Create(); |
| 31 // Sets thumbnail that will be shown. |thumbnail| should not be nullptr. | 31 // Sets thumbnail that will be shown. |thumbnail| should not be nullptr. |
| 32 void SetThumbnail(Thumbnail* thumbnail); | 32 void SetThumbnail(Thumbnail* thumbnail); |
| 33 // Clip the thumbnail to the given |clipping|. | 33 // Clip the thumbnail to the given |clipping|. |
| 34 void Clip(const gfx::Rect& clipping); | 34 void Clip(const gfx::Rect& clipping); |
| 35 void ClearClip(); |
| 35 // Add self to |parent| or replace self at |index| if there already is an | 36 // Add self to |parent| or replace self at |index| if there already is an |
| 36 // instance with the same ID at |index|. | 37 // instance with the same ID at |index|. |
| 37 void AddSelfToParentOrReplaceAt(scoped_refptr<cc::Layer> parent, | 38 void AddSelfToParentOrReplaceAt(scoped_refptr<cc::Layer> parent, |
| 38 size_t index); | 39 size_t index); |
| 39 | 40 |
| 40 // Implements Layer. | 41 // Implements Layer. |
| 41 scoped_refptr<cc::Layer> layer() override; | 42 scoped_refptr<cc::Layer> layer() override; |
| 42 | 43 |
| 43 protected: | 44 protected: |
| 44 ThumbnailLayer(); | 45 ThumbnailLayer(); |
| 45 ~ThumbnailLayer() override; | 46 ~ThumbnailLayer() override; |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 void UpdateSizes(const gfx::SizeF& content_size, | 49 void UpdateSizes(const gfx::SizeF& content_size, |
| 49 const gfx::SizeF& resource_size); | 50 const gfx::SizeF& resource_size); |
| 50 | 51 |
| 51 scoped_refptr<cc::UIResourceLayer> layer_; | 52 scoped_refptr<cc::UIResourceLayer> layer_; |
| 52 gfx::SizeF content_size_; | 53 gfx::SizeF content_size_; |
| 53 gfx::Rect last_clipping_; | 54 gfx::Rect last_clipping_; |
| 55 bool clipped_ = false; |
| 54 gfx::SizeF resource_size_; | 56 gfx::SizeF resource_size_; |
| 55 | 57 |
| 56 DISALLOW_COPY_AND_ASSIGN(ThumbnailLayer); | 58 DISALLOW_COPY_AND_ASSIGN(ThumbnailLayer); |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 } // namespace android | 61 } // namespace android |
| 60 | 62 |
| 61 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_THUMBNAIL_LAYER_H_ | 63 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_THUMBNAIL_LAYER_H_ |
| OLD | NEW |