summaryrefslogtreecommitdiffstats
path: root/cc/picture_layer_impl.h
blob: 66f739bbb18dc9966cbcb08ced8883b44b090656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CC_PICTURE_LAYER_IMPL_H_
#define CC_PICTURE_LAYER_IMPL_H_

#include "cc/layer_impl.h"
#include "cc/picture_layer_tiling.h"
#include "cc/picture_layer_tiling_set.h"
#include "cc/picture_pile_impl.h"
#include "cc/scoped_ptr_vector.h"

namespace cc {

struct AppendQuadsData;
class QuadSink;

class CC_EXPORT PictureLayerImpl : public LayerImpl,
                                   public PictureLayerTilingClient {
public:
  static scoped_ptr<PictureLayerImpl> create(LayerTreeImpl* treeImpl, int id)
  {
      return make_scoped_ptr(new PictureLayerImpl(treeImpl, id));
  }
  virtual ~PictureLayerImpl();

  // LayerImpl overrides.
  virtual const char* layerTypeAsString() const OVERRIDE;
  virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE;
  virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
  virtual void didUpdateTransforms() OVERRIDE;

  void didUpdateBounds();

  // PictureLayerTilingClient overrides.
  virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling*,
                                         gfx::Rect) OVERRIDE;

  // PushPropertiesTo active tree => pending tree
  void SyncFromActiveLayer();
  void SyncTiling(const PictureLayerTiling* tiling);

protected:
  PictureLayerImpl(LayerTreeImpl* treeImpl, int id);
  void AddTiling(float contents_scale, gfx::Size tile_size);
  void SyncFromActiveLayer(const PictureLayerImpl* other);

  PictureLayerTilingSet tilings_;
  scoped_refptr<PicturePileImpl> pile_;
  Region invalidation_;

  gfx::Transform last_screen_space_transform_;
  double last_update_time_;
  gfx::Size last_bounds_;
  gfx::Size last_content_bounds_;
  float last_content_scale_x_;
  float last_content_scale_y_;

  friend class PictureLayer;
  DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl);
};

}

#endif  // CC_PICTURE_LAYER_IMPL_H_