add a use_alsa gyp setting
[chromium-blink-merge.git] / cc / skpicture_content_layer_updater.h
blob840eba61d696e5d764c41e36c1ee06bb725bfc30
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.
6 #ifndef CC_SKPICTURE_CONTENT_LAYER_UPDATER_H_
7 #define CC_SKPICTURE_CONTENT_LAYER_UPDATER_H_
9 #include "cc/content_layer_updater.h"
10 #include "third_party/skia/include/core/SkPicture.h"
12 class SkCanvas;
14 namespace cc {
16 class LayerPainter;
18 // This class records the contentRect into an SkPicture. Subclasses, provide
19 // different implementations of tile updating based on this recorded picture.
20 // The BitmapSkPictureContentLayerUpdater and
21 // FrameBufferSkPictureContentLayerUpdater are two examples of such
22 // implementations.
23 class SkPictureContentLayerUpdater : public ContentLayerUpdater {
24 public:
25 class Resource : public LayerUpdater::Resource {
26 public:
27 Resource(SkPictureContentLayerUpdater*, scoped_ptr<PrioritizedResource>);
28 virtual ~Resource();
30 virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats*) OVERRIDE;
32 private:
33 SkPictureContentLayerUpdater* updater() { return m_updater; }
35 SkPictureContentLayerUpdater* m_updater;
38 static scoped_refptr<SkPictureContentLayerUpdater> create(scoped_ptr<LayerPainter>);
40 virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedResourceManager*) OVERRIDE;
41 virtual void setOpaque(bool) OVERRIDE;
43 protected:
44 explicit SkPictureContentLayerUpdater(scoped_ptr<LayerPainter>);
45 virtual ~SkPictureContentLayerUpdater();
47 virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size& tileSize, float contentsWidthScale, float contentsHeightScale, gfx::Rect& resultingOpaqueRect, RenderingStats*) OVERRIDE;
48 void drawPicture(SkCanvas*);
49 void updateTexture(ResourceUpdateQueue& queue, PrioritizedResource* texture, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate);
51 bool layerIsOpaque() const { return m_layerIsOpaque; }
53 private:
54 // Recording canvas.
55 SkPicture m_picture;
56 // True when it is known that all output pixels will be opaque.
57 bool m_layerIsOpaque;
60 } // namespace cc
61 #endif // CC_SKPICTURE_CONTENT_LAYER_UPDATER_H_