Remove extra line from unit_tests.isolate
[chromium-blink-merge.git] / cc / LayerTextureUpdater.h
blob89fc520475a64d1261bc27a0c7916b1745b55b05
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 cc {
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(scoped_ptr<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 virtual bool backingResourceWasEvicted() const;
34 protected:
35 explicit Texture(scoped_ptr<CCPrioritizedTexture> texture);
37 private:
38 scoped_ptr<CCPrioritizedTexture> m_texture;
41 LayerTextureUpdater()
43 turnOffVerifier(); // In the component build we don't have WTF threading initialized in this DLL so the thread verifier explodes.
46 virtual ~LayerTextureUpdater() { }
48 enum SampledTexelFormat {
49 SampledTexelFormatRGBA,
50 SampledTexelFormatBGRA,
51 SampledTexelFormatInvalid,
53 virtual PassOwnPtr<Texture> createTexture(CCPrioritizedTextureManager*) = 0;
54 // Returns the format of the texel uploaded by this interface.
55 // This format should not be confused by texture internal format.
56 // This format specifies the component order in the sampled texel.
57 // If the format is TexelFormatBGRA, vec4.x is blue and vec4.z is red.
58 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) = 0;
59 // The |resultingOpaqueRect| gives back a region of the layer that was painted opaque. If the layer is marked opaque in the updater,
60 // then this region should be ignored in preference for the entire layer's area.
61 virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) { }
63 // Set true by the layer when it is known that the entire output is going to be opaque.
64 virtual void setOpaque(bool) { }
67 } // namespace cc
68 #endif // USE(ACCELERATED_COMPOSITING)
69 #endif // LayerTextureUpdater_h