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

Commit 22cfd047 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio Committed by Android (Google) Code Review
Browse files

Merge "Fix bug #5846413 "phone" keyboard layout is broken on master"

parents d215ddf3 bd901dee
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -776,9 +776,6 @@ public:

    static void doDrawGlyphs(SkCanvas* canvas, const jchar* glyphArray, int index, int count,
            jfloat x, jfloat y, int flags, SkPaint* paint) {
        // TODO: need to suppress this code after the GL renderer is modified for not
        // copying the paint

        // Beware: this needs Glyph encoding (already done on the Paint constructor)
        canvas->drawText(glyphArray + index * 2, count * 2, x, y, *paint);
    }
+31 −5
Original line number Diff line number Diff line
@@ -466,7 +466,8 @@ public:
        jchar* glyphsArray = env->GetCharArrayElements(glyphs, NULL);

        TextLayoutCacheValue value(contextCount);
        TextLayoutEngine::getInstance().computeValues(&value, paint, text, start, count, contextCount, flags);
        TextLayoutEngine::getInstance().computeValues(&value, paint, text, start, count,
                contextCount, flags);
        const jchar* shapedGlyphs = value.getGlyphs();
        size_t glyphsCount = value.getGlyphsCount();
        memcpy(glyphsArray, shapedGlyphs, sizeof(jchar) * glyphsCount);
@@ -673,13 +674,25 @@ public:
        }
    }

    static int breakText(JNIEnv* env, const SkPaint& paint, const jchar text[],
    static int breakText(JNIEnv* env, SkPaint& paint, const jchar text[],
                         int count, float maxWidth, jfloatArray jmeasured,
                         SkPaint::TextBufferDirection tbd) {
        SkASSERT(paint.getTextEncoding() == SkPaint::kUTF16_TextEncoding);
        sp<TextLayoutCacheValue> value;
#if USE_TEXT_LAYOUT_CACHE
        value = TextLayoutCache::getInstance().getValue(&paint, text, 0, count,
                count, paint.getFlags());
        if (value == NULL) {
            ALOGE("Cannot get TextLayoutCache value for text = '%s'",
                    String8(text, count).string());
        }
#else
        value = new TextLayoutCacheValue(count);
        TextLayoutEngine::getInstance().computeValues(value.get(), &paint,
                reinterpret_cast<const UChar*>(text), 0, count, count, paint.getFlags());
#endif

        SkScalar     measured;
        size_t       bytes = paint.breakText(text, count << 1,
        size_t       bytes = paint.breakText(value->getGlyphs(), value->getGlyphsCount() << 1,
                                   SkFloatToScalar(maxWidth), &measured, tbd);
        SkASSERT((bytes & 1) == 0);

@@ -743,7 +756,20 @@ public:
        SkRect  r;
        SkIRect ir;

        paint.measureText(text, count << 1, &r);
        sp<TextLayoutCacheValue> value;
#if USE_TEXT_LAYOUT_CACHE
        value = TextLayoutCache::getInstance().getValue(&paint, text, 0, count,
                count, paint.getFlags());
        if (value == NULL) {
            ALOGE("Cannot get TextLayoutCache value for text = '%s'",
                    String8(text, count).string());
        }
#else
        value = new TextLayoutCacheValue(count);
        TextLayoutEngine::getInstance().computeValues(value.get(), &paint,
                reinterpret_cast<const UChar*>(text), 0, count, count, paint.getFlags());
#endif
        paint.measureText(value->getGlyphs(), value->getGlyphsCount() << 1, &r);
        r.roundOut(&ir);
        GraphicsJNI::irect_to_jrect(ir, env, bounds);
    }
+5 −5
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ void TextLayoutCache::clear() {
/*
 * Caching
 */
sp<TextLayoutCacheValue> TextLayoutCache::getValue(SkPaint* paint,
sp<TextLayoutCacheValue> TextLayoutCache::getValue(const SkPaint* paint,
            const jchar* text, jint start, jint count, jint contextCount, jint dirFlags) {
    AutoMutex _l(mLock);
    nsecs_t startTime = 0;
@@ -360,7 +360,7 @@ TextLayoutEngine::~TextLayoutEngine() {
    // we don't bother at the moment
}

void TextLayoutEngine::computeValues(TextLayoutCacheValue* value, SkPaint* paint, const UChar* chars,
void TextLayoutEngine::computeValues(TextLayoutCacheValue* value, const SkPaint* paint, const UChar* chars,
        size_t start, size_t count, size_t contextCount, int dirFlags) {

    computeValues(paint, chars, start, count, contextCount, dirFlags,
@@ -371,7 +371,7 @@ void TextLayoutEngine::computeValues(TextLayoutCacheValue* value, SkPaint* paint
#endif
}

void TextLayoutEngine::computeValues(SkPaint* paint, const UChar* chars,
void TextLayoutEngine::computeValues(const SkPaint* paint, const UChar* chars,
        size_t start, size_t count, size_t contextCount, int dirFlags,
        Vector<jfloat>* const outAdvances, jfloat* outTotalAdvance,
        Vector<jchar>* const outGlyphs) {
@@ -513,7 +513,7 @@ static void logGlyphs(HB_ShaperItem shaperItem) {
    }
}

void TextLayoutEngine::computeRunValues(SkPaint* paint, const UChar* chars,
void TextLayoutEngine::computeRunValues(const SkPaint* paint, const UChar* chars,
        size_t count, bool isRTL,
        Vector<jfloat>* const outAdvances, jfloat* outTotalAdvance,
        Vector<jchar>* const outGlyphs) {
@@ -719,7 +719,7 @@ void TextLayoutEngine::computeRunValues(SkPaint* paint, const UChar* chars,
}


size_t TextLayoutEngine::shapeFontRun(SkPaint* paint, bool isRTL) {
size_t TextLayoutEngine::shapeFontRun(const SkPaint* paint, bool isRTL) {
    // Reset kerning
    mShaperItem.kerning_applied = false;

+5 −5
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ public:
     */
    void operator()(TextLayoutCacheKey& text, sp<TextLayoutCacheValue>& desc);

    sp<TextLayoutCacheValue> getValue(SkPaint* paint, const jchar* text, jint start, jint count,
    sp<TextLayoutCacheValue> getValue(const SkPaint* paint, const jchar* text, jint start, jint count,
            jint contextCount, jint dirFlags);

    /**
@@ -224,7 +224,7 @@ public:
    TextLayoutEngine();
    virtual ~TextLayoutEngine();

    void computeValues(TextLayoutCacheValue* value, SkPaint* paint, const UChar* chars,
    void computeValues(TextLayoutCacheValue* value, const SkPaint* paint, const UChar* chars,
            size_t start, size_t count, size_t contextCount, int dirFlags);

private:
@@ -273,14 +273,14 @@ private:
     */
    UnicodeString mBuffer;

    size_t shapeFontRun(SkPaint* paint, bool isRTL);
    size_t shapeFontRun(const SkPaint* paint, bool isRTL);

    void computeValues(SkPaint* paint, const UChar* chars,
    void computeValues(const SkPaint* paint, const UChar* chars,
            size_t start, size_t count, size_t contextCount, int dirFlags,
            Vector<jfloat>* const outAdvances, jfloat* outTotalAdvance,
            Vector<jchar>* const outGlyphs);

    void computeRunValues(SkPaint* paint, const UChar* chars,
    void computeRunValues(const SkPaint* paint, const UChar* chars,
            size_t count, bool isRTL,
            Vector<jfloat>* const outAdvances, jfloat* outTotalAdvance,
            Vector<jchar>* const outGlyphs);