WebKit Roll 139512:139548
[chromium-blink-merge.git] / cc / bitmap_skpicture_content_layer_updater.h
blobdb09eb77ce15833c751c64921d886b0a49ea09cd
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_BITMAP_SKPICTURE_CONTENT_LAYER_UPDATER_H_
6 #define CC_BITMAP_SKPICTURE_CONTENT_LAYER_UPDATER_H_
8 #include "cc/skpicture_content_layer_updater.h"
9 #include "third_party/skia/include/core/SkBitmap.h"
11 namespace cc {
13 // This class records the contentRect into an SkPicture, then software rasterizes
14 // the SkPicture into bitmaps for each tile. This implements Settings::perTilePainting.
15 class BitmapSkPictureContentLayerUpdater : public SkPictureContentLayerUpdater {
16 public:
17 class Resource : public ContentLayerUpdater::Resource {
18 public:
19 Resource(BitmapSkPictureContentLayerUpdater*, scoped_ptr<PrioritizedResource>);
21 virtual void update(ResourceUpdateQueue&, const gfx::Rect& sourceRect, const gfx::Vector2d& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE;
23 private:
24 BitmapSkPictureContentLayerUpdater* updater() { return m_updater; }
26 SkBitmap m_bitmap;
27 BitmapSkPictureContentLayerUpdater* m_updater;
30 static scoped_refptr<BitmapSkPictureContentLayerUpdater> create(scoped_ptr<LayerPainter>);
32 virtual scoped_ptr<LayerUpdater::Resource> createResource(PrioritizedResourceManager*) OVERRIDE;
33 void paintContentsRect(SkCanvas*, const gfx::Rect& sourceRect, RenderingStats&);
35 private:
36 explicit BitmapSkPictureContentLayerUpdater(scoped_ptr<LayerPainter>);
37 virtual ~BitmapSkPictureContentLayerUpdater();
40 } // namespace cc
42 #endif // CC_BITMAP_SKPICTURE_CONTENT_LAYER_UPDATER_H_