[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CC_PICTURE_LAYER_IMPL_H_ |
| 6 | #define CC_PICTURE_LAYER_IMPL_H_ |
| 7 | |
| 8 | #include "cc/layer_impl.h" |
[email protected] | 9b18c10 | 2012-11-15 19:57:03 | [diff] [blame] | 9 | #include "cc/picture_layer_tiling.h" |
[email protected] | cd69627 | 2012-11-21 19:15:27 | [diff] [blame] | 10 | #include "cc/picture_layer_tiling_set.h" |
[email protected] | 91e89bc | 2012-11-29 12:58:18 | [diff] [blame] | 11 | #include "cc/picture_pile_impl.h" |
[email protected] | 9b18c10 | 2012-11-15 19:57:03 | [diff] [blame] | 12 | #include "cc/scoped_ptr_vector.h" |
[email protected] | b9dcf43a | 2013-01-09 00:15:29 | [diff] [blame^] | 13 | #include "skia/ext/refptr.h" |
| 14 | #include "third_party/skia/include/core/SkPicture.h" |
[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 15 | |
| 16 | namespace cc { |
| 17 | |
[email protected] | 3621e18 | 2012-11-09 22:37:09 | [diff] [blame] | 18 | struct AppendQuadsData; |
| 19 | class QuadSink; |
| 20 | |
[email protected] | 9b18c10 | 2012-11-15 19:57:03 | [diff] [blame] | 21 | class CC_EXPORT PictureLayerImpl : public LayerImpl, |
| 22 | public PictureLayerTilingClient { |
[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 23 | public: |
[email protected] | 8bef4057 | 2012-12-11 21:38:08 | [diff] [blame] | 24 | static scoped_ptr<PictureLayerImpl> create(LayerTreeImpl* treeImpl, int id) |
[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 25 | { |
[email protected] | 8bef4057 | 2012-12-11 21:38:08 | [diff] [blame] | 26 | return make_scoped_ptr(new PictureLayerImpl(treeImpl, id)); |
[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 27 | } |
| 28 | virtual ~PictureLayerImpl(); |
| 29 | |
[email protected] | 3621e18 | 2012-11-09 22:37:09 | [diff] [blame] | 30 | // LayerImpl overrides. |
| 31 | virtual const char* layerTypeAsString() const OVERRIDE; |
| 32 | virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; |
| 33 | virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE; |
[email protected] | 6ef21ffc | 2012-11-28 05:58:54 | [diff] [blame] | 34 | virtual void didUpdateTransforms() OVERRIDE; |
[email protected] | e0eb7c4 | 2013-01-08 00:00:19 | [diff] [blame] | 35 | virtual void calculateContentsScale( |
| 36 | float ideal_contents_scale, |
| 37 | float* contents_scale_x, |
| 38 | float* contents_scale_y, |
| 39 | gfx::Size* content_bounds) OVERRIDE; |
[email protected] | b9dcf43a | 2013-01-09 00:15:29 | [diff] [blame^] | 40 | virtual skia::RefPtr<SkPicture> getPicture() OVERRIDE; |
[email protected] | 3621e18 | 2012-11-09 22:37:09 | [diff] [blame] | 41 | |
[email protected] | 9b18c10 | 2012-11-15 19:57:03 | [diff] [blame] | 42 | // PictureLayerTilingClient overrides. |
| 43 | virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling*, |
| 44 | gfx::Rect) OVERRIDE; |
| 45 | |
| 46 | // PushPropertiesTo active tree => pending tree |
[email protected] | f117a4c | 2012-12-16 04:53:10 | [diff] [blame] | 47 | void SyncFromActiveLayer(); |
| 48 | void SyncTiling(const PictureLayerTiling* tiling); |
[email protected] | 9b18c10 | 2012-11-15 19:57:03 | [diff] [blame] | 49 | |
[email protected] | f677653 | 2012-12-21 20:24:33 | [diff] [blame] | 50 | // Mask-related functions |
| 51 | void SetIsMask(bool is_mask); |
| 52 | virtual ResourceProvider::ResourceId contentsResourceId() const OVERRIDE; |
| 53 | |
[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 54 | protected: |
[email protected] | 8bef4057 | 2012-12-11 21:38:08 | [diff] [blame] | 55 | PictureLayerImpl(LayerTreeImpl* treeImpl, int id); |
[email protected] | f117a4c | 2012-12-16 04:53:10 | [diff] [blame] | 56 | void AddTiling(float contents_scale, gfx::Size tile_size); |
| 57 | void SyncFromActiveLayer(const PictureLayerImpl* other); |
[email protected] | f677653 | 2012-12-21 20:24:33 | [diff] [blame] | 58 | gfx::Size TileSize() const; |
[email protected] | e0eb7c4 | 2013-01-08 00:00:19 | [diff] [blame] | 59 | void ManageTilings(float ideal_contents_scale); |
[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 60 | |
[email protected] | cd69627 | 2012-11-21 19:15:27 | [diff] [blame] | 61 | PictureLayerTilingSet tilings_; |
[email protected] | 91e89bc | 2012-11-29 12:58:18 | [diff] [blame] | 62 | scoped_refptr<PicturePileImpl> pile_; |
[email protected] | f117a4c | 2012-12-16 04:53:10 | [diff] [blame] | 63 | Region invalidation_; |
[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 64 | |
[email protected] | 4cbadc88 | 2012-12-04 08:52:58 | [diff] [blame] | 65 | gfx::Transform last_screen_space_transform_; |
| 66 | double last_update_time_; |
| 67 | gfx::Size last_bounds_; |
| 68 | gfx::Size last_content_bounds_; |
| 69 | float last_content_scale_x_; |
| 70 | float last_content_scale_y_; |
[email protected] | f677653 | 2012-12-21 20:24:33 | [diff] [blame] | 71 | bool is_mask_; |
[email protected] | 4cbadc88 | 2012-12-04 08:52:58 | [diff] [blame] | 72 | |
[email protected] | d98c024 | 2012-11-08 06:22:35 | [diff] [blame] | 73 | friend class PictureLayer; |
| 74 | DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
| 75 | }; |
| 76 | |
| 77 | } |
| 78 | |
| 79 | #endif // CC_PICTURE_LAYER_IMPL_H_ |