diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/androidfw/Asset.cpp | 6 | ||||
-rw-r--r-- | libs/androidfw/ZipFileRO.cpp | 2 | ||||
-rw-r--r-- | libs/hwui/GradientCache.cpp | 2 | ||||
-rw-r--r-- | libs/hwui/RenderNode.cpp | 7 | ||||
-rw-r--r-- | libs/hwui/Texture.cpp | 40 | ||||
-rw-r--r-- | libs/hwui/Texture.h | 39 | ||||
-rw-r--r-- | libs/hwui/TextureCache.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/tests/main.cpp | 2 |
8 files changed, 31 insertions, 73 deletions
diff --git a/libs/androidfw/Asset.cpp b/libs/androidfw/Asset.cpp index 4b3382e..782806e 100644 --- a/libs/androidfw/Asset.cpp +++ b/libs/androidfw/Asset.cpp @@ -532,7 +532,7 @@ off64_t _FileAsset::seek(off64_t offset, int whence) void _FileAsset::close(void) { if (mMap != NULL) { - mMap->release(); + delete mMap; mMap = NULL; } if (mBuf != NULL) { @@ -612,7 +612,7 @@ const void* _FileAsset::getBuffer(bool wordAligned) map = new FileMap; if (!map->create(NULL, fileno(mFp), mStart, mLength, true)) { - map->release(); + delete map; return NULL; } @@ -827,7 +827,7 @@ off64_t _CompressedAsset::seek(off64_t offset, int whence) void _CompressedAsset::close(void) { if (mMap != NULL) { - mMap->release(); + delete mMap; mMap = NULL; } diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp index ef0d072..af3d9b3 100644 --- a/libs/androidfw/ZipFileRO.cpp +++ b/libs/androidfw/ZipFileRO.cpp @@ -200,7 +200,7 @@ FileMap* ZipFileRO::createEntryFileMap(ZipEntryRO entry) const FileMap* newMap = new FileMap(); if (!newMap->create(mFileName, fd, ze.offset, actualLen, true)) { - newMap->release(); + delete newMap; return NULL; } diff --git a/libs/hwui/GradientCache.cpp b/libs/hwui/GradientCache.cpp index fb4c785..ea93e7f 100644 --- a/libs/hwui/GradientCache.cpp +++ b/libs/hwui/GradientCache.cpp @@ -166,7 +166,7 @@ Texture* GradientCache::addLinearGradient(GradientCacheEntry& gradient, GradientInfo info; getGradientInfo(colors, count, info); - Texture* texture = new Texture(); + Texture* texture = new Texture(Caches::getInstance()); texture->width = info.width; texture->height = 2; texture->blend = info.hasAlpha; diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 659ef6c..c6fdd3f 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -402,9 +402,10 @@ void RenderNode::setViewProperties(OpenGLRenderer& renderer, T& handler) { clipFlags = 0; // all clipping done by saveLayer } - ATRACE_FORMAT("%s alpha caused %ssaveLayer %dx%d", - getName(), clipFlags ? "" : "unclipped ", - (int)layerBounds.getWidth(), (int)layerBounds.getHeight()); + ATRACE_FORMAT("%s alpha caused %ssaveLayer %dx%d", getName(), + (saveFlags & SkCanvas::kClipToLayer_SaveFlag) ? "" : "unclipped ", + static_cast<int>(layerBounds.getWidth()), + static_cast<int>(layerBounds.getHeight())); SaveLayerOp* op = new (handler.allocator()) SaveLayerOp( layerBounds.left, layerBounds.top, layerBounds.right, layerBounds.bottom, diff --git a/libs/hwui/Texture.cpp b/libs/hwui/Texture.cpp index 512f5cf..593e918 100644 --- a/libs/hwui/Texture.cpp +++ b/libs/hwui/Texture.cpp @@ -24,46 +24,6 @@ namespace android { namespace uirenderer { -Texture::Texture() - : id(0) - , generation(0) - , blend(false) - , width(0) - , height(0) - , cleanup(false) - , bitmapSize(0) - , mipMap(false) - , uvMapper(nullptr) - , isInUse(false) - , mWrapS(GL_CLAMP_TO_EDGE) - , mWrapT(GL_CLAMP_TO_EDGE) - , mMinFilter(GL_NEAREST) - , mMagFilter(GL_NEAREST) - , mFirstFilter(true) - , mFirstWrap(true) - , mCaches(Caches::getInstance()) { -} - -Texture::Texture(Caches& caches) - : id(0) - , generation(0) - , blend(false) - , width(0) - , height(0) - , cleanup(false) - , bitmapSize(0) - , mipMap(false) - , uvMapper(nullptr) - , isInUse(false) - , mWrapS(GL_CLAMP_TO_EDGE) - , mWrapT(GL_CLAMP_TO_EDGE) - , mMinFilter(GL_NEAREST) - , mMagFilter(GL_NEAREST) - , mFirstFilter(true) - , mFirstWrap(true) - , mCaches(caches) { -} - void Texture::setWrapST(GLenum wrapS, GLenum wrapT, bool bindTexture, bool force, GLenum renderTarget) { diff --git a/libs/hwui/Texture.h b/libs/hwui/Texture.h index d5601f8..dfec462 100644 --- a/libs/hwui/Texture.h +++ b/libs/hwui/Texture.h @@ -30,8 +30,7 @@ class UvMapper; */ class Texture { public: - Texture(); - Texture(Caches& caches); + Texture(Caches& caches) : mCaches(caches) { } virtual ~Texture() { } @@ -59,62 +58,62 @@ public: /** * Name of the texture. */ - GLuint id; + GLuint id = 0; /** * Generation of the backing bitmap, */ - uint32_t generation; + uint32_t generation = 0; /** * Indicates whether the texture requires blending. */ - bool blend; + bool blend = false; /** * Width of the backing bitmap. */ - uint32_t width; + uint32_t width = 0; /** * Height of the backing bitmap. */ - uint32_t height; + uint32_t height = 0; /** * Indicates whether this texture should be cleaned up after use. */ - bool cleanup; + bool cleanup= false; /** * Optional, size of the original bitmap. */ - uint32_t bitmapSize; + uint32_t bitmapSize = 0; /** * Indicates whether this texture will use trilinear filtering. */ - bool mipMap; + bool mipMap = false; /** * Optional, pointer to a texture coordinates mapper. */ - const UvMapper* uvMapper; + const UvMapper* uvMapper = nullptr; /** * Whether or not the Texture is marked in use and thus not evictable for * the current frame. This is reset at the start of a new frame. */ - bool isInUse; + bool isInUse = false; private: /** - * Last wrap modes set on this texture. Defaults to GL_CLAMP_TO_EDGE. + * Last wrap modes set on this texture. */ - GLenum mWrapS; - GLenum mWrapT; + GLenum mWrapS = GL_CLAMP_TO_EDGE; + GLenum mWrapT = GL_CLAMP_TO_EDGE; /** - * Last filters set on this texture. Defaults to GL_NEAREST. + * Last filters set on this texture. */ - GLenum mMinFilter; - GLenum mMagFilter; + GLenum mMinFilter = GL_NEAREST; + GLenum mMagFilter = GL_NEAREST; - bool mFirstFilter; - bool mFirstWrap; + bool mFirstFilter = true; + bool mFirstWrap = true; Caches& mCaches; }; // struct Texture diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp index f4f8e44..b911a0f 100644 --- a/libs/hwui/TextureCache.cpp +++ b/libs/hwui/TextureCache.cpp @@ -168,7 +168,7 @@ Texture* TextureCache::getCachedTexture(const SkBitmap* bitmap) { } if (canCache) { - texture = new Texture(); + texture = new Texture(Caches::getInstance()); texture->bitmapSize = size; generateTexture(bitmap, texture, false); @@ -206,7 +206,7 @@ Texture* TextureCache::get(const SkBitmap* bitmap) { } const uint32_t size = bitmap->rowBytes() * bitmap->height(); - texture = new Texture(); + texture = new Texture(Caches::getInstance()); texture->bitmapSize = size; generateTexture(bitmap, texture, false); texture->cleanup = true; @@ -216,7 +216,7 @@ Texture* TextureCache::get(const SkBitmap* bitmap) { } Texture* TextureCache::getTransient(const SkBitmap* bitmap) { - Texture* texture = new Texture(); + Texture* texture = new Texture(Caches::getInstance()); texture->bitmapSize = bitmap->rowBytes() * bitmap->height(); texture->cleanup = true; diff --git a/libs/hwui/tests/main.cpp b/libs/hwui/tests/main.cpp index 0431e22..b61d72f 100644 --- a/libs/hwui/tests/main.cpp +++ b/libs/hwui/tests/main.cpp @@ -89,8 +89,6 @@ public: android::uirenderer::Rect DUMMY; - std::vector< sp<RenderNode> > cards; - DisplayListRenderer* renderer = startRecording(rootNode); animation.createContent(width, height, renderer); endRecording(renderer, rootNode); |