OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 // Temporary forwarding header |
6 #ifndef BitmapCanvasLayerTextureUpdater_h | 6 #include "cc/bitmap_canvas_layer_texture_updater.h" |
7 #define BitmapCanvasLayerTextureUpdater_h | |
8 | |
9 #if USE(ACCELERATED_COMPOSITING) | |
10 | |
11 #include "CanvasLayerTextureUpdater.h" | |
12 | |
13 class SkCanvas; | |
14 | |
15 namespace cc { | |
16 | |
17 class LayerPainterChromium; | |
18 | |
19 // This class rasterizes the contentRect into a skia bitmap canvas. It then upda
tes | |
20 // textures by copying from the canvas into the texture, using MapSubImage if | |
21 // possible. | |
22 class BitmapCanvasLayerTextureUpdater : public CanvasLayerTextureUpdater { | |
23 public: | |
24 class Texture : public LayerTextureUpdater::Texture { | |
25 public: | |
26 Texture(BitmapCanvasLayerTextureUpdater*, scoped_ptr<CCPrioritizedTextur
e>); | |
27 virtual ~Texture(); | |
28 | |
29 virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect,
const IntSize& destOffset) OVERRIDE; | |
30 | |
31 private: | |
32 BitmapCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpda
ter; } | |
33 | |
34 BitmapCanvasLayerTextureUpdater* m_textureUpdater; | |
35 }; | |
36 | |
37 static PassRefPtr<BitmapCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPa
interChromium>); | |
38 virtual ~BitmapCanvasLayerTextureUpdater(); | |
39 | |
40 virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritized
TextureManager*) OVERRIDE; | |
41 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRI
DE; | |
42 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tile
Size, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpa
queRect, CCRenderingStats&) OVERRIDE; | |
43 void updateTextureRect(CCResourceProvider*, CCPrioritizedTexture*, const Int
Rect& sourceRect, const IntSize& destOffset); | |
44 | |
45 virtual void setOpaque(bool) OVERRIDE; | |
46 | |
47 protected: | |
48 explicit BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); | |
49 | |
50 OwnPtr<SkCanvas> m_canvas; | |
51 IntSize m_canvasSize; | |
52 bool m_opaque; | |
53 }; | |
54 | |
55 } // namespace cc | |
56 #endif // USE(ACCELERATED_COMPOSITING) | |
57 #endif // BitmapCanvasLayerTextureUpdater_h | |
OLD | NEW |