[NaCl SDK]: use standard __BEGIN_DECLS macros in sys/select.h
[chromium-blink-merge.git] / cc / resources / layer_updater.h
blob47f44106e400e6af5f1b7d11b5c9126800d2ccb0
1 // Copyright 2011 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.
5 #ifndef CC_RESOURCES_LAYER_UPDATER_H_
6 #define CC_RESOURCES_LAYER_UPDATER_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/base/cc_export.h"
11 #include "ui/gfx/rect.h"
12 #include "ui/gfx/vector2d.h"
14 namespace cc {
16 class PrioritizedResource;
17 class PrioritizedResourceManager;
18 class ResourceUpdateQueue;
19 class TextureManager;
21 class CC_EXPORT LayerUpdater : public base::RefCounted<LayerUpdater> {
22 public:
23 // Allows updaters to store per-resource update properties.
24 class CC_EXPORT Resource {
25 public:
26 virtual ~Resource();
28 PrioritizedResource* texture() { return texture_.get(); }
29 // TODO(reveman): partial_update should be a property of this class
30 // instead of an argument passed to Update().
31 virtual void Update(ResourceUpdateQueue* queue,
32 const gfx::Rect& source_rect,
33 const gfx::Vector2d& dest_offset,
34 bool partial_update) = 0;
36 protected:
37 explicit Resource(scoped_ptr<PrioritizedResource> texture);
39 private:
40 scoped_ptr<PrioritizedResource> texture_;
42 DISALLOW_COPY_AND_ASSIGN(Resource);
45 LayerUpdater() {}
47 virtual scoped_ptr<Resource> CreateResource(
48 PrioritizedResourceManager* manager) = 0;
49 // The |resulting_opaque_rect| gives back a region of the layer that was
50 // painted opaque. If the layer is marked opaque in the updater, then this
51 // region should be ignored in preference for the entire layer's area.
52 virtual void PrepareToUpdate(const gfx::Rect& content_rect,
53 const gfx::Size& tile_size,
54 float contents_width_scale,
55 float contents_height_scale,
56 gfx::Rect* resulting_opaque_rect) {}
57 virtual void ReduceMemoryUsage() {}
59 // Set true by the layer when it is known that the entire output is going to
60 // be opaque.
61 virtual void SetOpaque(bool opaque) {}
62 // Set true by the layer when it is known that the entire output bounds will
63 // be rasterized.
64 virtual void SetFillsBoundsCompletely(bool fills_bounds) {}
66 protected:
67 virtual ~LayerUpdater() {}
69 private:
70 friend class base::RefCounted<LayerUpdater>;
72 DISALLOW_COPY_AND_ASSIGN(LayerUpdater);
75 } // namespace cc
77 #endif // CC_RESOURCES_LAYER_UPDATER_H_