remove BakedOps and much of renderstate

Test: make

Change-Id: If070b7436b848c6840abfac5f051b0f5b6cb17ce
diff --git a/libs/hwui/renderstate/Blend.cpp b/libs/hwui/renderstate/Blend.cpp
deleted file mode 100644
index 08e18e0..0000000
--- a/libs/hwui/renderstate/Blend.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <renderstate/Blend.h>
-#include "Program.h"
-
-namespace android {
-namespace uirenderer {
-
-/**
- * Structure mapping Skia xfermodes to OpenGL blending factors.
- */
-struct Blender {
-    SkBlendMode mode;
-    GLenum src;
-    GLenum dst;
-};
-
-// assumptions made by lookup tables in either this file or ProgramCache
-static_assert(0 == static_cast<int>(SkBlendMode::kClear), "SkBlendMode enums have changed");
-static_assert(1 == static_cast<int>(SkBlendMode::kSrc), "SkBlendMode enums have changed");
-static_assert(2 == static_cast<int>(SkBlendMode::kDst), "SkBlendMode enums have changed");
-static_assert(3 == static_cast<int>(SkBlendMode::kSrcOver), "SkBlendMode enums have changed");
-static_assert(4 == static_cast<int>(SkBlendMode::kDstOver), "SkBlendMode enums have changed");
-static_assert(5 == static_cast<int>(SkBlendMode::kSrcIn), "SkBlendMode enums have changed");
-static_assert(6 == static_cast<int>(SkBlendMode::kDstIn), "SkBlendMode enums have changed");
-static_assert(7 == static_cast<int>(SkBlendMode::kSrcOut), "SkBlendMode enums have changed");
-static_assert(8 == static_cast<int>(SkBlendMode::kDstOut), "SkBlendMode enums have changed");
-static_assert(9 == static_cast<int>(SkBlendMode::kSrcATop), "SkBlendMode enums have changed");
-static_assert(10 == static_cast<int>(SkBlendMode::kDstATop), "SkBlendMode enums have changed");
-static_assert(11 == static_cast<int>(SkBlendMode::kXor), "SkBlendMode enums have changed");
-static_assert(12 == static_cast<int>(SkBlendMode::kPlus), "SkBlendMode enums have changed");
-static_assert(13 == static_cast<int>(SkBlendMode::kModulate), "SkBlendMode enums have changed");
-static_assert(14 == static_cast<int>(SkBlendMode::kScreen), "SkBlendMode enums have changed");
-static_assert(15 == static_cast<int>(SkBlendMode::kOverlay), "SkBlendMode enums have changed");
-static_assert(16 == static_cast<int>(SkBlendMode::kDarken), "SkBlendMode enums have changed");
-static_assert(17 == static_cast<int>(SkBlendMode::kLighten), "SkBlendMode enums have changed");
-
-// In this array, the index of each Blender equals the value of the first
-// entry. For instance, gBlends[1] == gBlends[SkBlendMode::kSrc]
-const Blender kBlends[] = {{SkBlendMode::kClear, GL_ZERO, GL_ONE_MINUS_SRC_ALPHA},
-                           {SkBlendMode::kSrc, GL_ONE, GL_ZERO},
-                           {SkBlendMode::kDst, GL_ZERO, GL_ONE},
-                           {SkBlendMode::kSrcOver, GL_ONE, GL_ONE_MINUS_SRC_ALPHA},
-                           {SkBlendMode::kDstOver, GL_ONE_MINUS_DST_ALPHA, GL_ONE},
-                           {SkBlendMode::kSrcIn, GL_DST_ALPHA, GL_ZERO},
-                           {SkBlendMode::kDstIn, GL_ZERO, GL_SRC_ALPHA},
-                           {SkBlendMode::kSrcOut, GL_ONE_MINUS_DST_ALPHA, GL_ZERO},
-                           {SkBlendMode::kDstOut, GL_ZERO, GL_ONE_MINUS_SRC_ALPHA},
-                           {SkBlendMode::kSrcATop, GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA},
-                           {SkBlendMode::kDstATop, GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA},
-                           {SkBlendMode::kXor, GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA},
-                           {SkBlendMode::kPlus, GL_ONE, GL_ONE},
-                           {SkBlendMode::kModulate, GL_ZERO, GL_SRC_COLOR},
-                           {SkBlendMode::kScreen, GL_ONE, GL_ONE_MINUS_SRC_COLOR}};
-
-// This array contains the swapped version of each SkBlendMode. For instance
-// this array's SrcOver blending mode is actually DstOver. You can refer to
-// createLayer() for more information on the purpose of this array.
-const Blender kBlendsSwap[] = {{SkBlendMode::kClear, GL_ONE_MINUS_DST_ALPHA, GL_ZERO},
-                               {SkBlendMode::kSrc, GL_ZERO, GL_ONE},
-                               {SkBlendMode::kDst, GL_ONE, GL_ZERO},
-                               {SkBlendMode::kSrcOver, GL_ONE_MINUS_DST_ALPHA, GL_ONE},
-                               {SkBlendMode::kDstOver, GL_ONE, GL_ONE_MINUS_SRC_ALPHA},
-                               {SkBlendMode::kSrcIn, GL_ZERO, GL_SRC_ALPHA},
-                               {SkBlendMode::kDstIn, GL_DST_ALPHA, GL_ZERO},
-                               {SkBlendMode::kSrcOut, GL_ZERO, GL_ONE_MINUS_SRC_ALPHA},
-                               {SkBlendMode::kDstOut, GL_ONE_MINUS_DST_ALPHA, GL_ZERO},
-                               {SkBlendMode::kSrcATop, GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA},
-                               {SkBlendMode::kDstATop, GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA},
-                               {SkBlendMode::kXor, GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA},
-                               {SkBlendMode::kPlus, GL_ONE, GL_ONE},
-                               {SkBlendMode::kModulate, GL_DST_COLOR, GL_ZERO},
-                               {SkBlendMode::kScreen, GL_ONE_MINUS_DST_COLOR, GL_ONE}};
-
-Blend::Blend() : mEnabled(false), mSrcMode(GL_ZERO), mDstMode(GL_ZERO) {
-    // gl blending off by default
-}
-
-void Blend::invalidate() {
-    syncEnabled();
-    mSrcMode = mDstMode = GL_ZERO;
-}
-
-void Blend::syncEnabled() {
-    if (mEnabled) {
-        glEnable(GL_BLEND);
-    } else {
-        glDisable(GL_BLEND);
-    }
-}
-
-void Blend::getFactors(SkBlendMode mode, ModeOrderSwap modeUsage, GLenum* outSrc, GLenum* outDst) {
-    int index = static_cast<int>(mode);
-    *outSrc = (modeUsage == ModeOrderSwap::Swap) ? kBlendsSwap[index].src : kBlends[index].src;
-    *outDst = (modeUsage == ModeOrderSwap::Swap) ? kBlendsSwap[index].dst : kBlends[index].dst;
-}
-
-void Blend::setFactors(GLenum srcMode, GLenum dstMode) {
-    if ((srcMode == GL_ZERO || srcMode == GL_ONE) && dstMode == GL_ZERO) {
-        // disable blending
-        if (mEnabled) {
-            glDisable(GL_BLEND);
-            mEnabled = false;
-        }
-    } else {
-        // enable blending
-        if (!mEnabled) {
-            glEnable(GL_BLEND);
-            mEnabled = true;
-        }
-
-        if (srcMode != mSrcMode || dstMode != mDstMode) {
-            glBlendFunc(srcMode, dstMode);
-            mSrcMode = srcMode;
-            mDstMode = dstMode;
-        }
-    }
-}
-
-void Blend::dump() {
-    ALOGD("Blend: enabled %d, func src %d, dst %d", mEnabled, mSrcMode, mDstMode);
-}
-
-} /* namespace uirenderer */
-} /* namespace android */
diff --git a/libs/hwui/renderstate/Blend.h b/libs/hwui/renderstate/Blend.h
deleted file mode 100644
index 7e559ba..0000000
--- a/libs/hwui/renderstate/Blend.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef RENDERSTATE_BLEND_H
-#define RENDERSTATE_BLEND_H
-
-#include "Vertex.h"
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <SkBlendMode.h>
-#include <memory>
-
-namespace android {
-namespace uirenderer {
-
-class Blend {
-    friend class RenderState;
-
-public:
-    // dictates whether to swap src/dst
-    enum class ModeOrderSwap {
-        NoSwap,
-        Swap,
-    };
-    void syncEnabled();
-
-    static void getFactors(SkBlendMode mode, ModeOrderSwap modeUsage, GLenum* outSrc,
-                           GLenum* outDst);
-    void setFactors(GLenum src, GLenum dst);
-
-    bool getEnabled() { return mEnabled; }
-    void getFactors(GLenum* src, GLenum* dst) {
-        *src = mSrcMode;
-        *dst = mDstMode;
-    }
-
-    void dump();
-
-private:
-    Blend();
-    void invalidate();
-    bool mEnabled;
-    GLenum mSrcMode;
-    GLenum mDstMode;
-};
-
-} /* namespace uirenderer */
-} /* namespace android */
-
-#endif  // RENDERSTATE_BLEND_H
diff --git a/libs/hwui/renderstate/MeshState.cpp b/libs/hwui/renderstate/MeshState.cpp
deleted file mode 100644
index 4f6c49e..0000000
--- a/libs/hwui/renderstate/MeshState.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "renderstate/MeshState.h"
-
-#include "Program.h"
-
-namespace android {
-namespace uirenderer {
-
-MeshState::MeshState()
-        : mCurrentIndicesBuffer(0)
-        , mCurrentPixelBuffer(0)
-        , mCurrentPositionPointer(this)
-        , mCurrentPositionStride(0)
-        , mCurrentTexCoordsPointer(this)
-        , mCurrentTexCoordsStride(0)
-        , mTexCoordsArrayEnabled(false)
-        , mQuadListIndices(0) {
-    glGenBuffers(1, &mUnitQuadBuffer);
-    glBindBuffer(GL_ARRAY_BUFFER, mUnitQuadBuffer);
-    glBufferData(GL_ARRAY_BUFFER, sizeof(kUnitQuadVertices), kUnitQuadVertices, GL_STATIC_DRAW);
-    mCurrentBuffer = mUnitQuadBuffer;
-
-    uint16_t regionIndices[kMaxNumberOfQuads * 6];
-    for (uint32_t i = 0; i < kMaxNumberOfQuads; i++) {
-        uint16_t quad = i * 4;
-        int index = i * 6;
-        regionIndices[index] = quad;          // top-left
-        regionIndices[index + 1] = quad + 1;  // top-right
-        regionIndices[index + 2] = quad + 2;  // bottom-left
-        regionIndices[index + 3] = quad + 2;  // bottom-left
-        regionIndices[index + 4] = quad + 1;  // top-right
-        regionIndices[index + 5] = quad + 3;  // bottom-right
-    }
-    glGenBuffers(1, &mQuadListIndices);
-    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mQuadListIndices);
-    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(regionIndices), regionIndices, GL_STATIC_DRAW);
-    mCurrentIndicesBuffer = mQuadListIndices;
-
-    // position attribute always enabled
-    glEnableVertexAttribArray(Program::kBindingPosition);
-}
-
-MeshState::~MeshState() {
-    glDeleteBuffers(1, &mUnitQuadBuffer);
-    mCurrentBuffer = 0;
-
-    glDeleteBuffers(1, &mQuadListIndices);
-    mQuadListIndices = 0;
-}
-
-void MeshState::dump() {
-    ALOGD("MeshState VBOs: unitQuad %d, current %d", mUnitQuadBuffer, mCurrentBuffer);
-    ALOGD("MeshState IBOs: quadList %d, current %d", mQuadListIndices, mCurrentIndicesBuffer);
-    ALOGD("MeshState vertices: vertex data %p, stride %d", mCurrentPositionPointer,
-          mCurrentPositionStride);
-    ALOGD("MeshState texCoord: data %p, stride %d", mCurrentTexCoordsPointer,
-          mCurrentTexCoordsStride);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Buffer Objects
-///////////////////////////////////////////////////////////////////////////////
-
-void MeshState::bindMeshBuffer(GLuint buffer) {
-    if (mCurrentBuffer != buffer) {
-        glBindBuffer(GL_ARRAY_BUFFER, buffer);
-        mCurrentBuffer = buffer;
-
-        // buffer has changed, so invalidate cached vertex pos/texcoord pointers
-        resetVertexPointers();
-    }
-}
-
-void MeshState::unbindMeshBuffer() {
-    return bindMeshBuffer(0);
-}
-
-void MeshState::genOrUpdateMeshBuffer(GLuint* buffer, GLsizeiptr size, const void* data,
-                                      GLenum usage) {
-    if (!*buffer) {
-        glGenBuffers(1, buffer);
-    }
-    bindMeshBuffer(*buffer);
-    glBufferData(GL_ARRAY_BUFFER, size, data, usage);
-}
-
-void MeshState::updateMeshBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size,
-                                        const void* data) {
-    bindMeshBuffer(buffer);
-    glBufferSubData(GL_ARRAY_BUFFER, offset, size, data);
-}
-
-void MeshState::deleteMeshBuffer(GLuint buffer) {
-    if (buffer == mCurrentBuffer) {
-        // GL defines that deleting the currently bound VBO rebinds to 0 (no VBO).
-        // Reflect this in our cached value.
-        mCurrentBuffer = 0;
-    }
-    glDeleteBuffers(1, &buffer);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Vertices
-///////////////////////////////////////////////////////////////////////////////
-
-void MeshState::bindPositionVertexPointer(const GLvoid* vertices, GLsizei stride) {
-    // update pos coords if !current vbo, since vertices may point into mutable memory (e.g. stack)
-    if (mCurrentBuffer == 0 || vertices != mCurrentPositionPointer ||
-        stride != mCurrentPositionStride) {
-        glVertexAttribPointer(Program::kBindingPosition, 2, GL_FLOAT, GL_FALSE, stride, vertices);
-        mCurrentPositionPointer = vertices;
-        mCurrentPositionStride = stride;
-    }
-}
-
-void MeshState::bindTexCoordsVertexPointer(const GLvoid* vertices, GLsizei stride) {
-    // update tex coords if !current vbo, since vertices may point into mutable memory (e.g. stack)
-    if (mCurrentBuffer == 0 || vertices != mCurrentTexCoordsPointer ||
-        stride != mCurrentTexCoordsStride) {
-        glVertexAttribPointer(Program::kBindingTexCoords, 2, GL_FLOAT, GL_FALSE, stride, vertices);
-        mCurrentTexCoordsPointer = vertices;
-        mCurrentTexCoordsStride = stride;
-    }
-}
-
-void MeshState::resetVertexPointers() {
-    mCurrentPositionPointer = this;
-    mCurrentTexCoordsPointer = this;
-}
-
-void MeshState::enableTexCoordsVertexArray() {
-    if (!mTexCoordsArrayEnabled) {
-        glEnableVertexAttribArray(Program::kBindingTexCoords);
-        mCurrentTexCoordsPointer = this;
-        mTexCoordsArrayEnabled = true;
-    }
-}
-
-void MeshState::disableTexCoordsVertexArray() {
-    if (mTexCoordsArrayEnabled) {
-        glDisableVertexAttribArray(Program::kBindingTexCoords);
-        mTexCoordsArrayEnabled = false;
-    }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Indices
-///////////////////////////////////////////////////////////////////////////////
-
-void MeshState::bindIndicesBuffer(const GLuint buffer) {
-    if (mCurrentIndicesBuffer != buffer) {
-        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer);
-        mCurrentIndicesBuffer = buffer;
-    }
-}
-
-void MeshState::unbindIndicesBuffer() {
-    if (mCurrentIndicesBuffer) {
-        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
-        mCurrentIndicesBuffer = 0;
-    }
-}
-
-} /* namespace uirenderer */
-} /* namespace android */
diff --git a/libs/hwui/renderstate/MeshState.h b/libs/hwui/renderstate/MeshState.h
deleted file mode 100644
index 95faf1e..0000000
--- a/libs/hwui/renderstate/MeshState.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef RENDERSTATE_MESHSTATE_H
-#define RENDERSTATE_MESHSTATE_H
-
-#include "Vertex.h"
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <memory>
-
-namespace android {
-namespace uirenderer {
-
-class Program;
-
-// Maximum number of quads that pre-allocated meshes can draw
-const uint32_t kMaxNumberOfQuads = 2048;
-
-// This array is never used directly but used as a memcpy source in the
-// OpenGLRenderer constructor
-const TextureVertex kUnitQuadVertices[] = {
-        {0, 0, 0, 0}, {1, 0, 1, 0}, {0, 1, 0, 1}, {1, 1, 1, 1},
-};
-
-const GLsizei kVertexStride = sizeof(Vertex);
-const GLsizei kAlphaVertexStride = sizeof(AlphaVertex);
-const GLsizei kTextureVertexStride = sizeof(TextureVertex);
-const GLsizei kColorTextureVertexStride = sizeof(ColorTextureVertex);
-
-const GLsizei kMeshTextureOffset = 2 * sizeof(float);
-const GLsizei kVertexAlphaOffset = 2 * sizeof(float);
-const GLsizei kVertexAAWidthOffset = 2 * sizeof(float);
-const GLsizei kVertexAALengthOffset = 3 * sizeof(float);
-const GLsizei kUnitQuadCount = 4;
-
-class MeshState {
-private:
-    friend class RenderState;
-
-public:
-    ~MeshState();
-    void dump();
-    ///////////////////////////////////////////////////////////////////////////////
-    // Buffer objects
-    ///////////////////////////////////////////////////////////////////////////////
-
-    /**
-     * Binds the specified VBO if needed. If buffer == 0, binds default simple textured quad.
-     */
-    void bindMeshBuffer(GLuint buffer);
-
-    /**
-     * Unbinds the current VBO if active.
-     */
-    void unbindMeshBuffer();
-
-    void genOrUpdateMeshBuffer(GLuint* buffer, GLsizeiptr size, const void* data, GLenum usage);
-    void updateMeshBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, const void* data);
-    void deleteMeshBuffer(GLuint);
-
-    ///////////////////////////////////////////////////////////////////////////////
-    // Vertices
-    ///////////////////////////////////////////////////////////////////////////////
-    /**
-     * Binds an attrib to the specified float vertex pointer.
-     * Assumes a stride of gTextureVertexStride and a size of 2.
-     */
-    void bindPositionVertexPointer(const GLvoid* vertices, GLsizei stride = kTextureVertexStride);
-
-    /**
-     * Binds an attrib to the specified float vertex pointer.
-     * Assumes a stride of gTextureVertexStride and a size of 2.
-     */
-    void bindTexCoordsVertexPointer(const GLvoid* vertices, GLsizei stride = kTextureVertexStride);
-
-    /**
-     * Resets the vertex pointers.
-     */
-    void resetVertexPointers();
-
-    void enableTexCoordsVertexArray();
-    void disableTexCoordsVertexArray();
-
-    ///////////////////////////////////////////////////////////////////////////////
-    // Indices
-    ///////////////////////////////////////////////////////////////////////////////
-    void bindIndicesBuffer(const GLuint buffer);
-    void unbindIndicesBuffer();
-
-    ///////////////////////////////////////////////////////////////////////////////
-    // Getters - for use in Glop building
-    ///////////////////////////////////////////////////////////////////////////////
-    GLuint getUnitQuadVBO() { return mUnitQuadBuffer; }
-    GLuint getQuadListIBO() { return mQuadListIndices; }
-
-private:
-    MeshState();
-
-    GLuint mUnitQuadBuffer;
-
-    GLuint mCurrentBuffer;
-    GLuint mCurrentIndicesBuffer;
-    GLuint mCurrentPixelBuffer;
-
-    const void* mCurrentPositionPointer;
-    GLsizei mCurrentPositionStride;
-    const void* mCurrentTexCoordsPointer;
-    GLsizei mCurrentTexCoordsStride;
-
-    bool mTexCoordsArrayEnabled;
-
-    // Global index buffer
-    GLuint mQuadListIndices;
-};
-
-} /* namespace uirenderer */
-} /* namespace android */
-
-#endif  // RENDERSTATE_MESHSTATE_H
diff --git a/libs/hwui/renderstate/OffscreenBufferPool.cpp b/libs/hwui/renderstate/OffscreenBufferPool.cpp
index a0f5cb9..e148ebd 100644
--- a/libs/hwui/renderstate/OffscreenBufferPool.cpp
+++ b/libs/hwui/renderstate/OffscreenBufferPool.cpp
@@ -67,37 +67,7 @@
 }
 
 void OffscreenBuffer::updateMeshFromRegion() {
-    // avoid T-junctions as they cause artifacts in between the resultant
-    // geometry when complex transforms occur.
-    // TODO: generate the safeRegion only if necessary based on drawing transform
-    Region safeRegion = Region::createTJunctionFreeRegion(region);
-
-    size_t count;
-    const android::Rect* rects = safeRegion.getArray(&count);
-
-    const float texX = 1.0f / float(texture.width());
-    const float texY = 1.0f / float(texture.height());
-
-    FatVector<TextureVertex, 64> meshVector(count *
-                                            4);  // uses heap if more than 64 vertices needed
-    TextureVertex* mesh = &meshVector[0];
-    for (size_t i = 0; i < count; i++) {
-        const android::Rect* r = &rects[i];
-
-        const float u1 = r->left * texX;
-        const float v1 = (viewportHeight - r->top) * texY;
-        const float u2 = r->right * texX;
-        const float v2 = (viewportHeight - r->bottom) * texY;
-
-        TextureVertex::set(mesh++, r->left, r->top, u1, v1);
-        TextureVertex::set(mesh++, r->right, r->top, u2, v1);
-        TextureVertex::set(mesh++, r->left, r->bottom, u1, v2);
-        TextureVertex::set(mesh++, r->right, r->bottom, u2, v2);
-    }
-    elementCount = count * 6;
-    renderState.meshState().genOrUpdateMeshBuffer(
-            &vbo, sizeof(TextureVertex) * count * 4, &meshVector[0],
-            GL_DYNAMIC_DRAW);  // TODO: GL_STATIC_DRAW if savelayer
+    // DEAD CODE
 }
 
 uint32_t OffscreenBuffer::computeIdealDimension(uint32_t dimension) {
@@ -105,11 +75,7 @@
 }
 
 OffscreenBuffer::~OffscreenBuffer() {
-    ATRACE_FORMAT("Destroy %ux%u HW Layer", texture.width(), texture.height());
-    texture.deleteTexture();
-    renderState.meshState().deleteMeshBuffer(vbo);
-    elementCount = 0;
-    vbo = 0;
+    // DEAD CODE
 }
 
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/libs/hwui/renderstate/RenderState.cpp b/libs/hwui/renderstate/RenderState.cpp
index a60e2b5..a1c8dca 100644
--- a/libs/hwui/renderstate/RenderState.cpp
+++ b/libs/hwui/renderstate/RenderState.cpp
@@ -37,20 +37,11 @@
 }
 
 RenderState::~RenderState() {
-    LOG_ALWAYS_FATAL_IF(mBlend || mMeshState || mScissor || mStencil,
-                        "State object lifecycle not managed correctly");
 }
 
 void RenderState::onGLContextCreated() {
-    LOG_ALWAYS_FATAL_IF(mBlend || mMeshState || mScissor || mStencil,
-                        "State object lifecycle not managed correctly");
     GpuMemoryTracker::onGpuContextCreated();
 
-    mBlend = new Blend();
-    mMeshState = new MeshState();
-    mScissor = new Scissor();
-    mStencil = new Stencil();
-
     // Deferred because creation needs GL context for texture limits
     if (!mLayerPool) {
         mLayerPool = new OffscreenBufferPool();
@@ -77,22 +68,11 @@
 
     mCaches->terminate();
 
-    delete mBlend;
-    mBlend = nullptr;
-    delete mMeshState;
-    mMeshState = nullptr;
-    delete mScissor;
-    mScissor = nullptr;
-    delete mStencil;
-    mStencil = nullptr;
-
     destroyLayersInUpdater();
     GpuMemoryTracker::onGpuContextDestroyed();
 }
 
 void RenderState::onVkContextCreated() {
-    LOG_ALWAYS_FATAL_IF(mBlend || mMeshState || mScissor || mStencil,
-                        "State object lifecycle not managed correctly");
     GpuMemoryTracker::onGpuContextCreated();
 }
 
@@ -177,10 +157,6 @@
 void RenderState::interruptForFunctorInvoke() {
     mCaches->setProgram(nullptr);
     mCaches->textureState().resetActiveTexture();
-    meshState().unbindMeshBuffer();
-    meshState().unbindIndicesBuffer();
-    meshState().resetVertexPointers();
-    meshState().disableTexCoordsVertexArray();
     debugOverdraw(false, false);
     // TODO: We need a way to know whether the functor is sRGB aware (b/32072673)
     if (mCaches->extensions().hasLinearBlending() && mCaches->extensions().hasSRGBWriteControl()) {
@@ -199,25 +175,12 @@
 
     glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
 
-    scissor().invalidate();
-    blend().invalidate();
-
     mCaches->textureState().activateTexture(0);
     mCaches->textureState().resetBoundTextures();
 }
 
 void RenderState::debugOverdraw(bool enable, bool clear) {
-    if (Properties::debugOverdraw && mFramebuffer == 0) {
-        if (clear) {
-            scissor().setEnabled(false);
-            stencil().clear();
-        }
-        if (enable) {
-            stencil().enableDebugWrite();
-        } else {
-            stencil().disable();
-        }
-    }
+    // DEAD CODE
 }
 
 static void destroyLayerInUpdater(DeferredLayerUpdater* layerUpdater) {
@@ -242,9 +205,6 @@
 
 void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix,
                          bool overrideDisableBlending) {
-    const Glop::Mesh& mesh = glop.mesh;
-    const Glop::Mesh::Vertices& vertices = mesh.vertices;
-    const Glop::Mesh::Indices& indices = mesh.indices;
     const Glop::Fill& fill = glop.fill;
 
     GL_CHECKPOINT(MODERATE);
@@ -297,16 +257,6 @@
 
     GL_CHECKPOINT(MODERATE);
 
-    // --------------------------------
-    // ---------- Mesh setup ----------
-    // --------------------------------
-    // vertices
-    meshState().bindMeshBuffer(vertices.bufferObject);
-    meshState().bindPositionVertexPointer(vertices.position, vertices.stride);
-
-    // indices
-    meshState().bindIndicesBuffer(indices.bufferObject);
-
     // texture
     if (fill.texture.texture != nullptr) {
         const Glop::Fill::TextureData& texture = fill.texture;
@@ -327,28 +277,6 @@
         }
     }
 
-    // vertex attributes (tex coord, color, alpha)
-    if (vertices.attribFlags & VertexAttribFlags::TextureCoord) {
-        meshState().enableTexCoordsVertexArray();
-        meshState().bindTexCoordsVertexPointer(vertices.texCoord, vertices.stride);
-    } else {
-        meshState().disableTexCoordsVertexArray();
-    }
-    int colorLocation = -1;
-    if (vertices.attribFlags & VertexAttribFlags::Color) {
-        colorLocation = fill.program->getAttrib("colors");
-        glEnableVertexAttribArray(colorLocation);
-        glVertexAttribPointer(colorLocation, 4, GL_FLOAT, GL_FALSE, vertices.stride,
-                              vertices.color);
-    }
-    int alphaLocation = -1;
-    if (vertices.attribFlags & VertexAttribFlags::Alpha) {
-        // NOTE: alpha vertex position is computed assuming no VBO
-        const void* alphaCoords = ((const GLbyte*)vertices.position) + kVertexAlphaOffset;
-        alphaLocation = fill.program->getAttrib("vtxAlpha");
-        glEnableVertexAttribArray(alphaLocation);
-        glVertexAttribPointer(alphaLocation, 1, GL_FLOAT, GL_FALSE, vertices.stride, alphaCoords);
-    }
     // Shader uniforms
     SkiaShader::apply(*mCaches, fill.skiaShaderData, mViewportWidth, mViewportHeight);
 
@@ -392,77 +320,11 @@
         }
     }
 
-    // ------------------------------------
-    // ---------- GL state setup ----------
-    // ------------------------------------
-    if (CC_UNLIKELY(overrideDisableBlending)) {
-        blend().setFactors(GL_ZERO, GL_ZERO);
-    } else {
-        blend().setFactors(glop.blend.src, glop.blend.dst);
-    }
-
-    GL_CHECKPOINT(MODERATE);
-
-    // ------------------------------------
-    // ---------- Actual drawing ----------
-    // ------------------------------------
-    if (indices.bufferObject == meshState().getQuadListIBO()) {
-        // Since the indexed quad list is of limited length, we loop over
-        // the glDrawXXX method while updating the vertex pointer
-        GLsizei elementsCount = mesh.elementCount;
-        const GLbyte* vertexData = static_cast<const GLbyte*>(vertices.position);
-        while (elementsCount > 0) {
-            GLsizei drawCount = std::min(elementsCount, (GLsizei)kMaxNumberOfQuads * 6);
-            GLsizei vertexCount = (drawCount / 6) * 4;
-            meshState().bindPositionVertexPointer(vertexData, vertices.stride);
-            if (vertices.attribFlags & VertexAttribFlags::TextureCoord) {
-                meshState().bindTexCoordsVertexPointer(vertexData + kMeshTextureOffset,
-                                                       vertices.stride);
-            }
-
-            if (mCaches->extensions().getMajorGlVersion() >= 3) {
-                glDrawRangeElements(mesh.primitiveMode, 0, vertexCount - 1, drawCount,
-                                    GL_UNSIGNED_SHORT, nullptr);
-            } else {
-                glDrawElements(mesh.primitiveMode, drawCount, GL_UNSIGNED_SHORT, nullptr);
-            }
-            elementsCount -= drawCount;
-            vertexData += vertexCount * vertices.stride;
-        }
-    } else if (indices.bufferObject || indices.indices) {
-        if (mCaches->extensions().getMajorGlVersion() >= 3) {
-            // use glDrawRangeElements to reduce CPU overhead (otherwise the driver has to determine
-            // the min/max index values)
-            glDrawRangeElements(mesh.primitiveMode, 0, mesh.vertexCount - 1, mesh.elementCount,
-                                GL_UNSIGNED_SHORT, indices.indices);
-        } else {
-            glDrawElements(mesh.primitiveMode, mesh.elementCount, GL_UNSIGNED_SHORT,
-                           indices.indices);
-        }
-    } else {
-        glDrawArrays(mesh.primitiveMode, 0, mesh.elementCount);
-    }
-
-    GL_CHECKPOINT(MODERATE);
-
-    // -----------------------------------
-    // ---------- Mesh teardown ----------
-    // -----------------------------------
-    if (vertices.attribFlags & VertexAttribFlags::Alpha) {
-        glDisableVertexAttribArray(alphaLocation);
-    }
-    if (vertices.attribFlags & VertexAttribFlags::Color) {
-        glDisableVertexAttribArray(colorLocation);
-    }
-
     GL_CHECKPOINT(MODERATE);
 }
 
 void RenderState::dump() {
-    blend().dump();
-    meshState().dump();
-    scissor().dump();
-    stencil().dump();
+    // DEAD CODE
 }
 
 } /* namespace uirenderer */
diff --git a/libs/hwui/renderstate/RenderState.h b/libs/hwui/renderstate/RenderState.h
index e033cf2..189ddc1 100644
--- a/libs/hwui/renderstate/RenderState.h
+++ b/libs/hwui/renderstate/RenderState.h
@@ -18,12 +18,8 @@
 
 #include "Caches.h"
 #include "Glop.h"
-#include "renderstate/Blend.h"
-#include "renderstate/MeshState.h"
 #include "renderstate/OffscreenBufferPool.h"
 #include "renderstate/PixelBufferState.h"
-#include "renderstate/Scissor.h"
-#include "renderstate/Stencil.h"
 #include "utils/Macros.h"
 
 #include <GLES2/gl2.h>
@@ -105,11 +101,6 @@
 
     void render(const Glop& glop, const Matrix4& orthoMatrix, bool overrideDisableBlending);
 
-    Blend& blend() { return *mBlend; }
-    MeshState& meshState() { return *mMeshState; }
-    Scissor& scissor() { return *mScissor; }
-    Stencil& stencil() { return *mStencil; }
-
     OffscreenBufferPool& layerPool() { return *mLayerPool; }
 
     GrContext* getGrContext() const;
@@ -127,11 +118,6 @@
     renderthread::RenderThread& mRenderThread;
     Caches* mCaches = nullptr;
 
-    Blend* mBlend = nullptr;
-    MeshState* mMeshState = nullptr;
-    Scissor* mScissor = nullptr;
-    Stencil* mStencil = nullptr;
-
     OffscreenBufferPool* mLayerPool = nullptr;
 
     std::set<Layer*> mActiveLayers;
diff --git a/libs/hwui/renderstate/Scissor.cpp b/libs/hwui/renderstate/Scissor.cpp
deleted file mode 100644
index e37ed02..0000000
--- a/libs/hwui/renderstate/Scissor.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "renderstate/Scissor.h"
-
-#include "Rect.h"
-
-#include <utils/Log.h>
-
-namespace android {
-namespace uirenderer {
-
-Scissor::Scissor()
-        : mEnabled(false), mScissorX(0), mScissorY(0), mScissorWidth(0), mScissorHeight(0) {}
-
-bool Scissor::setEnabled(bool enabled) {
-    if (mEnabled != enabled) {
-        if (enabled) {
-            glEnable(GL_SCISSOR_TEST);
-        } else {
-            glDisable(GL_SCISSOR_TEST);
-        }
-        mEnabled = enabled;
-        return true;
-    }
-    return false;
-}
-
-bool Scissor::set(GLint x, GLint y, GLint width, GLint height) {
-    if (mEnabled &&
-        (x != mScissorX || y != mScissorY || width != mScissorWidth || height != mScissorHeight)) {
-        if (x < 0) {
-            width += x;
-            x = 0;
-        }
-        if (y < 0) {
-            height += y;
-            y = 0;
-        }
-        if (width < 0) {
-            width = 0;
-        }
-        if (height < 0) {
-            height = 0;
-        }
-        glScissor(x, y, width, height);
-
-        mScissorX = x;
-        mScissorY = y;
-        mScissorWidth = width;
-        mScissorHeight = height;
-
-        return true;
-    }
-    return false;
-}
-
-void Scissor::set(int viewportHeight, const Rect& clip) {
-    // transform to Y-flipped GL space, and prevent negatives
-    GLint x = std::max(0, (int)clip.left);
-    GLint y = std::max(0, viewportHeight - (int)clip.bottom);
-    GLint width = std::max(0, ((int)clip.right) - x);
-    GLint height = std::max(0, (viewportHeight - (int)clip.top) - y);
-
-    if (x != mScissorX || y != mScissorY || width != mScissorWidth || height != mScissorHeight) {
-        glScissor(x, y, width, height);
-
-        mScissorX = x;
-        mScissorY = y;
-        mScissorWidth = width;
-        mScissorHeight = height;
-    }
-}
-
-void Scissor::reset() {
-    mScissorX = mScissorY = mScissorWidth = mScissorHeight = 0;
-}
-
-void Scissor::invalidate() {
-    mEnabled = glIsEnabled(GL_SCISSOR_TEST);
-    setEnabled(true);
-    reset();
-}
-
-void Scissor::dump() {
-    ALOGD("Scissor: enabled %d, %d %d %d %d", mEnabled, mScissorX, mScissorY, mScissorWidth,
-          mScissorHeight);
-}
-
-} /* namespace uirenderer */
-} /* namespace android */
diff --git a/libs/hwui/renderstate/Scissor.h b/libs/hwui/renderstate/Scissor.h
deleted file mode 100644
index 2b04f4e..0000000
--- a/libs/hwui/renderstate/Scissor.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef RENDERSTATE_SCISSOR_H
-#define RENDERSTATE_SCISSOR_H
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-namespace android {
-namespace uirenderer {
-
-class Rect;
-
-class Scissor {
-    friend class RenderState;
-
-public:
-    bool setEnabled(bool enabled);
-    bool set(GLint x, GLint y, GLint width, GLint height);
-    void set(int viewportHeight, const Rect& clip);
-    void reset();
-    bool isEnabled() { return mEnabled; }
-    void dump();
-
-private:
-    Scissor();
-    void invalidate();
-    bool mEnabled;
-    GLint mScissorX;
-    GLint mScissorY;
-    GLint mScissorWidth;
-    GLint mScissorHeight;
-};
-
-} /* namespace uirenderer */
-} /* namespace android */
-
-#endif  // RENDERSTATE_SCISSOR_H
diff --git a/libs/hwui/renderstate/Stencil.cpp b/libs/hwui/renderstate/Stencil.cpp
deleted file mode 100644
index dc465fc..0000000
--- a/libs/hwui/renderstate/Stencil.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "renderstate/Stencil.h"
-
-#include "Caches.h"
-#include "Debug.h"
-#include "Extensions.h"
-#include "Properties.h"
-
-#include <GLES2/gl2ext.h>
-
-namespace android {
-namespace uirenderer {
-
-#if DEBUG_STENCIL
-#define STENCIL_WRITE_VALUE 0xff
-#define STENCIL_MASK_VALUE 0xff
-#else
-#define STENCIL_WRITE_VALUE 0x1
-#define STENCIL_MASK_VALUE 0x1
-#endif
-
-uint8_t Stencil::getStencilSize() {
-    return STENCIL_BUFFER_SIZE;
-}
-
-/**
- * This method will return either GL_STENCIL_INDEX4_OES if supported,
- * GL_STENCIL_INDEX8 if not.
- *
- * Layers can't use a single bit stencil because multi-rect ClipArea needs a high enough
- * stencil resolution to represent the summation of multiple intersecting rect geometries.
- */
-GLenum Stencil::getLayerStencilFormat() {
-#if !DEBUG_STENCIL
-    const Extensions& extensions = DeviceInfo::get()->extensions();
-    if (extensions.has4BitStencil()) {
-        return GL_STENCIL_INDEX4_OES;
-    }
-#endif
-    return GL_STENCIL_INDEX8;
-}
-
-void Stencil::clear() {
-    glStencilMask(0xff);
-    glClearStencil(0);
-    glClear(GL_STENCIL_BUFFER_BIT);
-
-    if (mState == StencilState::Test) {
-        // reset to test state, with immutable stencil
-        glStencilMask(0);
-    }
-}
-
-void Stencil::enableTest(int incrementThreshold) {
-    if (mState != StencilState::Test) {
-        enable();
-        if (incrementThreshold > 0) {
-            glStencilFunc(GL_EQUAL, incrementThreshold, 0xff);
-        } else {
-            glStencilFunc(GL_EQUAL, STENCIL_WRITE_VALUE, STENCIL_MASK_VALUE);
-        }
-        // We only want to test, let's keep everything
-        glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
-        glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-        glStencilMask(0);
-        mState = StencilState::Test;
-    }
-}
-
-void Stencil::enableWrite(int incrementThreshold) {
-    if (mState != StencilState::Write) {
-        enable();
-        if (incrementThreshold > 0) {
-            glStencilFunc(GL_ALWAYS, 1, 0xff);
-            // The test always passes so the first two values are meaningless
-            glStencilOp(GL_INCR, GL_INCR, GL_INCR);
-        } else {
-            glStencilFunc(GL_ALWAYS, STENCIL_WRITE_VALUE, STENCIL_MASK_VALUE);
-            // The test always passes so the first two values are meaningless
-            glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
-        }
-        glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
-        glStencilMask(0xff);
-        mState = StencilState::Write;
-    }
-}
-
-void Stencil::enableDebugTest(GLint value, bool greater) {
-    enable();
-    glStencilFunc(greater ? GL_LESS : GL_EQUAL, value, 0xffffffff);
-    // We only want to test, let's keep everything
-    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
-    mState = StencilState::Test;
-    glStencilMask(0);
-}
-
-void Stencil::enableDebugWrite() {
-    enable();
-    glStencilFunc(GL_ALWAYS, 0x1, 0xffffffff);
-    // The test always passes so the first two values are meaningless
-    glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
-    glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-    mState = StencilState::Write;
-    glStencilMask(0xff);
-}
-
-void Stencil::enable() {
-    if (mState == StencilState::Disabled) {
-        glEnable(GL_STENCIL_TEST);
-    }
-}
-
-void Stencil::disable() {
-    if (mState != StencilState::Disabled) {
-        glDisable(GL_STENCIL_TEST);
-        mState = StencilState::Disabled;
-    }
-}
-
-void Stencil::dump() {
-    ALOGD("Stencil: state %d", mState);
-}
-
-};  // namespace uirenderer
-};  // namespace android
diff --git a/libs/hwui/renderstate/Stencil.h b/libs/hwui/renderstate/Stencil.h
deleted file mode 100644
index 95f3723..0000000
--- a/libs/hwui/renderstate/Stencil.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HWUI_STENCIL_H
-#define ANDROID_HWUI_STENCIL_H
-
-#include <GLES2/gl2.h>
-
-#include <cutils/compiler.h>
-
-namespace android {
-namespace uirenderer {
-
-///////////////////////////////////////////////////////////////////////////////
-// Stencil buffer management
-///////////////////////////////////////////////////////////////////////////////
-
-class ANDROID_API Stencil {
-public:
-    /**
-     * Returns the desired size for the stencil buffer. If the returned value
-     * is 0, then no stencil buffer is required.
-     */
-    ANDROID_API static uint8_t getStencilSize();
-
-    static GLenum getLayerStencilFormat();
-
-    /**
-     * Clears the stencil buffer.
-     */
-    void clear();
-
-    /**
-     * Enables stencil test. When the stencil test is enabled the stencil buffer is not written
-     * into. An increment threshold of zero causes the stencil to use a constant reference value
-     * and GL_EQUAL for the test. A non-zero increment threshold causes the stencil to use that
-     * value as the reference value and GL_EQUAL for the test.
-     */
-    void enableTest(int incrementThreshold);
-
-    /**
-     * Enables stencil write. When stencil write is enabled, the stencil
-     * test always succeeds and the value 0x1 is written in the stencil
-     * buffer for each fragment. An increment threshold of zero causes the stencil to use a constant
-     * reference value and GL_EQUAL for the test. A non-zero increment threshold causes the stencil
-     * to use that value as the reference value and GL_EQUAL for the test.
-     */
-    void enableWrite(int incrementThreshold);
-
-    /**
-     * The test passes only when equal to the specified value.
-     */
-    void enableDebugTest(GLint value, bool greater = false);
-
-    /**
-     * Used for debugging. The stencil test always passes and increments.
-     */
-    void enableDebugWrite();
-
-    /**
-     * Disables stencil test and write.
-     */
-    void disable();
-
-    /**
-     * Indicates whether either test or write is enabled.
-     */
-    bool isEnabled() { return mState != StencilState::Disabled; }
-
-    /**
-     * Indicates whether testing only is enabled.
-     */
-    bool isTestEnabled() { return mState == StencilState::Test; }
-
-    bool isWriteEnabled() { return mState == StencilState::Write; }
-
-    void dump();
-
-private:
-    enum class StencilState { Disabled, Test, Write };
-
-    void enable();
-    StencilState mState = StencilState::Disabled;
-
-};  // class Stencil
-
-};  // namespace uirenderer
-};  // namespace android
-
-#endif  // ANDROID_HWUI_STENCIL_H