Revert "Call minikin::getBounds instead of using Layout."
This reverts commit efd38dd504.
This regresses the DynamicLayout performance since it aggressively
calls TextPaint.getTextBounds.
CTS will not be removed since their test is still valid.
Bug: 170230123
Bug: 169114687
Test: N/A
Change-Id: I9f0951c6aefb7785137c00c7f802fb0c0a518cd2
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
#include <log/log.h>
|
||||
|
||||
#include <minikin/MeasuredText.h>
|
||||
#include <minikin/Measurement.h>
|
||||
#include "Paint.h"
|
||||
#include "SkPathMeasure.h"
|
||||
#include "Typeface.h"
|
||||
@@ -70,18 +69,6 @@ minikin::Layout MinikinUtils::doLayout(const Paint* paint, minikin::Bidi bidiFla
|
||||
}
|
||||
}
|
||||
|
||||
void MinikinUtils::getBounds(const Paint* paint, minikin::Bidi bidiFlags, const Typeface* typeface,
|
||||
const uint16_t* buf, size_t bufSize, minikin::MinikinRect* out) {
|
||||
minikin::MinikinPaint minikinPaint = prepareMinikinPaint(paint, typeface);
|
||||
|
||||
const minikin::U16StringPiece textBuf(buf, bufSize);
|
||||
const minikin::StartHyphenEdit startHyphen = paint->getStartHyphenEdit();
|
||||
const minikin::EndHyphenEdit endHyphen = paint->getEndHyphenEdit();
|
||||
|
||||
minikin::getBounds(textBuf, minikin::Range(0, textBuf.size()), bidiFlags, minikinPaint,
|
||||
startHyphen, endHyphen, out);
|
||||
}
|
||||
|
||||
float MinikinUtils::measureText(const Paint* paint, minikin::Bidi bidiFlags,
|
||||
const Typeface* typeface, const uint16_t* buf, size_t start,
|
||||
size_t count, size_t bufSize, float* advances) {
|
||||
|
||||
@@ -48,9 +48,6 @@ public:
|
||||
size_t contextStart, size_t contextCount,
|
||||
minikin::MeasuredText* mt);
|
||||
|
||||
static void getBounds(const Paint* paint, minikin::Bidi bidiFlags, const Typeface* typeface,
|
||||
const uint16_t* buf, size_t bufSize, minikin::MinikinRect* out);
|
||||
|
||||
static float measureText(const Paint* paint, minikin::Bidi bidiFlags,
|
||||
const Typeface* typeface, const uint16_t* buf,
|
||||
size_t start, size_t count, size_t bufSize,
|
||||
|
||||
@@ -339,13 +339,18 @@ namespace PaintGlue {
|
||||
}
|
||||
|
||||
static void doTextBounds(JNIEnv* env, const jchar* text, int count, jobject bounds,
|
||||
const Paint& paint, const Typeface* typeface, jint bidiFlagsInt) {
|
||||
const Paint& paint, const Typeface* typeface, jint bidiFlags) {
|
||||
SkRect r;
|
||||
SkIRect ir;
|
||||
|
||||
minikin::Layout layout = MinikinUtils::doLayout(&paint,
|
||||
static_cast<minikin::Bidi>(bidiFlags), typeface,
|
||||
text, count, // text buffer
|
||||
0, count, // draw range
|
||||
0, count, // context range
|
||||
nullptr);
|
||||
minikin::MinikinRect rect;
|
||||
minikin::Bidi bidiFlags = static_cast<minikin::Bidi>(bidiFlagsInt);
|
||||
MinikinUtils::getBounds(&paint, bidiFlags, typeface, text, count, &rect);
|
||||
layout.getBounds(&rect);
|
||||
r.fLeft = rect.mLeft;
|
||||
r.fTop = rect.mTop;
|
||||
r.fRight = rect.mRight;
|
||||
|
||||
Reference in New Issue
Block a user