blob: 60e2c8d34a4b140430c5d5aa4e271d1518b517f6 [file] [log] [blame]
[email protected]d98c0242012-11-08 06:22:351// 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]9b18c102012-11-15 19:57:039#include "cc/picture_layer_tiling.h"
[email protected]cd696272012-11-21 19:15:2710#include "cc/picture_layer_tiling_set.h"
[email protected]91e89bc2012-11-29 12:58:1811#include "cc/picture_pile_impl.h"
[email protected]9b18c102012-11-15 19:57:0312#include "cc/scoped_ptr_vector.h"
[email protected]d98c0242012-11-08 06:22:3513
14namespace cc {
15
[email protected]3621e182012-11-09 22:37:0916struct AppendQuadsData;
17class QuadSink;
18
[email protected]9b18c102012-11-15 19:57:0319class CC_EXPORT PictureLayerImpl : public LayerImpl,
20 public PictureLayerTilingClient {
[email protected]d98c0242012-11-08 06:22:3521public:
[email protected]8bef40572012-12-11 21:38:0822 static scoped_ptr<PictureLayerImpl> create(LayerTreeImpl* treeImpl, int id)
[email protected]d98c0242012-11-08 06:22:3523 {
[email protected]8bef40572012-12-11 21:38:0824 return make_scoped_ptr(new PictureLayerImpl(treeImpl, id));
[email protected]d98c0242012-11-08 06:22:3525 }
26 virtual ~PictureLayerImpl();
27
[email protected]3621e182012-11-09 22:37:0928 // LayerImpl overrides.
29 virtual const char* layerTypeAsString() const OVERRIDE;
30 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE;
31 virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
[email protected]6ef21ffc2012-11-28 05:58:5432 virtual void didUpdateTransforms() OVERRIDE;
[email protected]e0eb7c42013-01-08 00:00:1933 virtual void calculateContentsScale(
34 float ideal_contents_scale,
35 float* contents_scale_x,
36 float* contents_scale_y,
37 gfx::Size* content_bounds) OVERRIDE;
[email protected]3621e182012-11-09 22:37:0938
[email protected]9b18c102012-11-15 19:57:0339 // PictureLayerTilingClient overrides.
40 virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling*,
41 gfx::Rect) OVERRIDE;
42
43 // PushPropertiesTo active tree => pending tree
[email protected]f117a4c2012-12-16 04:53:1044 void SyncFromActiveLayer();
45 void SyncTiling(const PictureLayerTiling* tiling);
[email protected]9b18c102012-11-15 19:57:0346
[email protected]f6776532012-12-21 20:24:3347 // Mask-related functions
48 void SetIsMask(bool is_mask);
49 virtual ResourceProvider::ResourceId contentsResourceId() const OVERRIDE;
50
[email protected]d98c0242012-11-08 06:22:3551protected:
[email protected]8bef40572012-12-11 21:38:0852 PictureLayerImpl(LayerTreeImpl* treeImpl, int id);
[email protected]f117a4c2012-12-16 04:53:1053 void AddTiling(float contents_scale, gfx::Size tile_size);
54 void SyncFromActiveLayer(const PictureLayerImpl* other);
[email protected]f6776532012-12-21 20:24:3355 gfx::Size TileSize() const;
[email protected]e0eb7c42013-01-08 00:00:1956 void ManageTilings(float ideal_contents_scale);
[email protected]d98c0242012-11-08 06:22:3557
[email protected]cd696272012-11-21 19:15:2758 PictureLayerTilingSet tilings_;
[email protected]91e89bc2012-11-29 12:58:1859 scoped_refptr<PicturePileImpl> pile_;
[email protected]f117a4c2012-12-16 04:53:1060 Region invalidation_;
[email protected]d98c0242012-11-08 06:22:3561
[email protected]4cbadc882012-12-04 08:52:5862 gfx::Transform last_screen_space_transform_;
63 double last_update_time_;
64 gfx::Size last_bounds_;
65 gfx::Size last_content_bounds_;
66 float last_content_scale_x_;
67 float last_content_scale_y_;
[email protected]f6776532012-12-21 20:24:3368 bool is_mask_;
[email protected]4cbadc882012-12-04 08:52:5869
[email protected]d98c0242012-11-08 06:22:3570 friend class PictureLayer;
71 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl);
72};
73
74}
75
76#endif // CC_PICTURE_LAYER_IMPL_H_