OpenGLRenderer.h revision 746b7401ceb86b5f2805f8c0d3b39ac739152015
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, 825c13d89c1332fcc499379b9064b891187b75ca32Chet Haase 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 995c13d89c1332fcc499379b9064b891187b75ca32Chet Haase virtual void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint); 1005c13d89c1332fcc499379b9064b891187b75ca32Chet Haase virtual void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint); 101e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy virtual void drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop, 102e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy float srcRight, float srcBottom, float dstLeft, float dstTop, 1035c13d89c1332fcc499379b9064b891187b75ca32Chet Haase float dstRight, float dstBottom, 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, 1065c13d89c1332fcc499379b9064b891187b75ca32Chet Haase float left, float top, float right, float bottom, SkPaint* paint); 107e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy virtual void drawColor(int color, SkXfermode::Mode mode); 1085c13d89c1332fcc499379b9064b891187b75ca32Chet Haase virtual void drawRect(float left, float top, float right, float bottom, SkPaint* paint); 109e2d345ea67e2960b37bfdc0fc8626d1bfa747404Romain Guy virtual void drawPath(SkPath* path, SkPaint* paint); 1105c13d89c1332fcc499379b9064b891187b75ca32Chet Haase virtual void drawLines(float* points, int count, 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, 2348164c2d338781c3a3c4a443941070dca5d88f2a7Romain Guy Texture* texture, 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 /** 262746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy * Prepares the renderer to draw the specified shadow. The active texture 263746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy * unit must be 0 and the other units must be unbound. 2641e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * 2651e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * @param texture The shadow texture 2661e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * @param x The x coordinate of the shadow 2671e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * @param y The y coordinate of the shadow 2681e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * @param mode The blending mode 2692542d199745cdf3ec910b8e3e4cff5851ed24e9bRomain Guy * @param alpha The alpha value 2701e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy */ 2712542d199745cdf3ec910b8e3e4cff5851ed24e9bRomain Guy void setupShadow(const ShadowTexture* texture, float x, float y, SkXfermode::Mode mode, 2722542d199745cdf3ec910b8e3e4cff5851ed24e9bRomain Guy float alpha); 2731e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy 2741e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy /** 2750a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * Prepares the renderer to draw the specified Alpha8 texture as a rectangle. 2761e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * 2771e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * @param texture The texture to render with 2781e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * @param textureUnit The texture unit to use, may be modified 2791e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * @param x The x coordinate of the rectangle to draw 2801e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * @param y The y coordinate of the rectangle to draw 2811e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * @param r The red component of the color 2821e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * @param g The green component of the color 2831e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * @param b The blue component of the color 2841e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * @param a The alpha component of the color 2851e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * @param mode The blending mode 2860a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param transforms True if the matrix passed to the shader should be multiplied 2870a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * by the model-view matrix 2881e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * @param applyFilters Whether or not to take color filters and 2891e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy * shaders into account 2901e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy */ 2910a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy void setupTextureAlpha8(const Texture* texture, GLuint& textureUnit, float x, float y, 2920a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy float r, float g, float b, float a, SkXfermode::Mode mode, bool transforms, 2930a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy bool applyFilters); 2940a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy 2950a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy /** 2960a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * Prepares the renderer to draw the specified Alpha8 texture as a rectangle. 2970a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * 2980a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param texture The texture to render with 2990a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param width The width of the texture 3000a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param height The height of the texture 3010a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param textureUnit The texture unit to use, may be modified 3020a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param x The x coordinate of the rectangle to draw 3030a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param y The y coordinate of the rectangle to draw 3040a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param r The red component of the color 3050a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param g The green component of the color 3060a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param b The blue component of the color 3070a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param a The alpha component of the color 3080a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param mode The blending mode 3090a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param transforms True if the matrix passed to the shader should be multiplied 3100a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * by the model-view matrix 3110a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param applyFilters Whether or not to take color filters and 3120a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * shaders into account 3130a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy */ 3140a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy void setupTextureAlpha8(GLuint texture, uint32_t width, uint32_t height, 3150a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy GLuint& textureUnit, float x, float y, float r, float g, float b, float a, 3160a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy SkXfermode::Mode mode, bool transforms, bool applyFilters); 3170a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy 3180a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy /** 319759ea80dca64ad652110a129e0d8bf93fea79f61Romain Guy * Same as above setupTextureAlpha8() but specifies the mesh's vertices 32003750a067e818ca7fbd0f590e2ff6a8fded21e6cRomain Guy * and texCoords pointers. The pointers become offsets when a VBO is bound. 321759ea80dca64ad652110a129e0d8bf93fea79f61Romain Guy */ 322759ea80dca64ad652110a129e0d8bf93fea79f61Romain Guy void setupTextureAlpha8(GLuint texture, uint32_t width, uint32_t height, 323759ea80dca64ad652110a129e0d8bf93fea79f61Romain Guy GLuint& textureUnit, float x, float y, float r, float g, float b, float a, 324759ea80dca64ad652110a129e0d8bf93fea79f61Romain Guy SkXfermode::Mode mode, bool transforms, bool applyFilters, 32503750a067e818ca7fbd0f590e2ff6a8fded21e6cRomain Guy GLvoid* vertices, GLvoid* texCoords, GLuint vbo = 0); 326759ea80dca64ad652110a129e0d8bf93fea79f61Romain Guy 327759ea80dca64ad652110a129e0d8bf93fea79f61Romain Guy /** 3280a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * Draws text underline and strike-through if needed. 3290a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * 3300a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param text The text to decor 3310a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param bytesCount The number of bytes in the text 3320a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param length The length in pixels of the text, can be <= 0.0f to force a measurement 3330a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param x The x coordinate where the text will be drawn 3340a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param y The y coordinate where the text will be drawn 3350a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy * @param paint The paint to draw the text with 3360a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy */ 3370a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy void drawTextDecorations(const char* text, int bytesCount, float length, 3380a41749953f35d33f61b3119e3161a82bb5fa59eRomain Guy float x, float y, SkPaint* paint); 3391e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy 3401e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy /** 341ac670c0433d19397d4e36ced2110475b6f54fe26Romain Guy * Resets the texture coordinates stored in mMeshVertices. Setting the values 342026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy * back to default is achieved by calling: 343026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy * 3448ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy * resetDrawTextureTexCoords(0.0f, 0.0f, 1.0f, 1.0f); 345026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy * 346026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy * @param u1 The left coordinate of the texture 347026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy * @param v1 The bottom coordinate of the texture 348026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy * @param u2 The right coordinate of the texture 349026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy * @param v2 The top coordinate of the texture 350026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy */ 351026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy void resetDrawTextureTexCoords(float u1, float v1, float u2, float v2); 352026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy 3538ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy /** 3548ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy * Gets the alpha and xfermode out of a paint object. If the paint is null 3558ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy * alpha will be 255 and the xfermode will be SRC_OVER. 3568ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy * 3578ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy * @param paint The paint to extract values from 3588ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy * @param alpha Where to store the resulting alpha 3598ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy * @param mode Where to store the resulting xfermode 3608ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy */ 3615c13d89c1332fcc499379b9064b891187b75ca32Chet Haase inline void getAlphaAndMode(SkPaint* paint, int* alpha, SkXfermode::Mode* mode); 3628ba548f81d1ab5f1750cbf86098c4a14e0b8beadRomain Guy 363f7f93556c8fcc640ab5adef79d021a80a72a645aRomain Guy /** 364746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy * Binds the specified texture. The texture unit must have been selected 365746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy * prior to calling this method. 366a1db574036c9bc2d397b69f8200594027e1fff16Romain Guy */ 367746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy inline void bindTexture(GLuint texture) { 368746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy glBindTexture(GL_TEXTURE_2D, texture); 369746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy } 370746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy 371746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy /** 372746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy * Sets the wrap modes for the specified texture. The wrap modes are modified 373746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy * only when needed. 374746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy */ 375746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy inline void setTextureWrapModes(Texture* texture, GLenum wrapS, GLenum wrapT); 376a1db574036c9bc2d397b69f8200594027e1fff16Romain Guy 377a1db574036c9bc2d397b69f8200594027e1fff16Romain Guy /** 37882ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy * Enable or disable blending as necessary. This function sets the appropriate 37982ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy * blend function based on the specified xfermode. 38082ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy */ 381f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy inline void chooseBlending(bool blend, SkXfermode::Mode mode, ProgramDescription& description, 382f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy bool swapSrcDst = false); 383a5aed0d58962a24c44728ffc46dc9e1ba2f9fda5Romain Guy 384f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy /** 385f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy * Safely retrieves the mode from the specified xfermode. If the specified 386f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy * xfermode is null, the mode is assumed to be SkXfermode::kSrcOver_Mode. 387f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy */ 388a5aed0d58962a24c44728ffc46dc9e1ba2f9fda5Romain Guy inline SkXfermode::Mode getXfermode(SkXfermode* mode); 38982ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy 390260e102162322958cf17dbd895cd6bd30dc87e32Romain Guy /** 391d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy * Use the specified program with the current GL context. If the program is already 392d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy * in use, it will not be bound again. If it is not in use, the current program is 393d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy * marked unused and the specified program becomes used and becomes the new 394d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy * current program. 3956926c72e25b8dec3dd4b84af0819fa1937ae7296Romain Guy * 396d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy * @param program The program to use 397d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy * 398d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy * @return true If the specified program was already in use, false otherwise. 399260e102162322958cf17dbd895cd6bd30dc87e32Romain Guy */ 400889f8d1403761d5668115ced6cbb3f767cfe966dRomain Guy inline bool useProgram(Program* program); 401260e102162322958cf17dbd895cd6bd30dc87e32Romain Guy 402746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy /** 403746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy * Invoked before any drawing operation. This sets required state. 404746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy */ 405746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy void setupDraw(); 406746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy 407746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy /** 408746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy * Should be invoked every time the glScissor is modified. 409746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy */ 410746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy inline void dirtyClip() { 411746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy mDirtyClip = true; 412746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy } 413746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy 414bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy // Dimensions of the drawing surface 415bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy int mWidth, mHeight; 416bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy 41785bf02fc16784d935fb9eebfa9cb20fe46ff7951Romain Guy // Matrix used for ortho projection in shaders 418260e102162322958cf17dbd895cd6bd30dc87e32Romain Guy mat4 mOrthoMatrix; 419bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy 420c7d53494f1fbd9f9d74af89053ff9fdb1ccbac6cRomain Guy // Model-view matrix used to position/size objects 421c7d53494f1fbd9f9d74af89053ff9fdb1ccbac6cRomain Guy mat4 mModelView; 422c7d53494f1fbd9f9d74af89053ff9fdb1ccbac6cRomain Guy 423bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy // Number of saved states 424bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy int mSaveCount; 425f6a11b8a9e25ff9861bbba19251bea84d8a5daf2Romain Guy // Base state 426ae5575b3421c8fbe590ab046d7d5f2b36ecfd821Romain Guy sp<Snapshot> mFirstSnapshot; 427bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy // Current state 428bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy sp<Snapshot> mSnapshot; 4299d5316e3f56d138504565ff311145ac01621dff4Romain Guy 4309d5316e3f56d138504565ff311145ac01621dff4Romain Guy // Shaders 43106f96e2652e4855b6520ad9dd70583677605b79aRomain Guy SkiaShader* mShader; 432026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy 433db1938e0e6ef816e228c815adccebd5cb05f2aa8Romain Guy // Color filters 434db1938e0e6ef816e228c815adccebd5cb05f2aa8Romain Guy SkiaColorFilter* mColorFilter; 435db1938e0e6ef816e228c815adccebd5cb05f2aa8Romain Guy 436026c5e16704e817cac7d9c382914c947e34f87e0Romain Guy // Used to draw textured quads 437ac670c0433d19397d4e36ced2110475b6f54fe26Romain Guy TextureVertex mMeshVertices[4]; 438ce0537b80087a6225273040a987414b1dd081aa0Romain Guy 4391e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy // Drop shadow 4401e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy bool mHasShadow; 4411e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy float mShadowRadius; 4421e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy float mShadowDx; 4431e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy float mShadowDy; 4441e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy int mShadowColor; 4451e45aae5de003657e5d18f74d34998f5de5db5b7Romain Guy 44682ba814ca0dea659be2cc6523bc0137679d961ceRomain Guy // Various caches 447fb8b763f762ae21923c58d64caa729b012f40e05Romain Guy Caches& mCaches; 4488694230ff25fa0a60e480d424843e56b718f0516Romain Guy 4498694230ff25fa0a60e480d424843e56b718f0516Romain Guy // List of rectangles to clear due to calls to saveLayer() 4508694230ff25fa0a60e480d424843e56b718f0516Romain Guy Vector<Rect*> mLayers; 4518694230ff25fa0a60e480d424843e56b718f0516Romain Guy 45299bcdc52dcb365ed7d8cfa13540fb33fbcbbac9dRomain Guy // Indentity matrix 45399bcdc52dcb365ed7d8cfa13540fb33fbcbbac9dRomain Guy const mat4 mIdentity; 45499bcdc52dcb365ed7d8cfa13540fb33fbcbbac9dRomain Guy 455746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy // Indicates whether the clip must be restored 456746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy bool mDirtyClip; 457746b7401ceb86b5f2805f8c0d3b39ac739152015Romain Guy 458b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy friend class DisplayListRenderer; 459b051e895ccb696604349c6c5efe7c4747e1d1ab6Romain Guy 460bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4Romain Guy}; // class OpenGLRenderer 461e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy 4629d5316e3f56d138504565ff311145ac01621dff4Romain Guy}; // namespace uirenderer 463e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy}; // namespace android 464e4d011201cea40d46cb2b2eef401db8fddc5c9c6Romain Guy 4659d5316e3f56d138504565ff311145ac01621dff4Romain Guy#endif // ANDROID_UI_OPENGL_RENDERER_H 466