app_list: Update separator color.
[chromium-blink-merge.git] / cc / LayerTextureUpdater.h
blob97504989e870f3c5c9c71c89889a9c2d7699d3cc
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 LayerTextureUpdater_h
7 #define LayerTextureUpdater_h
9 #if USE(ACCELERATED_COMPOSITING)
11 #include "CCPrioritizedTexture.h"
12 #include "GraphicsTypes3D.h"
13 #include <wtf/RefCounted.h>
15 namespace WebCore {
17 class IntRect;
18 class IntSize;
19 class TextureManager;
20 struct CCRenderingStats;
22 class LayerTextureUpdater : public RefCounted<LayerTextureUpdater> {
23 public:
24 // Allows texture uploaders to store per-tile resources.
25 class Texture {
26 public:
27 virtual ~Texture() { }
29 CCPrioritizedTexture* texture() { return m_texture.get(); }
30 void swapTextureWith(OwnPtr<CCPrioritizedTexture>& texture) { m_texture.swap(texture); }
31 virtual void prepareRect(const IntRect& /* sourceRect */, CCRenderingStats&) { }
32 virtual void updateRect(CCResourceProvider*, const IntRect& sourceRect, const IntSize& destOffset) = 0;
33 protected:
34 explicit Texture(PassOwnPtr<CCPrioritizedTexture> texture) : m_texture(texture) { }
36 private:
37 OwnPtr<CCPrioritizedTexture> m_texture;
40 virtual ~LayerTextureUpdater() { }
42 enum SampledTexelFormat {
43 SampledTexelFormatRGBA,
44 SampledTexelFormatBGRA,
45 SampledTexelFormatInvalid,
47 virtual PassOwnPtr<Texture> createTexture(CCPrioritizedTextureManager*) = 0;
48 // Returns the format of the texel uploaded by this interface.
49 // This format should not be confused by texture internal format.
50 // This format specifies the component order in the sampled texel.
51 // If the format is TexelFormatBGRA, vec4.x is blue and vec4.z is red.
52 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) = 0;
53 // The |resultingOpaqueRect| gives back a region of the layer that was painted opaque. If the layer is marked opaque in the updater,
54 // then this region should be ignored in preference for the entire layer's area.
55 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) { }
57 // Set true by the layer when it is known that the entire output is going to be opaque.
58 virtual void setOpaque(bool) { }
61 } // namespace WebCore
62 #endif // USE(ACCELERATED_COMPOSITING)
63 #endif // LayerTextureUpdater_h