| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CC_BITMAP_SKPICTURE_CONTENT_LAYER_UPDATER_H_ | |
| 6 #define CC_BITMAP_SKPICTURE_CONTENT_LAYER_UPDATER_H_ | |
| 7 | |
| 8 #include "cc/skpicture_content_layer_updater.h" | |
| 9 #include "third_party/skia/include/core/SkBitmap.h" | |
| 10 | |
| 11 namespace cc { | |
| 12 | |
| 13 // This class records the contentRect into an SkPicture, then software | |
| 14 // rasterizes the SkPicture into bitmaps for each tile. This implements | |
| 15 // Settings::perTilePainting. | |
| 16 class BitmapSkPictureContentLayerUpdater : public SkPictureContentLayerUpdater { | |
| 17 public: | |
| 18 class Resource : public ContentLayerUpdater::Resource { | |
| 19 public: | |
| 20 Resource(BitmapSkPictureContentLayerUpdater* updater, | |
| 21 scoped_ptr<PrioritizedResource> texture); | |
| 22 | |
| 23 virtual void Update(ResourceUpdateQueue* queue, | |
| 24 gfx::Rect source_rect, | |
| 25 gfx::Vector2d dest_offset, | |
| 26 bool partial_update, | |
| 27 RenderingStats* stats) OVERRIDE; | |
| 28 | |
| 29 private: | |
| 30 SkBitmap bitmap_; | |
| 31 BitmapSkPictureContentLayerUpdater* updater_; | |
| 32 | |
| 33 DISALLOW_COPY_AND_ASSIGN(Resource); | |
| 34 }; | |
| 35 | |
| 36 static scoped_refptr<BitmapSkPictureContentLayerUpdater> Create( | |
| 37 scoped_ptr<LayerPainter> painter); | |
| 38 | |
| 39 virtual scoped_ptr<LayerUpdater::Resource> CreateResource( | |
| 40 PrioritizedResourceManager* manager) OVERRIDE; | |
| 41 void PaintContentsRect(SkCanvas* canvas, | |
| 42 gfx::Rect source_rect, | |
| 43 RenderingStats* stats); | |
| 44 | |
| 45 private: | |
| 46 explicit BitmapSkPictureContentLayerUpdater(scoped_ptr<LayerPainter> painter); | |
| 47 virtual ~BitmapSkPictureContentLayerUpdater(); | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(BitmapSkPictureContentLayerUpdater); | |
| 50 }; | |
| 51 | |
| 52 } // namespace cc | |
| 53 | |
| 54 #endif // CC_BITMAP_SKPICTURE_CONTENT_LAYER_UPDATER_H_ | |
| OLD | NEW |