diff options
author | Chris Craik <ccraik@google.com> | 2014-12-22 17:16:56 -0800 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2014-12-23 16:53:56 -0800 |
commit | 51d6a3db97bdd5315f1a17a4b447d10a92217b98 (patch) | |
tree | 80803f8d2a5507e2d29bd58c7243a23fca343454 /libs/hwui/GammaFontRenderer.cpp | |
parent | e84a208317e0ed388fcdad1e6743c7849acb51b0 (diff) | |
download | frameworks_base-51d6a3db97bdd5315f1a17a4b447d10a92217b98.zip frameworks_base-51d6a3db97bdd5315f1a17a4b447d10a92217b98.tar.gz frameworks_base-51d6a3db97bdd5315f1a17a4b447d10a92217b98.tar.bz2 |
Cleanup various clang warnings, use unique_ptrs in several places
Change-Id: I347904b25e51fcc7de14b1e72f1acd0f6ba26f3f
Diffstat (limited to 'libs/hwui/GammaFontRenderer.cpp')
-rw-r--r-- | libs/hwui/GammaFontRenderer.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/libs/hwui/GammaFontRenderer.cpp b/libs/hwui/GammaFontRenderer.cpp index 06d2aad..0a98c29 100644 --- a/libs/hwui/GammaFontRenderer.cpp +++ b/libs/hwui/GammaFontRenderer.cpp @@ -183,12 +183,6 @@ Lookup3GammaFontRenderer::Lookup3GammaFontRenderer(): GammaFontRenderer() { memset(mRenderersUsageCount, 0, sizeof(uint32_t) * kGammaCount); } -Lookup3GammaFontRenderer::~Lookup3GammaFontRenderer() { - for (int i = 0; i < kGammaCount; i++) { - delete mRenderers[i]; - } -} - void Lookup3GammaFontRenderer::endPrecaching() { for (int i = 0; i < kGammaCount; i++) { if (mRenderers[i]) { @@ -199,8 +193,7 @@ void Lookup3GammaFontRenderer::endPrecaching() { void Lookup3GammaFontRenderer::clear() { for (int i = 0; i < kGammaCount; i++) { - delete mRenderers[i]; - mRenderers[i] = NULL; + mRenderers[i].release(); } } @@ -221,8 +214,7 @@ void Lookup3GammaFontRenderer::flush() { if (count <= 1 || min < 0) return; - delete mRenderers[min]; - mRenderers[min] = NULL; + mRenderers[min].release(); // Also eliminate the caches for large glyphs, as they consume significant memory for (int i = 0; i < kGammaCount; ++i) { @@ -233,14 +225,12 @@ void Lookup3GammaFontRenderer::flush() { } FontRenderer* Lookup3GammaFontRenderer::getRenderer(Gamma gamma) { - FontRenderer* renderer = mRenderers[gamma]; - if (!renderer) { - renderer = new FontRenderer(); - mRenderers[gamma] = renderer; - renderer->setGammaTable(&mGammaTable[gamma * 256]); + if (!mRenderers[gamma]) { + mRenderers[gamma].reset(new FontRenderer()); + mRenderers[gamma]->setGammaTable(&mGammaTable[gamma * 256]); } mRenderersUsageCount[gamma]++; - return renderer; + return mRenderers[gamma].get(); } FontRenderer& Lookup3GammaFontRenderer::getFontRenderer(const SkPaint* paint) { |