OpenGLRenderer.h revision 03750a067e818ca7fbd0f590e2ff6a8fded21e6c
1e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy/*
2e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy * Copyright (C) 2010 The Android Open Source Project
3e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy *
4e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy * Licensed under the Apache License, Version 2.0 (the "License");
5e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy * you may not use this file except in compliance with the License.
6e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy * You may obtain a copy of the License at
7e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy *
8e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy *      http://www.apache.org/licenses/LICENSE-2.0
9e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy *
10e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy * Unless required by applicable law or agreed to in writing, software
11e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy * distributed under the License is distributed on an "AS IS" BASIS,
12e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy * See the License for the specific language governing permissions and
14e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy * limitations under the License.
15e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy */
16e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy
179d5316e3f56d138504565ff311145ac01621dff4Romain Guy#ifndef ANDROID_UI_OPENGL_RENDERER_H
189d5316e3f56d138504565ff311145ac01621dff4Romain Guy#define ANDROID_UI_OPENGL_RENDERER_H
199d5316e3f56d138504565ff311145ac01621dff4Romain Guy
209d5316e3f56d138504565ff311145ac01621dff4Romain Guy#include <GLES2/gl2.h>
219d5316e3f56d138504565ff311145ac01621dff4Romain Guy#include <GLES2/gl2ext.h>
2285bf02fc16784d935fb9eebfa9cb20fe46ff7951Romain Guy
23ce0537b80087a6225273040a987414b1dd081aa0Romain Guy#include <SkBitmap.h>
24f6a11b8a9e25ff9861bbba19251bea84d8a5daf2Romain Guy#include <SkMatrix.h>
25ce0537b80087a6225273040a987414b1dd081aa0Romain Guy#include <SkPaint.h>
26079ba2c85b15e882629b8d188f5fbdb42f7f8eeaRomain Guy#include <SkRegion.h>
27d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy#include <SkShader.h>
2885bf02fc16784d935fb9eebfa9cb20fe46ff7951Romain Guy#include <SkXfermode.h>
29e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy
30bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy#include <utils/RefBase.h>
318694230ff25fa0a60e480d424843e56b718f0516Romain Guy#include <utils/Vector.h>
32bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy
3351769a68a5cb34e9564740c6a854fcb93018789dRomain Guy#include "Extensions.h"
34f6a11b8a9e25ff9861bbba19251bea84d8a5daf2Romain Guy#include "Matrix.h"
355cbbce535744b89df5ecea95de21ee3733298260Romain Guy#include "Program.h"
36bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy#include "Rect.h"
375cbbce535744b89df5ecea95de21ee3733298260Romain Guy#include "Snapshot.h"
38f7f93556c8fcc640ab5adef79d021a80a72a645aRomain Guy#include "Vertex.h"
3906f96e2652e4855b6520ad9dd70583677605b79aRomain Guy#include "SkiaShader.h"
40db1938e0e6ef816e228c815adccebd5cb05f2aa8Romain Guy#include "SkiaColorFilter.h"
41fb8b763f762ae21923c58d64caa729b012f40e05Romain Guy#include "Caches.h"
42bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy
43e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guynamespace android {
449d5316e3f56d138504565ff311145ac01621dff4Romain Guynamespace uirenderer {
45e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy
46f6a11b8a9e25ff9861bbba19251bea84d8a5daf2Romain Guy///////////////////////////////////////////////////////////////////////////////
47b025b9c8b4efefadb01937db61a1f8ee7d2452bfRomain Guy// Defines
48b025b9c8b4efefadb01937db61a1f8ee7d2452bfRomain Guy///////////////////////////////////////////////////////////////////////////////
49b025b9c8b4efefadb01937db61a1f8ee7d2452bfRomain Guy
50b025b9c8b4efefadb01937db61a1f8ee7d2452bfRomain Guy// Debug
51b025b9c8b4efefadb01937db61a1f8ee7d2452bfRomain Guy#define DEBUG_OPENGL 1
52b025b9c8b4efefadb01937db61a1f8ee7d2452bfRomain Guy
53b025b9c8b4efefadb01937db61a1f8ee7d2452bfRomain Guy///////////////////////////////////////////////////////////////////////////////
54f6a11b8a9e25ff9861bbba19251bea84d8a5daf2Romain Guy// Renderer
55f6a11b8a9e25ff9861bbba19251bea84d8a5daf2Romain Guy///////////////////////////////////////////////////////////////////////////////
56f6a11b8a9e25ff9861bbba19251bea84d8a5daf2Romain Guy
57b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guyclass DisplayListRenderer;
58b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy
595cbbce535744b89df5ecea95de21ee3733298260Romain Guy/**
605cbbce535744b89df5ecea95de21ee3733298260Romain Guy * OpenGL renderer used to draw accelerated 2D graphics. The API is a
615cbbce535744b89df5ecea95de21ee3733298260Romain Guy * simplified version of Skia's Canvas API.
625cbbce535744b89df5ecea95de21ee3733298260Romain Guy */
6385bf02fc16784d935fb9eebfa9cb20fe46ff7951Romain Guyclass OpenGLRenderer {
64e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guypublic:
6585bf02fc16784d935fb9eebfa9cb20fe46ff7951Romain Guy    OpenGLRenderer();
66e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy    virtual ~OpenGLRenderer();
67e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy
68b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy    virtual void setViewport(int width, int height);
69e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy
706b7bd24659fb175fe1f0e97c86c18969918b496aRomain Guy    virtual void prepare(bool opaque);
71e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy    virtual void finish();
72e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy
734aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void acquireContext();
744aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void releaseContext();
7508ae317c21ec3086b5017672bba87420cc38a407Romain Guy
76bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy    int getSaveCount() const;
774aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual int save(int flags);
784aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void restore();
794aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void restoreToCount(int saveCount);
80bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy
81e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy    virtual int saveLayer(float left, float top, float right, float bottom,
82e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy            const SkPaint* p, int flags);
83e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy    virtual int saveLayerAlpha(float left, float top, float right, float bottom,
84e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy            int alpha, int flags);
85bd6b79b40247aea7bfe13d0831c6c0472df6c636Romain Guy
864aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void translate(float dx, float dy);
874aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void rotate(float degrees);
884aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void scale(float sx, float sy);
89f6a11b8a9e25ff9861bbba19251bea84d8a5daf2Romain Guy
9041030da16856c8869e1e51d4a0405432fa96614eRomain Guy    const float* getMatrix() const;
91f6a11b8a9e25ff9861bbba19251bea84d8a5daf2Romain Guy    void getMatrix(SkMatrix* matrix);
924aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void setMatrix(SkMatrix* matrix);
934aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void concatMatrix(SkMatrix* matrix);
94f6a11b8a9e25ff9861bbba19251bea84d8a5daf2Romain Guy
959d5316e3f56d138504565ff311145ac01621dff4Romain Guy    const Rect& getClipBounds();
96c7d53494f1fbd9f9d74af89053ff9fdb1ccbac6cRomain Guy    bool quickReject(float left, float top, float right, float bottom);
974aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
98bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy
99e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy    virtual void drawBitmap(SkBitmap* bitmap, float left, float top, const SkPaint* paint);
100e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy    virtual void drawBitmap(SkBitmap* bitmap, const SkMatrix* matrix, const SkPaint* paint);
101e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy    virtual void drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop,
102e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy            float srcRight, float srcBottom, float dstLeft, float dstTop,
103e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy            float dstRight, float dstBottom, const SkPaint* paint);
1044aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int32_t* yDivs,
1054bb942083a0d4db746adf95349108dd8ef842e32Romain Guy            const uint32_t* colors, uint32_t width, uint32_t height, int8_t numColors,
1064bb942083a0d4db746adf95349108dd8ef842e32Romain Guy            float left, float top, float right, float bottom, const SkPaint* paint);
107e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy    virtual void drawColor(int color, SkXfermode::Mode mode);
108e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy    virtual void drawRect(float left, float top, float right, float bottom, const SkPaint* paint);
109e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy    virtual void drawPath(SkPath* path, SkPaint* paint);
110e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy    virtual void drawLines(float* points, int count, const SkPaint* paint);
111e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy    virtual void drawText(const char* text, int bytesCount, int count, float x, float y,
112e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy            SkPaint* paint);
11385bf02fc16784d935fb9eebfa9cb20fe46ff7951Romain Guy
1144aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void resetShader();
1154aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void setupShader(SkiaShader* shader);
116d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy
1174aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void resetColorFilter();
1184aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void setupColorFilter(SkiaColorFilter* filter);
119db1938e0e6ef816e228c815adccebd5cb05f2aa8Romain Guy
1204aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void resetShadow();
1214aa90573bbf86db0d33a3a790c5dbd0d93b95cfeRomain Guy    virtual void setupShadow(float radius, float dx, float dy, int color);
1221e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy
123e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guyprotected:
124e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy    /**
125e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy     * Compose the layer defined in the current snapshot with the layer
126e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy     * defined by the previous snapshot.
127e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy     *
128e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy     * The current snapshot *must* be a layer (flag kFlagIsLayer set.)
129e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy     *
130e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy     * @param curent The current snapshot containing the layer to compose
131e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy     * @param previous The previous snapshot to compose the current layer with
132e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy     */
133e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy    virtual void composeLayer(sp<Snapshot> current, sp<Snapshot> previous);
134694b519ac647fe998fd396fe0784cc8e179aadc4Romain Guy
13508ae317c21ec3086b5017672bba87420cc38a407Romain Guyprivate:
1365cbbce535744b89df5ecea95de21ee3733298260Romain Guy    /**
1375cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * Saves the current state of the renderer as a new snapshot.
1385cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * The new snapshot is saved in mSnapshot and the previous snapshot
1395cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * is linked from mSnapshot->previous.
1405cbbce535744b89df5ecea95de21ee3733298260Romain Guy     *
1418aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy     * @param flags The save flags; see SkCanvas for more information
1428aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy     *
1435cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * @return The new save count. This value can be passed to #restoreToCount()
1445cbbce535744b89df5ecea95de21ee3733298260Romain Guy     */
1458aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy    int saveSnapshot(int flags);
1465cbbce535744b89df5ecea95de21ee3733298260Romain Guy
1475cbbce535744b89df5ecea95de21ee3733298260Romain Guy    /**
1485cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * Restores the current snapshot; mSnapshot becomes mSnapshot->previous.
1495cbbce535744b89df5ecea95de21ee3733298260Romain Guy     *
1502542d199745cdf3ec910b8e3e4cff5851ed24e9bRomain Guy     * @return True if the clip was modified.
1515cbbce535744b89df5ecea95de21ee3733298260Romain Guy     */
152bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy    bool restoreSnapshot();
153bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy
1545cbbce535744b89df5ecea95de21ee3733298260Romain Guy    /**
1555cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * Sets the clipping rectangle using glScissor. The clip is defined by
1565cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * the current snapshot's clipRect member.
1575cbbce535744b89df5ecea95de21ee3733298260Romain Guy     */
158bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy    void setScissorFromClip();
159bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy
1605cbbce535744b89df5ecea95de21ee3733298260Romain Guy    /**
161d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy     * Creates a new layer stored in the specified snapshot.
162d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy     *
163d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy     * @param snapshot The snapshot associated with the new layer
164d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy     * @param left The left coordinate of the layer
165d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy     * @param top The top coordinate of the layer
166d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy     * @param right The right coordinate of the layer
167d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy     * @param bottom The bottom coordinate of the layer
168d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy     * @param alpha The translucency of the layer
169d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy     * @param mode The blending mode of the layer
170d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy     * @param flags The layer save flags
171eb99356a0548684a501766e6a524529ab93304c8Romain Guy     * @param previousFbo The name of the current framebuffer
172d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy     *
173d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy     * @return True if the layer was successfully created, false otherwise
174d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy     */
175d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy    bool createLayer(sp<Snapshot> snapshot, float left, float top, float right, float bottom,
176eb99356a0548684a501766e6a524529ab93304c8Romain Guy            int alpha, SkXfermode::Mode mode, int flags, GLuint previousFbo);
177d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy
178d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy    /**
1798694230ff25fa0a60e480d424843e56b718f0516Romain Guy     * Clears all the regions corresponding to the current list of layers.
1808694230ff25fa0a60e480d424843e56b718f0516Romain Guy     * This method MUST be invoked before any drawing operation.
1818694230ff25fa0a60e480d424843e56b718f0516Romain Guy     */
1828694230ff25fa0a60e480d424843e56b718f0516Romain Guy    void clearLayerRegions();
1838694230ff25fa0a60e480d424843e56b718f0516Romain Guy
1848694230ff25fa0a60e480d424843e56b718f0516Romain Guy    /**
1855cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * Draws a colored rectangle with the specified color. The specified coordinates
1865cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * are transformed by the current snapshot's transform matrix.
1875cbbce535744b89df5ecea95de21ee3733298260Romain Guy     *
1885cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * @param left The left coordinate of the rectangle
1895cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * @param top The top coordinate of the rectangle
1905cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * @param right The right coordinate of the rectangle
1915cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * @param bottom The bottom coordinate of the rectangle
1925cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * @param color The rectangle's ARGB color, defined as a packed 32 bits word
193026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy     * @param mode The Skia xfermode to use
1943d58c03de0d8877b36cdb78b0ca8b5cac7f600e2Romain Guy     * @param ignoreTransform True if the current transform should be ignored
195f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy     * @paran ignoreBlending True if the blending is set by the caller
1965cbbce535744b89df5ecea95de21ee3733298260Romain Guy     */
197026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy    void drawColorRect(float left, float top, float right, float bottom,
1981c740bce8a762f02b5283045a0e2de7c8fb41277Romain Guy            int color, SkXfermode::Mode mode, bool ignoreTransform = false);
1995cbbce535744b89df5ecea95de21ee3733298260Romain Guy
2005cbbce535744b89df5ecea95de21ee3733298260Romain Guy    /**
201c95c8d6bf8fda5c4e8ebd0033b789be7868e6e07Romain Guy     * Setups shaders to draw a colored rect.
202c95c8d6bf8fda5c4e8ebd0033b789be7868e6e07Romain Guy     */
203c95c8d6bf8fda5c4e8ebd0033b789be7868e6e07Romain Guy    void setupColorRect(float left, float top, float right, float bottom,
204c95c8d6bf8fda5c4e8ebd0033b789be7868e6e07Romain Guy            float r, float g, float b, float a, SkXfermode::Mode mode, bool ignoreTransform);
205c95c8d6bf8fda5c4e8ebd0033b789be7868e6e07Romain Guy
206c95c8d6bf8fda5c4e8ebd0033b789be7868e6e07Romain Guy    /**
2075cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * Draws a textured rectangle with the specified texture. The specified coordinates
2085cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * are transformed by the current snapshot's transform matrix.
2095cbbce535744b89df5ecea95de21ee3733298260Romain Guy     *
2105cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * @param left The left coordinate of the rectangle
2115cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * @param top The top coordinate of the rectangle
2125cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * @param right The right coordinate of the rectangle
2135cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * @param bottom The bottom coordinate of the rectangle
2145cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * @param texture The texture name to map onto the rectangle
2155cbbce535744b89df5ecea95de21ee3733298260Romain Guy     * @param alpha An additional translucency parameter, between 0.0f and 1.0f
216d55a86120dd1e8ebcc6906c9ffd463f7460348daRomain Guy     * @param mode The blending mode
217c1396e93b6a5286a5183c00c781b62e940a12c1fRomain Guy     * @param blend True if the texture contains an alpha channel
2185cbbce535744b89df5ecea95de21ee3733298260Romain Guy     */
219bd6b79b40247aea7bfe13d0831c6c0472df6c636Romain Guy    void drawTextureRect(float left, float top, float right, float bottom, GLuint texture,
220a979474f15b454c8e2963f239a3770e200bb227cRomain Guy            float alpha, SkXfermode::Mode mode, bool blend);
221c7d53494f1fbd9f9d74af89053ff9fdb1ccbac6cRomain Guy
222026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy    /**
22382ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * Draws a textured rectangle with the specified texture. The specified coordinates
22482ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * are transformed by the current snapshot's transform matrix.
22582ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     *
22682ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param left The left coordinate of the rectangle
22782ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param top The top coordinate of the rectangle
22882ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param right The right coordinate of the rectangle
22982ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param bottom The bottom coordinate of the rectangle
23082ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param texture The texture to use
23182ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param paint The paint containing the alpha, blending mode, etc.
23282ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     */
233a979474f15b454c8e2963f239a3770e200bb227cRomain Guy    void drawTextureRect(float left, float top, float right, float bottom,
234a979474f15b454c8e2963f239a3770e200bb227cRomain Guy            const Texture* texture, const SkPaint* paint);
23582ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy
23682ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy    /**
23703750a067e818ca7fbd0f590e2ff6a8fded21e6cRomain Guy     * Draws a textured mesh with the specified texture. If the indices are omitted,
23803750a067e818ca7fbd0f590e2ff6a8fded21e6cRomain Guy     * the mesh is drawn as a simple quad. The mesh pointers become offsets when a
23903750a067e818ca7fbd0f590e2ff6a8fded21e6cRomain Guy     * VBO is bound.
24082ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     *
24182ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param left The left coordinate of the rectangle
24282ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param top The top coordinate of the rectangle
24382ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param right The right coordinate of the rectangle
24482ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param bottom The bottom coordinate of the rectangle
24582ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param texture The texture name to map onto the rectangle
24682ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param alpha An additional translucency parameter, between 0.0f and 1.0f
24782ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param mode The blending mode
24882ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param blend True if the texture contains an alpha channel
24982ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param vertices The vertices that define the mesh
25082ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param texCoords The texture coordinates of each vertex
25182ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * @param elementsCount The number of elements in the mesh, required by indices
252f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy     * @param swapSrcDst Whether or not the src and dst blending operations should be swapped
253f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy     * @param ignoreTransform True if the current transform should be ignored
25403750a067e818ca7fbd0f590e2ff6a8fded21e6cRomain Guy     * @param vbo The VBO used to draw the mesh
255f7f93556c8fcc640ab5adef79d021a80a72a645aRomain Guy     */
256f7f93556c8fcc640ab5adef79d021a80a72a645aRomain Guy    void drawTextureMesh(float left, float top, float right, float bottom, GLuint texture,
257a979474f15b454c8e2963f239a3770e200bb227cRomain Guy            float alpha, SkXfermode::Mode mode, bool blend,
2586820ac8b14b4558f5d8b833dde80895306a3e137Romain Guy            GLvoid* vertices, GLvoid* texCoords, GLenum drawMode, GLsizei elementsCount,
25903750a067e818ca7fbd0f590e2ff6a8fded21e6cRomain Guy            bool swapSrcDst = false, bool ignoreTransform = false, GLuint vbo = 0);
260f7f93556c8fcc640ab5adef79d021a80a72a645aRomain Guy
261f7f93556c8fcc640ab5adef79d021a80a72a645aRomain Guy    /**
2620a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * Prepares the renderer to draw the specified shadow.
2631e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     *
2641e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     * @param texture The shadow texture
2651e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     * @param x The x coordinate of the shadow
2661e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     * @param y The y coordinate of the shadow
2671e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     * @param mode The blending mode
2682542d199745cdf3ec910b8e3e4cff5851ed24e9bRomain Guy     * @param alpha The alpha value
2691e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     */
2702542d199745cdf3ec910b8e3e4cff5851ed24e9bRomain Guy    void setupShadow(const ShadowTexture* texture, float x, float y, SkXfermode::Mode mode,
2712542d199745cdf3ec910b8e3e4cff5851ed24e9bRomain Guy            float alpha);
2721e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy
2731e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy    /**
2740a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * Prepares the renderer to draw the specified Alpha8 texture as a rectangle.
2751e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     *
2761e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     * @param texture The texture to render with
2771e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     * @param textureUnit The texture unit to use, may be modified
2781e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     * @param x The x coordinate of the rectangle to draw
2791e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     * @param y The y coordinate of the rectangle to draw
2801e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     * @param r The red component of the color
2811e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     * @param g The green component of the color
2821e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     * @param b The blue component of the color
2831e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     * @param a The alpha component of the color
2841e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     * @param mode The blending mode
2850a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param transforms True if the matrix passed to the shader should be multiplied
2860a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     *        by the model-view matrix
2871e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     * @param applyFilters Whether or not to take color filters and
2881e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     *        shaders into account
2891e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy     */
2900a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy    void setupTextureAlpha8(const Texture* texture, GLuint& textureUnit, float x, float y,
2910a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy            float r, float g, float b, float a, SkXfermode::Mode mode, bool transforms,
2920a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy            bool applyFilters);
2930a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy
2940a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy    /**
2950a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * Prepares the renderer to draw the specified Alpha8 texture as a rectangle.
2960a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     *
2970a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param texture The texture to render with
2980a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param width The width of the texture
2990a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param height The height of the texture
3000a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param textureUnit The texture unit to use, may be modified
3010a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param x The x coordinate of the rectangle to draw
3020a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param y The y coordinate of the rectangle to draw
3030a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param r The red component of the color
3040a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param g The green component of the color
3050a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param b The blue component of the color
3060a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param a The alpha component of the color
3070a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param mode The blending mode
3080a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param transforms True if the matrix passed to the shader should be multiplied
3090a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     *        by the model-view matrix
3100a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param applyFilters Whether or not to take color filters and
3110a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     *        shaders into account
3120a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     */
3130a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy    void setupTextureAlpha8(GLuint texture, uint32_t width, uint32_t height,
3140a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy            GLuint& textureUnit, float x, float y, float r, float g, float b, float a,
3150a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy            SkXfermode::Mode mode, bool transforms, bool applyFilters);
3160a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy
3170a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy    /**
318759ea80dca64ad652110a129e0d8bf93fea79f61Romain Guy     * Same as above setupTextureAlpha8() but specifies the mesh's vertices
31903750a067e818ca7fbd0f590e2ff6a8fded21e6cRomain Guy     * and texCoords pointers. The pointers become offsets when a VBO is bound.
320759ea80dca64ad652110a129e0d8bf93fea79f61Romain Guy     */
321759ea80dca64ad652110a129e0d8bf93fea79f61Romain Guy    void setupTextureAlpha8(GLuint texture, uint32_t width, uint32_t height,
322759ea80dca64ad652110a129e0d8bf93fea79f61Romain Guy            GLuint& textureUnit, float x, float y, float r, float g, float b, float a,
323759ea80dca64ad652110a129e0d8bf93fea79f61Romain Guy            SkXfermode::Mode mode, bool transforms, bool applyFilters,
32403750a067e818ca7fbd0f590e2ff6a8fded21e6cRomain Guy            GLvoid* vertices, GLvoid* texCoords, GLuint vbo = 0);
325759ea80dca64ad652110a129e0d8bf93fea79f61Romain Guy
326759ea80dca64ad652110a129e0d8bf93fea79f61Romain Guy    /**
3270a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * Draws text underline and strike-through if needed.
3280a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     *
3290a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param text The text to decor
3300a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param bytesCount The number of bytes in the text
3310a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param length The length in pixels of the text, can be <= 0.0f to force a measurement
3320a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param x The x coordinate where the text will be drawn
3330a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param y The y coordinate where the text will be drawn
3340a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     * @param paint The paint to draw the text with
3350a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy     */
3360a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy    void drawTextDecorations(const char* text, int bytesCount, float length,
3370a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy            float x, float y, SkPaint* paint);
3381e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy
3391e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy    /**
340ac670c0433d19397d4e36ced2110475b6f54fe26Romain Guy     * Resets the texture coordinates stored in mMeshVertices. Setting the values
341026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy     * back to default is achieved by calling:
342026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy     *
3438ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy     * resetDrawTextureTexCoords(0.0f, 0.0f, 1.0f, 1.0f);
344026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy     *
345026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy     * @param u1 The left coordinate of the texture
346026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy     * @param v1 The bottom coordinate of the texture
347026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy     * @param u2 The right coordinate of the texture
348026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy     * @param v2 The top coordinate of the texture
349026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy     */
350026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy    void resetDrawTextureTexCoords(float u1, float v1, float u2, float v2);
351026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy
3528ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy    /**
3538ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy     * Gets the alpha and xfermode out of a paint object. If the paint is null
3548ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy     * alpha will be 255 and the xfermode will be SRC_OVER.
3558ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy     *
3568ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy     * @param paint The paint to extract values from
3578ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy     * @param alpha Where to store the resulting alpha
3588ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy     * @param mode Where to store the resulting xfermode
3598ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy     */
3608ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy    inline void getAlphaAndMode(const SkPaint* paint, int* alpha, SkXfermode::Mode* mode);
3618ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy
362f7f93556c8fcc640ab5adef79d021a80a72a645aRomain Guy    /**
363a1db574036c9bc2d397b69f8200594027e1fff16Romain Guy     * Binds the specified texture with the specified wrap modes.
364a1db574036c9bc2d397b69f8200594027e1fff16Romain Guy     */
365889f8d1403761d5668115ced6cbb3f767cfe966dRomain Guy    inline void bindTexture(GLuint texture, GLenum wrapS, GLenum wrapT, GLuint textureUnit = 0);
366a1db574036c9bc2d397b69f8200594027e1fff16Romain Guy
367a1db574036c9bc2d397b69f8200594027e1fff16Romain Guy    /**
36882ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * Enable or disable blending as necessary. This function sets the appropriate
36982ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     * blend function based on the specified xfermode.
37082ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy     */
371f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy    inline void chooseBlending(bool blend, SkXfermode::Mode mode, ProgramDescription& description,
372f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy            bool swapSrcDst = false);
373a5aed0d58962a24c44728ffc46dc9e1ba2f9fda5Romain Guy
374f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy    /**
375f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy     * Safely retrieves the mode from the specified xfermode. If the specified
376f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy     * xfermode is null, the mode is assumed to be SkXfermode::kSrcOver_Mode.
377f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy     */
378a5aed0d58962a24c44728ffc46dc9e1ba2f9fda5Romain Guy    inline SkXfermode::Mode getXfermode(SkXfermode* mode);
37982ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy
380260e102162322958cf17dbd895cd6bd30dc87e32Romain Guy    /**
381d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy     * Use the specified program with the current GL context. If the program is already
382d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy     * in use, it will not be bound again. If it is not in use, the current program is
383d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy     * marked unused and the specified program becomes used and becomes the new
384d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy     * current program.
3856926c72e25b8dec3dd4b84af0819fa1937ae7296Romain Guy     *
386d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy     * @param program The program to use
387d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy     *
388d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy     * @return true If the specified program was already in use, false otherwise.
389260e102162322958cf17dbd895cd6bd30dc87e32Romain Guy     */
390889f8d1403761d5668115ced6cbb3f767cfe966dRomain Guy    inline bool useProgram(Program* program);
391260e102162322958cf17dbd895cd6bd30dc87e32Romain Guy
392bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy    // Dimensions of the drawing surface
393bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy    int mWidth, mHeight;
394bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy
39585bf02fc16784d935fb9eebfa9cb20fe46ff7951Romain Guy    // Matrix used for ortho projection in shaders
396260e102162322958cf17dbd895cd6bd30dc87e32Romain Guy    mat4 mOrthoMatrix;
397bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy
398c7d53494f1fbd9f9d74af89053ff9fdb1ccbac6cRomain Guy    // Model-view matrix used to position/size objects
399c7d53494f1fbd9f9d74af89053ff9fdb1ccbac6cRomain Guy    mat4 mModelView;
400c7d53494f1fbd9f9d74af89053ff9fdb1ccbac6cRomain Guy
401bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy    // Number of saved states
402bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy    int mSaveCount;
403f6a11b8a9e25ff9861bbba19251bea84d8a5daf2Romain Guy    // Base state
404ae5575b3421c8fbe590ab046d7d5f2b36ecfd821Romain Guy    sp<Snapshot> mFirstSnapshot;
405bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy    // Current state
406bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy    sp<Snapshot> mSnapshot;
4079d5316e3f56d138504565ff311145ac01621dff4Romain Guy
4089d5316e3f56d138504565ff311145ac01621dff4Romain Guy    // Shaders
40906f96e2652e4855b6520ad9dd70583677605b79aRomain Guy    SkiaShader* mShader;
410026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy
411db1938e0e6ef816e228c815adccebd5cb05f2aa8Romain Guy    // Color filters
412db1938e0e6ef816e228c815adccebd5cb05f2aa8Romain Guy    SkiaColorFilter* mColorFilter;
413db1938e0e6ef816e228c815adccebd5cb05f2aa8Romain Guy
414026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy    // Used to draw textured quads
415ac670c0433d19397d4e36ced2110475b6f54fe26Romain Guy    TextureVertex mMeshVertices[4];
416ce0537b80087a6225273040a987414b1dd081aa0Romain Guy
41751769a68a5cb34e9564740c6a854fcb93018789dRomain Guy    // GL extensions
41851769a68a5cb34e9564740c6a854fcb93018789dRomain Guy    Extensions mExtensions;
41951769a68a5cb34e9564740c6a854fcb93018789dRomain Guy
4201e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy    // Drop shadow
4211e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy    bool mHasShadow;
4221e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy    float mShadowRadius;
4231e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy    float mShadowDx;
4241e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy    float mShadowDy;
4251e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy    int mShadowColor;
4261e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy
42782ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy    // Various caches
428fb8b763f762ae21923c58d64caa729b012f40e05Romain Guy    Caches& mCaches;
4298694230ff25fa0a60e480d424843e56b718f0516Romain Guy
4308694230ff25fa0a60e480d424843e56b718f0516Romain Guy    // List of rectangles to clear due to calls to saveLayer()
4318694230ff25fa0a60e480d424843e56b718f0516Romain Guy    Vector<Rect*> mLayers;
4328694230ff25fa0a60e480d424843e56b718f0516Romain Guy
433759ea80dca64ad652110a129e0d8bf93fea79f61Romain Guy    // Misc
434b025b9c8b4efefadb01937db61a1f8ee7d2452bfRomain Guy    GLint mMaxTextureSize;
435b025b9c8b4efefadb01937db61a1f8ee7d2452bfRomain Guy
43699bcdc52dcb365ed7d8cfa13540fb33fbcbbac9dRomain Guy    // Indentity matrix
43799bcdc52dcb365ed7d8cfa13540fb33fbcbbac9dRomain Guy    const mat4 mIdentity;
43899bcdc52dcb365ed7d8cfa13540fb33fbcbbac9dRomain Guy
439b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy    friend class DisplayListRenderer;
440b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy
441bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy}; // class OpenGLRenderer
442e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy
4439d5316e3f56d138504565ff311145ac01621dff4Romain Guy}; // namespace uirenderer
444e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy}; // namespace android
445e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy
4469d5316e3f56d138504565ff311145ac01621dff4Romain Guy#endif // ANDROID_UI_OPENGL_RENDERER_H
447