From: Brian Osman Date: Fri, 11 Aug 2017 17:34:02 +0000 (-0400) Subject: Replace log2 with SkNextLog2 X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=86fd20daf54c560e6bc36b47757aa7abf2a7a2db;p=platform%2Fupstream%2FlibSkiaSharp.git Replace log2 with SkNextLog2 log2 didn't exist on Android until API 18, and it's doing double precision math. I think this integer version is what we want? Bug: skia: Change-Id: I4909153c56a266688355349cda5d553b69f5c942 Reviewed-on: https://skia-review.googlesource.com/33680 Reviewed-by: Brian Salomon Commit-Queue: Brian Osman --- diff --git a/src/gpu/text/GrAtlasGlyphCache.cpp b/src/gpu/text/GrAtlasGlyphCache.cpp index 39c3e10..94c8ca7 100644 --- a/src/gpu/text/GrAtlasGlyphCache.cpp +++ b/src/gpu/text/GrAtlasGlyphCache.cpp @@ -12,6 +12,7 @@ #include "GrResourceProvider.h" #include "GrSurfacePriv.h" #include "SkAutoMalloc.h" +#include "SkMathPriv.h" #include "SkString.h" #include "SkDistanceFieldGen.h" @@ -39,7 +40,7 @@ bool GrAtlasGlyphCache::initAtlas(GrMaskFormat format) { GrAtlasGlyphCache::GrAtlasGlyphCache(GrContext* context, float maxTextureBytes) : fContext(context), fPreserveStrike(nullptr) { // Calculate RGBA size. Must be between 1024 x 512 and MaxTextureSize x MaxTextureSize / 2 - int log2MaxTextureSize = log2(context->caps()->maxTextureSize()); + int log2MaxTextureSize = SkPrevLog2(context->caps()->maxTextureSize()); int log2MaxDim = 10; for (; log2MaxDim <= log2MaxTextureSize; ++log2MaxDim) { int maxDim = 1 << log2MaxDim;