2 * Copyright 2010, The Android Open Source Project
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #if USE(ACCELERATED_COMPOSITING)
37 #include <EGL/eglext.h>
38 #include <GLES2/gl2.h>
42 class BackedDoubleBufferedTexture;
46 * An individual tile that is used to construct part of a webpage's BaseLayer of
47 * content. Each tile is assigned to a TiledPage and is responsible for drawing
48 * and displaying their section of the page. The lifecycle of a tile is:
50 * 1. Each tile is created on the main GL thread and assigned to a specific
51 * location within a TiledPage.
52 * 2. When needed the tile is passed to the background thread where it paints
53 * the BaseLayer's most recent PictureSet to a bitmap which is then uploaded
55 * 3. After the bitmap is uploaded to the GPU the main GL thread then uses the
56 * tile's draw() function to display the tile to the screen.
57 * 4. Steps 2-3 are repeated as necessary.
58 * 5. The tile is destroyed when the user navigates to a new page.
66 BaseTile(TiledPage* page, int x, int y);
69 void reserveTexture();
71 void setUsedLevel(int);
73 void draw(float transparency, SkRect& rect);
75 // the only thread-safe function called by the background thread
78 float scale() const { return m_scale; }
79 void setScale(float scale);
81 TiledPage* page() { return m_page; }
82 int x() const { return m_x; }
83 int y() const { return m_y; }
84 BackedDoubleBufferedTexture* texture() { return m_texture; }
87 // these variables are only set when the object is constructed
92 // these variables can be updated throughout the lifetime of the object
93 BackedDoubleBufferedTexture* m_texture;
97 } // namespace WebCore
99 #endif // USE(ACCELERATED_COMPOSITING)