Snapshot.h revision 924197513aa2df4c1fb2977c1727f5d2c21f2689
15cbbce535744b89df5ecea95de21ee3733298260Romain Guy/* 25cbbce535744b89df5ecea95de21ee3733298260Romain Guy * Copyright (C) 2010 The Android Open Source Project 35cbbce535744b89df5ecea95de21ee3733298260Romain Guy * 45cbbce535744b89df5ecea95de21ee3733298260Romain Guy * Licensed under the Apache License, Version 2.0 (the "License"); 55cbbce535744b89df5ecea95de21ee3733298260Romain Guy * you may not use this file except in compliance with the License. 65cbbce535744b89df5ecea95de21ee3733298260Romain Guy * You may obtain a copy of the License at 75cbbce535744b89df5ecea95de21ee3733298260Romain Guy * 85cbbce535744b89df5ecea95de21ee3733298260Romain Guy * http://www.apache.org/licenses/LICENSE-2.0 95cbbce535744b89df5ecea95de21ee3733298260Romain Guy * 105cbbce535744b89df5ecea95de21ee3733298260Romain Guy * Unless required by applicable law or agreed to in writing, software 115cbbce535744b89df5ecea95de21ee3733298260Romain Guy * distributed under the License is distributed on an "AS IS" BASIS, 125cbbce535744b89df5ecea95de21ee3733298260Romain Guy * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 135cbbce535744b89df5ecea95de21ee3733298260Romain Guy * See the License for the specific language governing permissions and 145cbbce535744b89df5ecea95de21ee3733298260Romain Guy * limitations under the License. 155cbbce535744b89df5ecea95de21ee3733298260Romain Guy */ 165cbbce535744b89df5ecea95de21ee3733298260Romain Guy 175b3b35296e8b2c8d3f07d32bb645d5414db41a1dRomain Guy#ifndef ANDROID_HWUI_SNAPSHOT_H 185b3b35296e8b2c8d3f07d32bb645d5414db41a1dRomain Guy#define ANDROID_HWUI_SNAPSHOT_H 195cbbce535744b89df5ecea95de21ee3733298260Romain Guy 205cbbce535744b89df5ecea95de21ee3733298260Romain Guy#include <GLES2/gl2.h> 215cbbce535744b89df5ecea95de21ee3733298260Romain Guy#include <GLES2/gl2ext.h> 225cbbce535744b89df5ecea95de21ee3733298260Romain Guy 235cbbce535744b89df5ecea95de21ee3733298260Romain Guy#include <utils/RefBase.h> 245b3b35296e8b2c8d3f07d32bb645d5414db41a1dRomain Guy#include <ui/Region.h> 255cbbce535744b89df5ecea95de21ee3733298260Romain Guy 26ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy#include <SkRegion.h> 27079ba2c85b15e882629b8d188f5fbdb42f7f8eeaRomain Guy 28dda570201ac851dd85af3861f7e575721d3345daRomain Guy#include "Layer.h" 295cbbce535744b89df5ecea95de21ee3733298260Romain Guy#include "Matrix.h" 305cbbce535744b89df5ecea95de21ee3733298260Romain Guy#include "Rect.h" 315cbbce535744b89df5ecea95de21ee3733298260Romain Guy 325cbbce535744b89df5ecea95de21ee3733298260Romain Guynamespace android { 335cbbce535744b89df5ecea95de21ee3733298260Romain Guynamespace uirenderer { 345cbbce535744b89df5ecea95de21ee3733298260Romain Guy 355cbbce535744b89df5ecea95de21ee3733298260Romain Guy/** 365cbbce535744b89df5ecea95de21ee3733298260Romain Guy * A snapshot holds information about the current state of the rendering 375cbbce535744b89df5ecea95de21ee3733298260Romain Guy * surface. A snapshot is usually created whenever the user calls save() 385cbbce535744b89df5ecea95de21ee3733298260Romain Guy * and discarded when the user calls restore(). Once a snapshot is created, 395cbbce535744b89df5ecea95de21ee3733298260Romain Guy * it can hold information for deferred rendering. 405cbbce535744b89df5ecea95de21ee3733298260Romain Guy * 415cbbce535744b89df5ecea95de21ee3733298260Romain Guy * Each snapshot has a link to a previous snapshot, indicating the previous 425cbbce535744b89df5ecea95de21ee3733298260Romain Guy * state of the renderer. 435cbbce535744b89df5ecea95de21ee3733298260Romain Guy */ 445cbbce535744b89df5ecea95de21ee3733298260Romain Guyclass Snapshot: public LightRefBase<Snapshot> { 455cbbce535744b89df5ecea95de21ee3733298260Romain Guypublic: 465cbbce535744b89df5ecea95de21ee3733298260Romain Guy 47ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy Snapshot(); 48ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy Snapshot(const sp<Snapshot>& s, int saveFlags); 495cbbce535744b89df5ecea95de21ee3733298260Romain Guy 505cbbce535744b89df5ecea95de21ee3733298260Romain Guy /** 51ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * Various flags set on ::flags. 525cbbce535744b89df5ecea95de21ee3733298260Romain Guy */ 535cbbce535744b89df5ecea95de21ee3733298260Romain Guy enum Flags { 545cbbce535744b89df5ecea95de21ee3733298260Romain Guy /** 555cbbce535744b89df5ecea95de21ee3733298260Romain Guy * Indicates that the clip region was modified. When this 565cbbce535744b89df5ecea95de21ee3733298260Romain Guy * snapshot is restored so must the clip. 575cbbce535744b89df5ecea95de21ee3733298260Romain Guy */ 585cbbce535744b89df5ecea95de21ee3733298260Romain Guy kFlagClipSet = 0x1, 595cbbce535744b89df5ecea95de21ee3733298260Romain Guy /** 605cbbce535744b89df5ecea95de21ee3733298260Romain Guy * Indicates that this snapshot was created when saving 615cbbce535744b89df5ecea95de21ee3733298260Romain Guy * a new layer. 625cbbce535744b89df5ecea95de21ee3733298260Romain Guy */ 63079ba2c85b15e882629b8d188f5fbdb42f7f8eeaRomain Guy kFlagIsLayer = 0x2, 64f86ef57f8bcd8ba43ce222ec6a8b4f67d3600640Romain Guy /** 65eb99356a0548684a501766e6a524529ab93304c8Romain Guy * Indicates that this snapshot is a special type of layer 66eb99356a0548684a501766e6a524529ab93304c8Romain Guy * backed by an FBO. This flag only makes sense when the 67eb99356a0548684a501766e6a524529ab93304c8Romain Guy * flag kFlagIsLayer is also set. 68a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik * 69a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik * Viewport has been modified to fit the new Fbo, and must be 70a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik * restored when this snapshot is restored. 71eb99356a0548684a501766e6a524529ab93304c8Romain Guy */ 72eb99356a0548684a501766e6a524529ab93304c8Romain Guy kFlagIsFboLayer = 0x4, 73eb99356a0548684a501766e6a524529ab93304c8Romain Guy /** 745b3b35296e8b2c8d3f07d32bb645d5414db41a1dRomain Guy * Indicates that this snapshot or an ancestor snapshot is 755b3b35296e8b2c8d3f07d32bb645d5414db41a1dRomain Guy * an FBO layer. 765b3b35296e8b2c8d3f07d32bb645d5414db41a1dRomain Guy */ 77a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik kFlagFboTarget = 0x8, 785cbbce535744b89df5ecea95de21ee3733298260Romain Guy }; 795cbbce535744b89df5ecea95de21ee3733298260Romain Guy 805cbbce535744b89df5ecea95de21ee3733298260Romain Guy /** 81f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy * Modifies the current clip with the new clip rectangle and 82f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy * the specified operation. The specified rectangle is transformed 83f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy * by this snapshot's trasnformation. 843d58c03de0d8877b36cdb78b0ca8b5cac7f600e2Romain Guy */ 85f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy bool clip(float left, float top, float right, float bottom, 86ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy SkRegion::Op op = SkRegion::kIntersect_Op); 87f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy 88f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy /** 89f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy * Modifies the current clip with the new clip rectangle and 90f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy * the specified operation. The specified rectangle is considered 91f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy * already transformed. 92f607bdc167f66b3e7003acaa4736ae46d78c1492Romain Guy */ 93ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy bool clipTransformed(const Rect& r, SkRegion::Op op = SkRegion::kIntersect_Op); 945cbbce535744b89df5ecea95de21ee3733298260Romain Guy 955cbbce535744b89df5ecea95de21ee3733298260Romain Guy /** 968ce00301a023eecaeb8891ce906f67b513ebb42aRomain Guy * Modifies the current clip with the specified region and operation. 978ce00301a023eecaeb8891ce906f67b513ebb42aRomain Guy * The specified region is considered already transformed. 988ce00301a023eecaeb8891ce906f67b513ebb42aRomain Guy */ 998ce00301a023eecaeb8891ce906f67b513ebb42aRomain Guy bool clipRegionTransformed(const SkRegion& region, SkRegion::Op op); 1008ce00301a023eecaeb8891ce906f67b513ebb42aRomain Guy 1018ce00301a023eecaeb8891ce906f67b513ebb42aRomain Guy /** 102d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy * Sets the current clip. 103d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy */ 104ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy void setClip(float left, float top, float right, float bottom); 105959c91f7f7b4f921d341264f5b4ef54e702a0df0Romain Guy 106ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy /** 107ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * Returns the current clip in local coordinates. The clip rect is 108ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * transformed by the inverse transform matrix. 109ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy */ 1103f085429fd47ebd32ac2463b3eae2a5a6c17be25Chris Craik const Rect& getLocalClip(); 1113f085429fd47ebd32ac2463b3eae2a5a6c17be25Chris Craik 1123f085429fd47ebd32ac2463b3eae2a5a6c17be25Chris Craik /** 1133f085429fd47ebd32ac2463b3eae2a5a6c17be25Chris Craik * Returns the current clip in render target coordinates. 1143f085429fd47ebd32ac2463b3eae2a5a6c17be25Chris Craik */ 1153f085429fd47ebd32ac2463b3eae2a5a6c17be25Chris Craik const Rect& getRenderTargetClip() { return *clipRect; } 116d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895Romain Guy 117ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy /** 118ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * Resets the clip to the specified rect. 119ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy */ 120ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy void resetClip(float left, float top, float right, float bottom); 121eb99356a0548684a501766e6a524529ab93304c8Romain Guy 122ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy /** 123ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * Resets the current transform to a pure 3D translation. 124ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy */ 125ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy void resetTransform(float x, float y, float z); 126eb99356a0548684a501766e6a524529ab93304c8Romain Guy 127a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik void initializeViewport(int width, int height) { 128a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik mViewportData.initialize(width, height); 129a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik } 130a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik 131a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik int getViewportWidth() const { return mViewportData.mWidth; } 132a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik int getViewportHeight() const { return mViewportData.mHeight; } 133a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik const Matrix4& getOrthoMatrix() const { return mViewportData.mOrthoMatrix; } 134a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik 135ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy /** 136ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * Indicates whether this snapshot should be ignored. A snapshot 137ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * is typicalled ignored if its layer is invisible or empty. 138ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy */ 139ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy bool isIgnored() const; 140af636ebf5feb2837683fbfe965040cb706b32ec1Romain Guy 1418b55f377655d13a445b08a0a8ed09b6e95c752b0Romain Guy /** 142a3dc55f83ab583e0a66b893c71b849afa046770aRomain Guy * Indicates whether the current transform has perspective components. 143a3dc55f83ab583e0a66b893c71b849afa046770aRomain Guy */ 144a3dc55f83ab583e0a66b893c71b849afa046770aRomain Guy bool hasPerspectiveTransform() const; 145a3dc55f83ab583e0a66b893c71b849afa046770aRomain Guy 146a3dc55f83ab583e0a66b893c71b849afa046770aRomain Guy /** 1475cbbce535744b89df5ecea95de21ee3733298260Romain Guy * Dirty flags. 1485cbbce535744b89df5ecea95de21ee3733298260Romain Guy */ 1495cbbce535744b89df5ecea95de21ee3733298260Romain Guy int flags; 1505cbbce535744b89df5ecea95de21ee3733298260Romain Guy 1515cbbce535744b89df5ecea95de21ee3733298260Romain Guy /** 1525cbbce535744b89df5ecea95de21ee3733298260Romain Guy * Previous snapshot. 1535cbbce535744b89df5ecea95de21ee3733298260Romain Guy */ 1545cbbce535744b89df5ecea95de21ee3733298260Romain Guy sp<Snapshot> previous; 1555cbbce535744b89df5ecea95de21ee3733298260Romain Guy 1565cbbce535744b89df5ecea95de21ee3733298260Romain Guy /** 1578ce00301a023eecaeb8891ce906f67b513ebb42aRomain Guy * A pointer to the currently active layer. 158ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * 159ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * This snapshot does not own the layer, this pointer must not be freed. 1605cbbce535744b89df5ecea95de21ee3733298260Romain Guy */ 161dda570201ac851dd85af3861f7e575721d3345daRomain Guy Layer* layer; 162f86ef57f8bcd8ba43ce222ec6a8b4f67d3600640Romain Guy 1638aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy /** 164421458aad764cd9d1403d2540ab979b336b02341Romain Guy * Target FBO used for rendering. Set to 0 when rendering directly 165421458aad764cd9d1403d2540ab979b336b02341Romain Guy * into the framebuffer. 166eb99356a0548684a501766e6a524529ab93304c8Romain Guy */ 167eb99356a0548684a501766e6a524529ab93304c8Romain Guy GLuint fbo; 168eb99356a0548684a501766e6a524529ab93304c8Romain Guy 169eb99356a0548684a501766e6a524529ab93304c8Romain Guy /** 170dbc26d2ba13f80a7590c57de2d80530d96832969Romain Guy * Indicates that this snapshot is invisible and nothing should be drawn 171af636ebf5feb2837683fbfe965040cb706b32ec1Romain Guy * inside it. This flag is set only when the layer clips drawing to its 172af636ebf5feb2837683fbfe965040cb706b32ec1Romain Guy * bounds and is passed to subsequent snapshots. 173dbc26d2ba13f80a7590c57de2d80530d96832969Romain Guy */ 174dbc26d2ba13f80a7590c57de2d80530d96832969Romain Guy bool invisible; 175dbc26d2ba13f80a7590c57de2d80530d96832969Romain Guy 176dbc26d2ba13f80a7590c57de2d80530d96832969Romain Guy /** 177af636ebf5feb2837683fbfe965040cb706b32ec1Romain Guy * If set to true, the layer will not be composited. This is similar to 178af636ebf5feb2837683fbfe965040cb706b32ec1Romain Guy * invisible but this flag is not passed to subsequent snapshots. 179af636ebf5feb2837683fbfe965040cb706b32ec1Romain Guy */ 180af636ebf5feb2837683fbfe965040cb706b32ec1Romain Guy bool empty; 181af636ebf5feb2837683fbfe965040cb706b32ec1Romain Guy 182af636ebf5feb2837683fbfe965040cb706b32ec1Romain Guy /** 1838aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy * Local transformation. Holds the current translation, scale and 1848aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy * rotation values. 185ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * 186ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * This is a reference to a matrix owned by this snapshot or another 187ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * snapshot. This pointer must not be freed. See ::mTransformRoot. 1888aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy */ 1898aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy mat4* transform; 1908aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy 1918aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy /** 192967e2bf3ac8943a8e8a374bf86021915445cda67Romain Guy * Current clip rect. The clip is stored in canvas-space coordinates, 1938aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy * (screen-space coordinates in the regular case.) 194ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * 195ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * This is a reference to a rect owned by this snapshot or another 196ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * snapshot. This pointer must not be freed. See ::mClipRectRoot. 1978aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy */ 1988aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy Rect* clipRect; 1998aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy 2005b3b35296e8b2c8d3f07d32bb645d5414db41a1dRomain Guy /** 201967e2bf3ac8943a8e8a374bf86021915445cda67Romain Guy * Current clip region. The clip is stored in canvas-space coordinates, 202967e2bf3ac8943a8e8a374bf86021915445cda67Romain Guy * (screen-space coordinates in the regular case.) 203967e2bf3ac8943a8e8a374bf86021915445cda67Romain Guy * 204967e2bf3ac8943a8e8a374bf86021915445cda67Romain Guy * This is a reference to a region owned by this snapshot or another 205967e2bf3ac8943a8e8a374bf86021915445cda67Romain Guy * snapshot. This pointer must not be freed. See ::mClipRegionRoot. 206967e2bf3ac8943a8e8a374bf86021915445cda67Romain Guy */ 2070baaac5e9adf3ee280ae1239e2e58754a9d2b099Romain Guy SkRegion* clipRegion; 208967e2bf3ac8943a8e8a374bf86021915445cda67Romain Guy 209967e2bf3ac8943a8e8a374bf86021915445cda67Romain Guy /** 210f219da5e32e85deb442468ee9a63bb28eb198557Romain Guy * The ancestor layer's dirty region. 211ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * 212ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * This is a reference to a region owned by a layer. This pointer must 213ada4d53d50dc869b8278573ad640dc44118d3bcfRomain Guy * not be freed. 2145b3b35296e8b2c8d3f07d32bb645d5414db41a1dRomain Guy */ 2155b3b35296e8b2c8d3f07d32bb645d5414db41a1dRomain Guy Region* region; 2165b3b35296e8b2c8d3f07d32bb645d5414db41a1dRomain Guy 217db8c9a6a4d9bf8c39f834b25611926caf21380f6Chet Haase /** 218db8c9a6a4d9bf8c39f834b25611926caf21380f6Chet Haase * Current alpha value. This value is 1 by default, but may be set by a DisplayList which 219db8c9a6a4d9bf8c39f834b25611926caf21380f6Chet Haase * has translucent rendering in a non-overlapping View. This value will be used by 220db8c9a6a4d9bf8c39f834b25611926caf21380f6Chet Haase * the renderer to set the alpha in the current color being used for ensuing drawing 221db8c9a6a4d9bf8c39f834b25611926caf21380f6Chet Haase * operations. The value is inherited by child snapshots because the same value should 222db8c9a6a4d9bf8c39f834b25611926caf21380f6Chet Haase * be applied to descendents of the current DisplayList (for example, a TextView contains 223db8c9a6a4d9bf8c39f834b25611926caf21380f6Chet Haase * the base alpha value which should be applied to the child DisplayLists used for drawing 224db8c9a6a4d9bf8c39f834b25611926caf21380f6Chet Haase * the actual text). 225db8c9a6a4d9bf8c39f834b25611926caf21380f6Chet Haase */ 226db8c9a6a4d9bf8c39f834b25611926caf21380f6Chet Haase float alpha; 227db8c9a6a4d9bf8c39f834b25611926caf21380f6Chet Haase 2285f803623559aab395a29d575c37c4e39c23a4b4eChris Craik void dump() const; 2295f803623559aab395a29d575c37c4e39c23a4b4eChris Craik 2305cbbce535744b89df5ecea95de21ee3733298260Romain Guyprivate: 231a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik struct ViewportData { 232924197513aa2df4c1fb2977c1727f5d2c21f2689Chris Craik ViewportData() : mWidth(0), mHeight(0) {} 233a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik void initialize(int width, int height) { 234a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik mWidth = width; 235a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik mHeight = height; 236a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik mOrthoMatrix.loadOrtho(0, width, height, 0, -1, 1); 237a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik } 238a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik 239a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik /* 240a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik * Width and height of current viewport. 241a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik * 242a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik * The viewport is always defined to be (0, 0, width, height). 243a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik */ 244a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik int mWidth; 245a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik int mHeight; 246a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik /** 247a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik * Contains the current orthographic, projection matrix. 248a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik */ 249a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik mat4 mOrthoMatrix; 250a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik }; 251a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik 252967e2bf3ac8943a8e8a374bf86021915445cda67Romain Guy void ensureClipRegion(); 253967e2bf3ac8943a8e8a374bf86021915445cda67Romain Guy void copyClipRectFromRegion(); 254967e2bf3ac8943a8e8a374bf86021915445cda67Romain Guy 2550baaac5e9adf3ee280ae1239e2e58754a9d2b099Romain Guy bool clipRegionOp(float left, float top, float right, float bottom, SkRegion::Op op); 256967e2bf3ac8943a8e8a374bf86021915445cda67Romain Guy 2578aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy mat4 mTransformRoot; 2588aef54fa17f2a3753d9a8f2027629bc480088f69Romain Guy Rect mClipRectRoot; 2593f085429fd47ebd32ac2463b3eae2a5a6c17be25Chris Craik Rect mLocalClip; // don't use directly, call getLocalClip() which initializes this 260079ba2c85b15e882629b8d188f5fbdb42f7f8eeaRomain Guy 2610baaac5e9adf3ee280ae1239e2e58754a9d2b099Romain Guy SkRegion mClipRegionRoot; 262a64a2bef1048db5a742843f1e3bea9e80d0defc5Chris Craik ViewportData mViewportData; 263967e2bf3ac8943a8e8a374bf86021915445cda67Romain Guy 2645cbbce535744b89df5ecea95de21ee3733298260Romain Guy}; // class Snapshot 2655cbbce535744b89df5ecea95de21ee3733298260Romain Guy 2665cbbce535744b89df5ecea95de21ee3733298260Romain Guy}; // namespace uirenderer 2675cbbce535744b89df5ecea95de21ee3733298260Romain Guy}; // namespace android 2685cbbce535744b89df5ecea95de21ee3733298260Romain Guy 2695b3b35296e8b2c8d3f07d32bb645d5414db41a1dRomain Guy#endif // ANDROID_HWUI_SNAPSHOT_H 270