Merge "Layoutlib: more text drawing."

This commit is contained in:
Xavier Ducrohet
2010-11-08 17:33:27 -08:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 11 deletions

View File

@@ -886,23 +886,22 @@ public class Canvas_Delegate {
native_drawText(nativeCanvas, buffer, 0, count, x, y, flags, paint);
}
/*package*/ static void native_drawTextRun(int nativeCanvas, String text,
int start, int end, int contextStart, int contextEnd,
float x, float y, int flags, int paint) {
// FIXME
throw new UnsupportedOperationException();
}
int count = end - start;
char[] buffer = TemporaryBuffer.obtain(count);
TextUtils.getChars(text, start, end, buffer, 0);
native_drawText(nativeCanvas, buffer, start, end, x, y, flags, paint);
}
/*package*/ static void native_drawTextRun(int nativeCanvas, char[] text,
int start, int count, int contextStart, int contextCount,
float x, float y, int flags, int paint) {
// FIXME
throw new UnsupportedOperationException();
native_drawText(nativeCanvas, text, 0, count, x, y, flags, paint);
}
/*package*/ static void native_drawPosText(int nativeCanvas,
char[] text, int index,
int count, float[] pos,

View File

@@ -430,7 +430,7 @@ public final class Bridge implements ILayoutBridge {
MeasureSpec.UNSPECIFIED); // this lets us know the actual needed size
h_spec = MeasureSpec.makeMeasureSpec(screenHeight - screenOffset,
MeasureSpec.UNSPECIFIED); // this lets us know the actual needed size
view.measure(w_spec, h_spec);
root.measure(w_spec, h_spec);
int neededWidth = root.getChildAt(0).getMeasuredWidth();
if (neededWidth > screenWidth) {
@@ -448,10 +448,10 @@ public final class Bridge implements ILayoutBridge {
w_spec = MeasureSpec.makeMeasureSpec(screenWidth, MeasureSpec.EXACTLY);
h_spec = MeasureSpec.makeMeasureSpec(screenHeight - screenOffset,
MeasureSpec.EXACTLY);
view.measure(w_spec, h_spec);
root.measure(w_spec, h_spec);
// now do the layout.
view.layout(0, screenOffset, screenWidth, screenHeight);
root.layout(0, screenOffset, screenWidth, screenHeight);
// draw the views
// create the BufferedImage into which the layout will be rendered.
@@ -468,7 +468,6 @@ public final class Bridge implements ILayoutBridge {
Canvas_Delegate canvasDelegate = Canvas_Delegate.getDelegate(canvas);
canvasDelegate.setLogger(logger);
root.draw(canvas);
canvasDelegate.dispose();