diff options
author | Chris Craik <ccraik@google.com> | 2015-03-02 17:50:26 -0800 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2015-03-02 17:56:06 -0800 |
commit | e5c6584a402fb3b1fe0507e4e00e601bec8f1bbc (patch) | |
tree | 724a7a9622fe905b79f6efd37391c8daf135c1bc /libs | |
parent | c66f3baa42b8a732952abf1967c68f77d3e26131 (diff) | |
download | frameworks_base-e5c6584a402fb3b1fe0507e4e00e601bec8f1bbc.zip frameworks_base-e5c6584a402fb3b1fe0507e4e00e601bec8f1bbc.tar.gz frameworks_base-e5c6584a402fb3b1fe0507e4e00e601bec8f1bbc.tar.bz2 |
Constructor cleanup
Change-Id: Ic39911d08f44c3174de91fb92fcd4cab73fe4654
Diffstat (limited to 'libs')
-rw-r--r-- | libs/hwui/Layer.cpp | 17 | ||||
-rw-r--r-- | libs/hwui/Layer.h | 38 | ||||
-rw-r--r-- | libs/hwui/LayerCache.cpp | 3 | ||||
-rw-r--r-- | libs/hwui/LayerRenderer.cpp | 3 | ||||
-rw-r--r-- | libs/hwui/Patch.cpp | 7 | ||||
-rw-r--r-- | libs/hwui/Patch.h | 15 |
6 files changed, 28 insertions, 55 deletions
diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp index 7a026ef..458f35b 100644 --- a/libs/hwui/Layer.cpp +++ b/libs/hwui/Layer.cpp @@ -37,7 +37,7 @@ namespace android { namespace uirenderer { -Layer::Layer(Type layerType, RenderState& renderState, const uint32_t layerWidth, const uint32_t layerHeight) +Layer::Layer(Type layerType, RenderState& renderState, uint32_t layerWidth, uint32_t layerHeight) : state(kState_Uncached) , caches(Caches::getInstance()) , renderState(renderState) @@ -46,24 +46,9 @@ Layer::Layer(Type layerType, RenderState& renderState, const uint32_t layerWidth // TODO: This is a violation of Android's typical ref counting, but it // preserves the old inc/dec ref locations. This should be changed... incStrong(nullptr); - mesh = nullptr; - meshElementCount = 0; - cacheable = true; - dirty = false; renderTarget = GL_TEXTURE_2D; texture.width = layerWidth; texture.height = layerHeight; - colorFilter = nullptr; - deferredUpdateScheduled = false; - renderNode = nullptr; - fbo = 0; - stencil = nullptr; - debugDrawUpdate = false; - hasDrawnSinceUpdate = false; - forceFilter = false; - convexMask = nullptr; - rendererLightPosDirty = true; - wasBuildLayered = false; renderState.registerLayer(this); } diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h index 3c1f1d1..b670870 100644 --- a/libs/hwui/Layer.h +++ b/libs/hwui/Layer.h @@ -72,7 +72,7 @@ public: }; State state; // public for logging/debugging purposes - Layer(Type type, RenderState& renderState, const uint32_t layerWidth, const uint32_t layerHeight); + Layer(Type type, RenderState& renderState, uint32_t layerWidth, uint32_t layerHeight); ~Layer(); static uint32_t computeIdealWidth(uint32_t layerWidth); @@ -324,19 +324,19 @@ public: /** * If the layer can be rendered as a mesh, this is non-null. */ - TextureVertex* mesh; - GLsizei meshElementCount; + TextureVertex* mesh = nullptr; + GLsizei meshElementCount = 0; /** * Used for deferred updates. */ - bool deferredUpdateScheduled; + bool deferredUpdateScheduled = false; std::unique_ptr<OpenGLRenderer> renderer; sp<RenderNode> renderNode; Rect dirtyRect; - bool debugDrawUpdate; - bool hasDrawnSinceUpdate; - bool wasBuildLayered; + bool debugDrawUpdate = false; + bool hasDrawnSinceUpdate = false; + bool wasBuildLayered = false; private: void requireRenderer(); @@ -350,17 +350,17 @@ private: * Name of the FBO used to render the layer. If the name is 0 * this layer is not backed by an FBO, but a simple texture. */ - GLuint fbo; + GLuint fbo = 0; /** * The render buffer used as the stencil buffer. */ - RenderBuffer* stencil; + RenderBuffer* stencil = nullptr; /** * Indicates whether this layer has been used already. */ - bool empty; + bool empty = true; /** * The texture backing this layer. @@ -370,7 +370,7 @@ private: /** * If set to true (by default), the layer can be reused. */ - bool cacheable; + bool cacheable = true; /** * Denotes whether the layer is a DisplayList, or Texture layer. @@ -381,32 +381,32 @@ private: * When set to true, this layer is dirty and should be cleared * before any rendering occurs. */ - bool dirty; + bool dirty = false; /** * Indicates the render target. */ - GLenum renderTarget; + GLenum renderTarget = GL_TEXTURE_2D; /** * Color filter used to draw this layer. Optional. */ - SkColorFilter* colorFilter; + SkColorFilter* colorFilter = nullptr; /** * Indicates raster data backing the layer is scaled, requiring filtration. */ - bool forceFilter; + bool forceFilter = false; /** * Opacity of the layer. */ - int alpha; + int alpha = 255; /** * Blending mode of the layer. */ - SkXfermode::Mode mode; + SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode; /** * Optional texture coordinates transform. @@ -422,7 +422,7 @@ private: * Cached transform of layer in window, updated only on creation / resize */ mat4 cachedInvTransformInWindow; - bool rendererLightPosDirty; + bool rendererLightPosDirty = true; /** * Used to defer display lists when the layer is updated with a @@ -435,7 +435,7 @@ private: * * Data not owned/managed by layer object. */ - const SkPath* convexMask; + const SkPath* convexMask = nullptr; }; // struct Layer diff --git a/libs/hwui/LayerCache.cpp b/libs/hwui/LayerCache.cpp index 60d4f4f..bcbd412 100644 --- a/libs/hwui/LayerCache.cpp +++ b/libs/hwui/LayerCache.cpp @@ -116,9 +116,6 @@ Layer* LayerCache::get(RenderState& renderState, const uint32_t width, const uin layer = new Layer(Layer::kType_DisplayList, renderState, entry.mWidth, entry.mHeight); layer->setBlend(true); - layer->setEmpty(true); - layer->setFbo(0); - layer->generateTexture(); layer->bindTexture(); layer->setFilter(GL_NEAREST); diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp index 1326206..223bdf0 100644 --- a/libs/hwui/LayerRenderer.cpp +++ b/libs/hwui/LayerRenderer.cpp @@ -275,9 +275,6 @@ Layer* LayerRenderer::createTextureLayer(RenderState& renderState) { Layer* layer = new Layer(Layer::kType_Texture, renderState, 0, 0); layer->setCacheable(false); - layer->setEmpty(true); - layer->setFbo(0); - layer->setAlpha(255, SkXfermode::kSrcOver_Mode); layer->layer.set(0.0f, 0.0f, 0.0f, 0.0f); layer->texCoords.set(0.0f, 1.0f, 1.0f, 0.0f); layer->region.clear(); diff --git a/libs/hwui/Patch.cpp b/libs/hwui/Patch.cpp index 8a4d65b..ce51e04 100644 --- a/libs/hwui/Patch.cpp +++ b/libs/hwui/Patch.cpp @@ -29,13 +29,6 @@ namespace android { namespace uirenderer { /////////////////////////////////////////////////////////////////////////////// -// Constructors/destructor -/////////////////////////////////////////////////////////////////////////////// - -Patch::Patch(): vertices(), verticesCount(0), indexCount(0), hasEmptyQuads(false) { -} - -/////////////////////////////////////////////////////////////////////////////// // Vertices management /////////////////////////////////////////////////////////////////////////////// diff --git a/libs/hwui/Patch.h b/libs/hwui/Patch.h index ea8c8c2..9afb41d 100644 --- a/libs/hwui/Patch.h +++ b/libs/hwui/Patch.h @@ -39,7 +39,7 @@ struct TextureVertex; class Patch { public: - Patch(); + Patch() {} /** * Returns the size of this patch's mesh in bytes. @@ -47,13 +47,14 @@ public: uint32_t getSize() const; std::unique_ptr<TextureVertex[]> vertices; - uint32_t verticesCount; - uint32_t indexCount; - bool hasEmptyQuads; + uint32_t verticesCount = 0; + uint32_t indexCount = 0; + bool hasEmptyQuads = false; Vector<Rect> quads; - GLintptr offset; - GLintptr textureOffset; + Rect bounds; + GLintptr offset = 0; + GLintptr textureOffset = 0; TextureVertex* createMesh(const float bitmapWidth, const float bitmapHeight, float width, float height, const Res_png_9patch* patch); @@ -67,7 +68,7 @@ private: void generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, float y2, float u1, float v1, float u2, float v2, uint32_t& quadCount); - const uint32_t* mColors; + const uint32_t* mColors = nullptr; UvMapper mUvMapper; }; // struct Patch |