Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a736cd9d authored by Chris Craik's avatar Chris Craik
Browse files

Remove scaling bucket hack

bug:16626221

Fixes glyph cache pressure and double scaling artifacts.

Change-Id: I06cde720db646531b45943283cb4ecb48af8ff5b
parent f660edb2
Loading
Loading
Loading
Loading
+1 −16
Original line number Diff line number Diff line
@@ -699,9 +699,6 @@ TextureVertex* Caches::getRegionMesh() {
///////////////////////////////////////////////////////////////////////////////

void Caches::initTempProperties() {
    propertyAmbientShadowStrength = 12;
    propertySpotShadowStrength = 48;

    propertyLightDiameter = -1.0f;
    propertyLightPosY = -1.0f;
    propertyLightPosZ = -1.0f;
@@ -710,15 +707,7 @@ void Caches::initTempProperties() {

void Caches::setTempProperty(const char* name, const char* value) {
    ALOGD("setting property %s to %s", name, value);
    if (!strcmp(name, "ambientShadowStrength")) {
        propertyAmbientShadowStrength = atoi(value);
        ALOGD("ambient shadow strength = 0x%x out of 0xff", propertyAmbientShadowStrength);
        return;
    } else if (!strcmp(name, "spotShadowStrength")) {
        propertySpotShadowStrength = atoi(value);
        ALOGD("spot shadow strength = 0x%x out of 0xff", propertySpotShadowStrength);
        return;
    } else if (!strcmp(name, "ambientRatio")) {
    if (!strcmp(name, "ambientRatio")) {
        propertyAmbientRatio = fmin(fmax(atof(value), 0.0), 10.0);
        ALOGD("ambientRatio = %.2f", propertyAmbientRatio);
        return;
@@ -734,10 +723,6 @@ void Caches::setTempProperty(const char* name, const char* value) {
        propertyLightPosZ = fmin(fmax(atof(value), 0.0), 3000.0);
        ALOGD("lightPos Z = %.2f", propertyLightPosZ);
        return;
    } else if (!strcmp(name, "extraRasterBucket")) {
        float bucket = atof(value);
        propertyExtraRasterBuckets.push_back(bucket);
        return;
    }
    ALOGD("    failed");
}
+0 −3
Original line number Diff line number Diff line
@@ -366,9 +366,6 @@ public:
    float propertyLightPosY;
    float propertyLightPosZ;
    float propertyAmbientRatio;
    int propertyAmbientShadowStrength;
    int propertySpotShadowStrength;
    std::vector<float> propertyExtraRasterBuckets;
private:
    enum OverdrawColorSet {
        kColorSet_Default = 0,
+6 −22
Original line number Diff line number Diff line
@@ -2809,31 +2809,15 @@ bool OpenGLRenderer::findBestFontTransform(const mat4& transform, SkMatrix* outM
    }

    /**
     * Input is a non-perspective, scaling transform. Generate a scale-only transform, based upon
     * bucketed scale values. Special case for 'extra raster buckets' - disable filtration in the
     * case of an exact match, and isSimple() transform
     * Input is a non-perspective, scaling transform. Generate a scale-only transform,
     * with values rounded to the nearest int.
     */
    float sx, sy;
    transform.decomposeScale(sx, sy);

    float bestSx = roundf(fmaxf(1.0f, sx));
    float bestSy = roundf(fmaxf(1.0f, sy));
    bool filter = true;

    for (unsigned int i = 0; i < mCaches.propertyExtraRasterBuckets.size(); i++) {
        float bucket = mCaches.propertyExtraRasterBuckets[i];
        if (sx == bucket && sy == bucket) {
            bestSx = bestSy = bucket;
            filter = !transform.isSimple(); // disable filter, if simple
            break;
        }

        if (fabs(bucket - sx) < fabs(bestSx - sx)) bestSx = sx;
        if (fabs(bucket - sy) < fabs(bestSy - sy)) bestSy = sy;
    }

    outMatrix->setScale(bestSx, bestSy);
    return filter;
    outMatrix->setScale(
            roundf(fmaxf(1.0f, sx)),
            roundf(fmaxf(1.0f, sy)));
    return true;
}

status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count, float x, float y,