tizen beta release
[profile/ivi/webkit-efl.git] / Source / WebCore / platform / graphics / chromium / cc / CCTextureUpdater.h
1 /*
2  * Copyright (C) 2011 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1.  Redistributions of source code must retain the above copyright
9  *     notice, this list of conditions and the following disclaimer.
10  * 2.  Redistributions in binary form must reproduce the above copyright
11  *     notice, this list of conditions and the following disclaimer in the
12  *     documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #ifndef CCTextureUpdater_h
27 #define CCTextureUpdater_h
28
29 #include "IntRect.h"
30 #include <wtf/Vector.h>
31
32 namespace WebCore {
33
34 class GraphicsContext3D;
35 class LayerTextureUpdater;
36 class ManagedTexture;
37 class TextureAllocator;
38
39 class CCTextureUpdater {
40 public:
41     CCTextureUpdater(TextureAllocator*);
42     ~CCTextureUpdater();
43
44     void append(ManagedTexture*, LayerTextureUpdater*, const IntRect& sourceRect, const IntRect& destRect);
45
46     bool hasMoreUpdates() const;
47
48     // Update some textures. Returns true if more textures left to process.
49     bool update(GraphicsContext3D*, size_t count);
50
51     void clear();
52
53     TextureAllocator* allocator() { return m_allocator; }
54
55 private:
56     struct UpdateEntry {
57         ManagedTexture* m_texture;
58         LayerTextureUpdater* m_updater;
59         IntRect m_sourceRect;
60         IntRect m_destRect;
61     };
62
63     TextureAllocator* m_allocator;
64     size_t m_entryIndex;
65     Vector<UpdateEntry> m_entries;
66 };
67
68 }
69
70 #endif // CCTextureUpdater_h