blob: 5e3184be94785734caf115dbae58f6f4181c564f [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]b9dcf43a2013-01-09 00:15:2913#include "skia/ext/refptr.h"
14#include "third_party/skia/include/core/SkPicture.h"
[email protected]d98c0242012-11-08 06:22:3515
16namespace cc {
17
[email protected]3621e182012-11-09 22:37:0918struct AppendQuadsData;
19class QuadSink;
20
[email protected]9b18c102012-11-15 19:57:0321class CC_EXPORT PictureLayerImpl : public LayerImpl,
22 public PictureLayerTilingClient {
[email protected]d98c0242012-11-08 06:22:3523public:
[email protected]8bef40572012-12-11 21:38:0824 static scoped_ptr<PictureLayerImpl> create(LayerTreeImpl* treeImpl, int id)
[email protected]d98c0242012-11-08 06:22:3525 {
[email protected]8bef40572012-12-11 21:38:0826 return make_scoped_ptr(new PictureLayerImpl(treeImpl, id));
[email protected]d98c0242012-11-08 06:22:3527 }
28 virtual ~PictureLayerImpl();
29
[email protected]3621e182012-11-09 22:37:0930 // 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]6ef21ffc2012-11-28 05:58:5434 virtual void didUpdateTransforms() OVERRIDE;
[email protected]37386f052013-01-13 00:42:2235 virtual void didBecomeActive() OVERRIDE;
[email protected]45c4b1e2013-01-16 02:19:4036 virtual void didLoseOutputSurface() OVERRIDE;
[email protected]e0eb7c42013-01-08 00:00:1937 virtual void calculateContentsScale(
38 float ideal_contents_scale,
39 float* contents_scale_x,
40 float* contents_scale_y,
41 gfx::Size* content_bounds) OVERRIDE;
[email protected]b9dcf43a2013-01-09 00:15:2942 virtual skia::RefPtr<SkPicture> getPicture() OVERRIDE;
[email protected]3621e182012-11-09 22:37:0943
[email protected]9b18c102012-11-15 19:57:0344 // PictureLayerTilingClient overrides.
45 virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling*,
46 gfx::Rect) OVERRIDE;
47
48 // PushPropertiesTo active tree => pending tree
[email protected]f117a4c2012-12-16 04:53:1049 void SyncFromActiveLayer();
50 void SyncTiling(const PictureLayerTiling* tiling);
[email protected]9b18c102012-11-15 19:57:0351
[email protected]f6776532012-12-21 20:24:3352 // Mask-related functions
53 void SetIsMask(bool is_mask);
54 virtual ResourceProvider::ResourceId contentsResourceId() const OVERRIDE;
55
[email protected]b0a917c8d2013-01-12 17:42:2556 virtual bool areVisibleResourcesReady() const OVERRIDE;
57
[email protected]d98c0242012-11-08 06:22:3558protected:
[email protected]8bef40572012-12-11 21:38:0859 PictureLayerImpl(LayerTreeImpl* treeImpl, int id);
[email protected]166db5c82013-01-09 23:54:3160 PictureLayerTiling* AddTiling(float contents_scale);
[email protected]f117a4c2012-12-16 04:53:1061 void SyncFromActiveLayer(const PictureLayerImpl* other);
[email protected]f6776532012-12-21 20:24:3362 gfx::Size TileSize() const;
[email protected]e0eb7c42013-01-08 00:00:1963 void ManageTilings(float ideal_contents_scale);
[email protected]166db5c82013-01-09 23:54:3164 void CleanUpUnusedTilings(std::vector<PictureLayerTiling*> used_tilings);
[email protected]d98c0242012-11-08 06:22:3565
[email protected]cd696272012-11-21 19:15:2766 PictureLayerTilingSet tilings_;
[email protected]91e89bc2012-11-29 12:58:1867 scoped_refptr<PicturePileImpl> pile_;
[email protected]f117a4c2012-12-16 04:53:1068 Region invalidation_;
[email protected]d98c0242012-11-08 06:22:3569
[email protected]4cbadc882012-12-04 08:52:5870 gfx::Transform last_screen_space_transform_;
71 double last_update_time_;
72 gfx::Size last_bounds_;
73 gfx::Size last_content_bounds_;
[email protected]166db5c82013-01-09 23:54:3174 float last_content_scale_;
75 float ideal_contents_scale_;
[email protected]f6776532012-12-21 20:24:3376 bool is_mask_;
[email protected]4cbadc882012-12-04 08:52:5877
[email protected]d98c0242012-11-08 06:22:3578 friend class PictureLayer;
79 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl);
80};
81
82}
83
84#endif // CC_PICTURE_LAYER_IMPL_H_