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 <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2017-08-11 13:34:02 -04:00 committed by Skia Commit-Bot
parent a1d1703b74
commit 6382f455f0

View File

@ -11,6 +11,7 @@
#include "GrRectanizer.h"
#include "GrSurfacePriv.h"
#include "SkAutoMalloc.h"
#include "SkMathPriv.h"
#include "SkString.h"
#include "SkDistanceFieldGen.h"
@ -38,7 +39,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;