Loading tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java +1 −1 Original line number Diff line number Diff line Loading @@ -315,7 +315,7 @@ public final class Bitmap_Delegate { @LayoutlibDelegate /*package*/ static void nativeReconfigure(long nativeBitmap, int width, int height, int config, int allocSize) { int config, int allocSize, boolean isPremultiplied) { Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED, "Bitmap.reconfigure() is not supported", null /*data*/); } Loading tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java +61 −143 Original line number Diff line number Diff line Loading @@ -100,9 +100,9 @@ public final class Canvas_Delegate { // ---- native methods ---- @LayoutlibDelegate /*package*/ static boolean isOpaque(Canvas thisCanvas) { /*package*/ static boolean native_isOpaque(long nativeCanvas) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return false; } Loading @@ -111,9 +111,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static int getWidth(Canvas thisCanvas) { /*package*/ static int native_getWidth(long nativeCanvas) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return 0; } Loading @@ -122,9 +122,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static int getHeight(Canvas thisCanvas) { /*package*/ static int native_getHeight(long nativeCanvas) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return 0; } Loading @@ -133,9 +133,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void translate(Canvas thisCanvas, float dx, float dy) { /*package*/ static void native_translate(long nativeCanvas, float dx, float dy) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return; } Loading @@ -144,9 +144,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void rotate(Canvas thisCanvas, float degrees) { /*package*/ static void native_rotate(long nativeCanvas, float degrees) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return; } Loading @@ -155,9 +155,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void scale(Canvas thisCanvas, float sx, float sy) { /*package*/ static void native_scale(long nativeCanvas, float sx, float sy) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return; } Loading @@ -166,9 +166,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void skew(Canvas thisCanvas, float kx, float ky) { /*package*/ static void native_skew(long nativeCanvas, float kx, float ky) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return; } Loading @@ -190,44 +190,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static boolean clipRect(Canvas thisCanvas, RectF rect) { return clipRect(thisCanvas, rect.left, rect.top, rect.right, rect.bottom); } @LayoutlibDelegate /*package*/ static boolean clipRect(Canvas thisCanvas, Rect rect) { return clipRect(thisCanvas, (float) rect.left, (float) rect.top, (float) rect.right, (float) rect.bottom); } @LayoutlibDelegate /*package*/ static boolean clipRect(Canvas thisCanvas, float left, float top, float right, float bottom) { /*package*/ static int native_save(long nativeCanvas, int saveFlags) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); if (canvasDelegate == null) { return false; } return canvasDelegate.clipRect(left, top, right, bottom, Region.Op.INTERSECT.nativeInt); } @LayoutlibDelegate /*package*/ static boolean clipRect(Canvas thisCanvas, int left, int top, int right, int bottom) { return clipRect(thisCanvas, (float) left, (float) top, (float) right, (float) bottom); } @LayoutlibDelegate /*package*/ static int save(Canvas thisCanvas) { return save(thisCanvas, Canvas.MATRIX_SAVE_FLAG | Canvas.CLIP_SAVE_FLAG); } @LayoutlibDelegate /*package*/ static int save(Canvas thisCanvas, int saveFlags) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return 0; } Loading @@ -236,9 +201,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void restore(Canvas thisCanvas) { /*package*/ static void native_restore(long nativeCanvas) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return; } Loading @@ -247,9 +212,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static int getSaveCount(Canvas thisCanvas) { /*package*/ static int native_getSaveCount(long nativeCanvas) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return 0; } Loading @@ -258,9 +223,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void restoreToCount(Canvas thisCanvas, int saveCount) { /*package*/ static void native_restoreToCount(long nativeCanvas, int saveCount) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return; } Loading @@ -269,25 +234,27 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void drawPoints(Canvas thisCanvas, float[] pts, int offset, int count, Paint paint) { /*package*/ static void native_drawPoints(long nativeCanvas, float[] pts, int offset, int count, long nativePaint) { // FIXME Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED, "Canvas.drawPoint is not supported.", null, null /*data*/); } @LayoutlibDelegate /*package*/ static void drawPoint(Canvas thisCanvas, float x, float y, Paint paint) { /*package*/ static void native_drawPoint(long nativeCanvas, float x, float y, long nativePaint) { // FIXME Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED, "Canvas.drawPoint is not supported.", null, null /*data*/); } @LayoutlibDelegate /*package*/ static void drawLines(Canvas thisCanvas, /*package*/ static void native_drawLines(long nativeCanvas, final float[] pts, final int offset, final int count, Paint paint) { draw(thisCanvas.getNativeCanvasWrapper(), paint.mNativePaint, false /*compositeOnly*/, long nativePaint) { draw(nativeCanvas, nativePaint, false /*compositeOnly*/, false /*forceSrcMode*/, new GcSnapshot.Drawable() { @Override public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) { Loading Loading @@ -328,36 +295,29 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void copyNativeCanvasState(long srcCanvas, long dstCanvas) { /*package*/ static long initCanvas(long nativeCanvas) { // get the delegate from the native int. Canvas_Delegate srcCanvasDelegate = sManager.getDelegate(srcCanvas); if (srcCanvasDelegate == null) { return; Canvas_Delegate nativeCanvasDelegate = sManager.getDelegate(nativeCanvas); if (nativeCanvasDelegate == null) { return 0; } // get the delegate from the native int. Canvas_Delegate dstCanvasDelegate = sManager.getDelegate(dstCanvas); if (dstCanvasDelegate == null) { return; } Canvas_Delegate newDelegate = new Canvas_Delegate(); // TODO: actually copy the canvas state. return sManager.addNewDelegate(newDelegate); } @LayoutlibDelegate /*package*/ static int native_saveLayer(long nativeCanvas, RectF bounds, long paint, int layerFlags) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return 0; } Paint_Delegate paintDelegate = Paint_Delegate.getDelegate(paint); if (paintDelegate == null) { return 0; /*package*/ static void native_setBitmap(long canvas, long bitmap, boolean copyState) { Canvas_Delegate canvasDelegate = sManager.getDelegate(canvas); Bitmap_Delegate bitmapDelegate = Bitmap_Delegate.getDelegate(bitmap); if (canvasDelegate == null || bitmapDelegate==null) { return; } return canvasDelegate.saveLayer(bounds, paintDelegate, layerFlags); canvasDelegate.mBitmap = bitmapDelegate; canvasDelegate.mSnapshot = GcSnapshot.createDefaultSnapshot(bitmapDelegate); } @LayoutlibDelegate Loading @@ -379,19 +339,6 @@ public final class Canvas_Delegate { paintDelegate, layerFlags); } @LayoutlibDelegate /*package*/ static int native_saveLayerAlpha(long nativeCanvas, RectF bounds, int alpha, int layerFlags) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return 0; } return canvasDelegate.saveLayerAlpha(bounds, alpha, layerFlags); } @LayoutlibDelegate /*package*/ static int native_saveLayerAlpha(long nativeCanvas, float l, float t, float r, float b, Loading Loading @@ -567,13 +514,6 @@ public final class Canvas_Delegate { matrixDelegate.set(Matrix_Delegate.makeValues(transform)); } @LayoutlibDelegate /*package*/ static boolean native_quickReject(long nativeCanvas, RectF rect) { // FIXME properly implement quickReject return false; } @LayoutlibDelegate /*package*/ static boolean native_quickReject(long nativeCanvas, long path) { Loading Loading @@ -658,11 +598,6 @@ public final class Canvas_Delegate { }); } @LayoutlibDelegate /*package*/ static void native_drawRect(long nativeCanvas, RectF rect, long paint) { native_drawRect(nativeCanvas, rect.left, rect.top, rect.right, rect.bottom, paint); } @LayoutlibDelegate /*package*/ static void native_drawRect(long nativeCanvas, final float left, final float top, final float right, final float bottom, long paint) { Loading Loading @@ -690,8 +625,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void native_drawOval(long nativeCanvas, final RectF oval, long paint) { if (oval.right > oval.left && oval.bottom > oval.top) { /*package*/ static void native_drawOval(long nativeCanvas, final float left, final float top, final float right, final float bottom, long paint) { if (right > left && bottom > top) { draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/, new GcSnapshot.Drawable() { @Override Loading @@ -701,14 +637,14 @@ public final class Canvas_Delegate { // draw if (style == Paint.Style.FILL.nativeInt || style == Paint.Style.FILL_AND_STROKE.nativeInt) { graphics.fillOval((int)oval.left, (int)oval.top, (int)oval.width(), (int)oval.height()); graphics.fillOval((int)left, (int)top, (int)(right - left), (int)(bottom - top)); } if (style == Paint.Style.STROKE.nativeInt || style == Paint.Style.FILL_AND_STROKE.nativeInt) { graphics.drawOval((int)oval.left, (int)oval.top, (int)oval.width(), (int)oval.height()); graphics.drawOval((int)left, (int)top, (int)(right - left), (int)(bottom - top)); } } }); Loading @@ -719,15 +655,16 @@ public final class Canvas_Delegate { /*package*/ static void native_drawCircle(long nativeCanvas, float cx, float cy, float radius, long paint) { native_drawOval(nativeCanvas, new RectF(cx - radius, cy - radius, cx + radius, cy + radius), cx - radius, cy - radius, cx + radius, cy + radius, paint); } @LayoutlibDelegate /*package*/ static void native_drawArc(long nativeCanvas, final RectF oval, final float startAngle, final float sweep, final float left, final float top, final float right, final float bottom, final float startAngle, final float sweep, final boolean useCenter, long paint) { if (oval.right > oval.left && oval.bottom > oval.top) { if (right > left && bottom > top) { draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/, new GcSnapshot.Drawable() { @Override Loading @@ -735,7 +672,7 @@ public final class Canvas_Delegate { int style = paintDelegate.getStyle(); Arc2D.Float arc = new Arc2D.Float( oval.left, oval.top, oval.width(), oval.height(), left, top, right - left, bottom - top, -startAngle, -sweep, useCenter ? Arc2D.PIE : Arc2D.OPEN); Loading Loading @@ -1039,25 +976,6 @@ public final class Canvas_Delegate { native_drawText(nativeCanvas, text, start, count, x, y, flags, paint, typeface); } @LayoutlibDelegate /*package*/ static void native_drawPosText(long nativeCanvas, char[] text, int index, int count, float[] pos, long paint) { // FIXME Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED, "Canvas.drawPosText is not supported.", null, null /*data*/); } @LayoutlibDelegate /*package*/ static void native_drawPosText(long nativeCanvas, String text, float[] pos, long paint) { // FIXME Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED, "Canvas.drawPosText is not supported.", null, null /*data*/); } @LayoutlibDelegate /*package*/ static void native_drawTextOnPath(long nativeCanvas, char[] text, int index, Loading @@ -1075,7 +993,7 @@ public final class Canvas_Delegate { String text, long path, float hOffset, float vOffset, int flags, long paint) { int bidiFlags, long paint, long typeface) { // FIXME Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED, "Canvas.drawTextOnPath is not supported.", null, null /*data*/); Loading tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java +20 −13 Original line number Diff line number Diff line Loading @@ -297,14 +297,15 @@ public final class Path_Delegate { } @LayoutlibDelegate /*package*/ static void native_arcTo(long nPath, RectF oval, /*package*/ static void native_arcTo(long nPath, float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean forceMoveTo) { Path_Delegate pathDelegate = sManager.getDelegate(nPath); if (pathDelegate == null) { return; } pathDelegate.arcTo(oval, startAngle, sweepAngle, forceMoveTo); pathDelegate.arcTo(left, top, right, bottom, startAngle, sweepAngle, forceMoveTo); } @LayoutlibDelegate Loading Loading @@ -353,8 +354,8 @@ public final class Path_Delegate { } @LayoutlibDelegate /*package*/ static void native_addArc(long nPath, RectF oval, float startAngle, float sweepAngle) { /*package*/ static void native_addArc(long nPath, float left, float top, float right, float bottom, float startAngle, float sweepAngle) { Path_Delegate pathDelegate = sManager.getDelegate(nPath); if (pathDelegate == null) { return; Loading @@ -362,13 +363,13 @@ public final class Path_Delegate { // because x/y is the center of the circle, need to offset this by the radius pathDelegate.mPath.append(new Arc2D.Float( oval.left, oval.top, oval.width(), oval.height(), left, top, right - left, bottom - top, -startAngle, -sweepAngle, Arc2D.OPEN), false); } @LayoutlibDelegate /*package*/ static void native_addRoundRect( long nPath, RectF rect, float rx, float ry, int dir) { /*package*/ static void native_addRoundRect(long nPath, float left, float top, float right, float bottom, float rx, float ry, int dir) { Path_Delegate pathDelegate = sManager.getDelegate(nPath); if (pathDelegate == null) { Loading @@ -376,14 +377,15 @@ public final class Path_Delegate { } pathDelegate.mPath.append(new RoundRectangle2D.Float( rect.left, rect.top, rect.width(), rect.height(), rx * 2, ry * 2), false); left, top, right - left, bottom - top, rx * 2, ry * 2), false); } @LayoutlibDelegate /*package*/ static void native_addRoundRect(long nPath, RectF rect, float[] radii, int dir) { /*package*/ static void native_addRoundRect(long nPath, float left, float top, float right, float bottom, float[] radii, int dir) { // Java2D doesn't support different rounded corners in each corner, so just use the // first value. native_addRoundRect(nPath, rect, radii[0], radii[1], dir); native_addRoundRect(nPath, left, top, right, bottom, radii[0], radii[1], dir); // there can be a case where this API is used but with similar values for all corners, so // in that case we don't warn. Loading Loading @@ -710,14 +712,19 @@ public final class Path_Delegate { * start of the arc. However, if the path is empty, then we call moveTo() * with the first point of the arc. The sweep angle is tread mod 360. * * @param oval The bounds of oval defining shape and size of the arc * @param left The left of oval defining shape and size of the arc * @param top The top of oval defining shape and size of the arc * @param right The right of oval defining shape and size of the arc * @param bottom The bottom of oval defining shape and size of the arc * @param startAngle Starting angle (in degrees) where the arc begins * @param sweepAngle Sweep angle (in degrees) measured clockwise, treated * mod 360. * @param forceMoveTo If true, always begin a new contour with the arc */ private void arcTo(RectF oval, float startAngle, float sweepAngle, boolean forceMoveTo) { Arc2D arc = new Arc2D.Float(oval.left, oval.top, oval.width(), oval.height(), -startAngle, private void arcTo(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean forceMoveTo) { Arc2D arc = new Arc2D.Float(left, top, right - left, bottom - top, -startAngle, -sweepAngle, Arc2D.OPEN); mPath.append(arc, true /*connect*/); Loading tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java +2 −7 Original line number Diff line number Diff line Loading @@ -148,12 +148,12 @@ public class ICU_Delegate { } @LayoutlibDelegate /*package*/ static String getISO3CountryNative(String locale) { /*package*/ static String getISO3Country(String locale) { return ""; } @LayoutlibDelegate /*package*/ static String getISO3LanguageNative(String locale) { /*package*/ static String getISO3Language(String locale) { return ""; } Loading Loading @@ -183,11 +183,6 @@ public class ICU_Delegate { return ""; } @LayoutlibDelegate /*package*/ static String languageTagForLocale(String locale) { return ""; } @LayoutlibDelegate /*package*/ static boolean initLocaleDataNative(String locale, LocaleData result) { Loading Loading
tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java +1 −1 Original line number Diff line number Diff line Loading @@ -315,7 +315,7 @@ public final class Bitmap_Delegate { @LayoutlibDelegate /*package*/ static void nativeReconfigure(long nativeBitmap, int width, int height, int config, int allocSize) { int config, int allocSize, boolean isPremultiplied) { Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED, "Bitmap.reconfigure() is not supported", null /*data*/); } Loading
tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java +61 −143 Original line number Diff line number Diff line Loading @@ -100,9 +100,9 @@ public final class Canvas_Delegate { // ---- native methods ---- @LayoutlibDelegate /*package*/ static boolean isOpaque(Canvas thisCanvas) { /*package*/ static boolean native_isOpaque(long nativeCanvas) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return false; } Loading @@ -111,9 +111,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static int getWidth(Canvas thisCanvas) { /*package*/ static int native_getWidth(long nativeCanvas) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return 0; } Loading @@ -122,9 +122,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static int getHeight(Canvas thisCanvas) { /*package*/ static int native_getHeight(long nativeCanvas) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return 0; } Loading @@ -133,9 +133,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void translate(Canvas thisCanvas, float dx, float dy) { /*package*/ static void native_translate(long nativeCanvas, float dx, float dy) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return; } Loading @@ -144,9 +144,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void rotate(Canvas thisCanvas, float degrees) { /*package*/ static void native_rotate(long nativeCanvas, float degrees) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return; } Loading @@ -155,9 +155,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void scale(Canvas thisCanvas, float sx, float sy) { /*package*/ static void native_scale(long nativeCanvas, float sx, float sy) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return; } Loading @@ -166,9 +166,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void skew(Canvas thisCanvas, float kx, float ky) { /*package*/ static void native_skew(long nativeCanvas, float kx, float ky) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return; } Loading @@ -190,44 +190,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static boolean clipRect(Canvas thisCanvas, RectF rect) { return clipRect(thisCanvas, rect.left, rect.top, rect.right, rect.bottom); } @LayoutlibDelegate /*package*/ static boolean clipRect(Canvas thisCanvas, Rect rect) { return clipRect(thisCanvas, (float) rect.left, (float) rect.top, (float) rect.right, (float) rect.bottom); } @LayoutlibDelegate /*package*/ static boolean clipRect(Canvas thisCanvas, float left, float top, float right, float bottom) { /*package*/ static int native_save(long nativeCanvas, int saveFlags) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); if (canvasDelegate == null) { return false; } return canvasDelegate.clipRect(left, top, right, bottom, Region.Op.INTERSECT.nativeInt); } @LayoutlibDelegate /*package*/ static boolean clipRect(Canvas thisCanvas, int left, int top, int right, int bottom) { return clipRect(thisCanvas, (float) left, (float) top, (float) right, (float) bottom); } @LayoutlibDelegate /*package*/ static int save(Canvas thisCanvas) { return save(thisCanvas, Canvas.MATRIX_SAVE_FLAG | Canvas.CLIP_SAVE_FLAG); } @LayoutlibDelegate /*package*/ static int save(Canvas thisCanvas, int saveFlags) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return 0; } Loading @@ -236,9 +201,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void restore(Canvas thisCanvas) { /*package*/ static void native_restore(long nativeCanvas) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return; } Loading @@ -247,9 +212,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static int getSaveCount(Canvas thisCanvas) { /*package*/ static int native_getSaveCount(long nativeCanvas) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return 0; } Loading @@ -258,9 +223,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void restoreToCount(Canvas thisCanvas, int saveCount) { /*package*/ static void native_restoreToCount(long nativeCanvas, int saveCount) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(thisCanvas.getNativeCanvasWrapper()); Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return; } Loading @@ -269,25 +234,27 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void drawPoints(Canvas thisCanvas, float[] pts, int offset, int count, Paint paint) { /*package*/ static void native_drawPoints(long nativeCanvas, float[] pts, int offset, int count, long nativePaint) { // FIXME Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED, "Canvas.drawPoint is not supported.", null, null /*data*/); } @LayoutlibDelegate /*package*/ static void drawPoint(Canvas thisCanvas, float x, float y, Paint paint) { /*package*/ static void native_drawPoint(long nativeCanvas, float x, float y, long nativePaint) { // FIXME Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED, "Canvas.drawPoint is not supported.", null, null /*data*/); } @LayoutlibDelegate /*package*/ static void drawLines(Canvas thisCanvas, /*package*/ static void native_drawLines(long nativeCanvas, final float[] pts, final int offset, final int count, Paint paint) { draw(thisCanvas.getNativeCanvasWrapper(), paint.mNativePaint, false /*compositeOnly*/, long nativePaint) { draw(nativeCanvas, nativePaint, false /*compositeOnly*/, false /*forceSrcMode*/, new GcSnapshot.Drawable() { @Override public void draw(Graphics2D graphics, Paint_Delegate paintDelegate) { Loading Loading @@ -328,36 +295,29 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void copyNativeCanvasState(long srcCanvas, long dstCanvas) { /*package*/ static long initCanvas(long nativeCanvas) { // get the delegate from the native int. Canvas_Delegate srcCanvasDelegate = sManager.getDelegate(srcCanvas); if (srcCanvasDelegate == null) { return; Canvas_Delegate nativeCanvasDelegate = sManager.getDelegate(nativeCanvas); if (nativeCanvasDelegate == null) { return 0; } // get the delegate from the native int. Canvas_Delegate dstCanvasDelegate = sManager.getDelegate(dstCanvas); if (dstCanvasDelegate == null) { return; } Canvas_Delegate newDelegate = new Canvas_Delegate(); // TODO: actually copy the canvas state. return sManager.addNewDelegate(newDelegate); } @LayoutlibDelegate /*package*/ static int native_saveLayer(long nativeCanvas, RectF bounds, long paint, int layerFlags) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return 0; } Paint_Delegate paintDelegate = Paint_Delegate.getDelegate(paint); if (paintDelegate == null) { return 0; /*package*/ static void native_setBitmap(long canvas, long bitmap, boolean copyState) { Canvas_Delegate canvasDelegate = sManager.getDelegate(canvas); Bitmap_Delegate bitmapDelegate = Bitmap_Delegate.getDelegate(bitmap); if (canvasDelegate == null || bitmapDelegate==null) { return; } return canvasDelegate.saveLayer(bounds, paintDelegate, layerFlags); canvasDelegate.mBitmap = bitmapDelegate; canvasDelegate.mSnapshot = GcSnapshot.createDefaultSnapshot(bitmapDelegate); } @LayoutlibDelegate Loading @@ -379,19 +339,6 @@ public final class Canvas_Delegate { paintDelegate, layerFlags); } @LayoutlibDelegate /*package*/ static int native_saveLayerAlpha(long nativeCanvas, RectF bounds, int alpha, int layerFlags) { // get the delegate from the native int. Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas); if (canvasDelegate == null) { return 0; } return canvasDelegate.saveLayerAlpha(bounds, alpha, layerFlags); } @LayoutlibDelegate /*package*/ static int native_saveLayerAlpha(long nativeCanvas, float l, float t, float r, float b, Loading Loading @@ -567,13 +514,6 @@ public final class Canvas_Delegate { matrixDelegate.set(Matrix_Delegate.makeValues(transform)); } @LayoutlibDelegate /*package*/ static boolean native_quickReject(long nativeCanvas, RectF rect) { // FIXME properly implement quickReject return false; } @LayoutlibDelegate /*package*/ static boolean native_quickReject(long nativeCanvas, long path) { Loading Loading @@ -658,11 +598,6 @@ public final class Canvas_Delegate { }); } @LayoutlibDelegate /*package*/ static void native_drawRect(long nativeCanvas, RectF rect, long paint) { native_drawRect(nativeCanvas, rect.left, rect.top, rect.right, rect.bottom, paint); } @LayoutlibDelegate /*package*/ static void native_drawRect(long nativeCanvas, final float left, final float top, final float right, final float bottom, long paint) { Loading Loading @@ -690,8 +625,9 @@ public final class Canvas_Delegate { } @LayoutlibDelegate /*package*/ static void native_drawOval(long nativeCanvas, final RectF oval, long paint) { if (oval.right > oval.left && oval.bottom > oval.top) { /*package*/ static void native_drawOval(long nativeCanvas, final float left, final float top, final float right, final float bottom, long paint) { if (right > left && bottom > top) { draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/, new GcSnapshot.Drawable() { @Override Loading @@ -701,14 +637,14 @@ public final class Canvas_Delegate { // draw if (style == Paint.Style.FILL.nativeInt || style == Paint.Style.FILL_AND_STROKE.nativeInt) { graphics.fillOval((int)oval.left, (int)oval.top, (int)oval.width(), (int)oval.height()); graphics.fillOval((int)left, (int)top, (int)(right - left), (int)(bottom - top)); } if (style == Paint.Style.STROKE.nativeInt || style == Paint.Style.FILL_AND_STROKE.nativeInt) { graphics.drawOval((int)oval.left, (int)oval.top, (int)oval.width(), (int)oval.height()); graphics.drawOval((int)left, (int)top, (int)(right - left), (int)(bottom - top)); } } }); Loading @@ -719,15 +655,16 @@ public final class Canvas_Delegate { /*package*/ static void native_drawCircle(long nativeCanvas, float cx, float cy, float radius, long paint) { native_drawOval(nativeCanvas, new RectF(cx - radius, cy - radius, cx + radius, cy + radius), cx - radius, cy - radius, cx + radius, cy + radius, paint); } @LayoutlibDelegate /*package*/ static void native_drawArc(long nativeCanvas, final RectF oval, final float startAngle, final float sweep, final float left, final float top, final float right, final float bottom, final float startAngle, final float sweep, final boolean useCenter, long paint) { if (oval.right > oval.left && oval.bottom > oval.top) { if (right > left && bottom > top) { draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/, new GcSnapshot.Drawable() { @Override Loading @@ -735,7 +672,7 @@ public final class Canvas_Delegate { int style = paintDelegate.getStyle(); Arc2D.Float arc = new Arc2D.Float( oval.left, oval.top, oval.width(), oval.height(), left, top, right - left, bottom - top, -startAngle, -sweep, useCenter ? Arc2D.PIE : Arc2D.OPEN); Loading Loading @@ -1039,25 +976,6 @@ public final class Canvas_Delegate { native_drawText(nativeCanvas, text, start, count, x, y, flags, paint, typeface); } @LayoutlibDelegate /*package*/ static void native_drawPosText(long nativeCanvas, char[] text, int index, int count, float[] pos, long paint) { // FIXME Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED, "Canvas.drawPosText is not supported.", null, null /*data*/); } @LayoutlibDelegate /*package*/ static void native_drawPosText(long nativeCanvas, String text, float[] pos, long paint) { // FIXME Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED, "Canvas.drawPosText is not supported.", null, null /*data*/); } @LayoutlibDelegate /*package*/ static void native_drawTextOnPath(long nativeCanvas, char[] text, int index, Loading @@ -1075,7 +993,7 @@ public final class Canvas_Delegate { String text, long path, float hOffset, float vOffset, int flags, long paint) { int bidiFlags, long paint, long typeface) { // FIXME Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED, "Canvas.drawTextOnPath is not supported.", null, null /*data*/); Loading
tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java +20 −13 Original line number Diff line number Diff line Loading @@ -297,14 +297,15 @@ public final class Path_Delegate { } @LayoutlibDelegate /*package*/ static void native_arcTo(long nPath, RectF oval, /*package*/ static void native_arcTo(long nPath, float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean forceMoveTo) { Path_Delegate pathDelegate = sManager.getDelegate(nPath); if (pathDelegate == null) { return; } pathDelegate.arcTo(oval, startAngle, sweepAngle, forceMoveTo); pathDelegate.arcTo(left, top, right, bottom, startAngle, sweepAngle, forceMoveTo); } @LayoutlibDelegate Loading Loading @@ -353,8 +354,8 @@ public final class Path_Delegate { } @LayoutlibDelegate /*package*/ static void native_addArc(long nPath, RectF oval, float startAngle, float sweepAngle) { /*package*/ static void native_addArc(long nPath, float left, float top, float right, float bottom, float startAngle, float sweepAngle) { Path_Delegate pathDelegate = sManager.getDelegate(nPath); if (pathDelegate == null) { return; Loading @@ -362,13 +363,13 @@ public final class Path_Delegate { // because x/y is the center of the circle, need to offset this by the radius pathDelegate.mPath.append(new Arc2D.Float( oval.left, oval.top, oval.width(), oval.height(), left, top, right - left, bottom - top, -startAngle, -sweepAngle, Arc2D.OPEN), false); } @LayoutlibDelegate /*package*/ static void native_addRoundRect( long nPath, RectF rect, float rx, float ry, int dir) { /*package*/ static void native_addRoundRect(long nPath, float left, float top, float right, float bottom, float rx, float ry, int dir) { Path_Delegate pathDelegate = sManager.getDelegate(nPath); if (pathDelegate == null) { Loading @@ -376,14 +377,15 @@ public final class Path_Delegate { } pathDelegate.mPath.append(new RoundRectangle2D.Float( rect.left, rect.top, rect.width(), rect.height(), rx * 2, ry * 2), false); left, top, right - left, bottom - top, rx * 2, ry * 2), false); } @LayoutlibDelegate /*package*/ static void native_addRoundRect(long nPath, RectF rect, float[] radii, int dir) { /*package*/ static void native_addRoundRect(long nPath, float left, float top, float right, float bottom, float[] radii, int dir) { // Java2D doesn't support different rounded corners in each corner, so just use the // first value. native_addRoundRect(nPath, rect, radii[0], radii[1], dir); native_addRoundRect(nPath, left, top, right, bottom, radii[0], radii[1], dir); // there can be a case where this API is used but with similar values for all corners, so // in that case we don't warn. Loading Loading @@ -710,14 +712,19 @@ public final class Path_Delegate { * start of the arc. However, if the path is empty, then we call moveTo() * with the first point of the arc. The sweep angle is tread mod 360. * * @param oval The bounds of oval defining shape and size of the arc * @param left The left of oval defining shape and size of the arc * @param top The top of oval defining shape and size of the arc * @param right The right of oval defining shape and size of the arc * @param bottom The bottom of oval defining shape and size of the arc * @param startAngle Starting angle (in degrees) where the arc begins * @param sweepAngle Sweep angle (in degrees) measured clockwise, treated * mod 360. * @param forceMoveTo If true, always begin a new contour with the arc */ private void arcTo(RectF oval, float startAngle, float sweepAngle, boolean forceMoveTo) { Arc2D arc = new Arc2D.Float(oval.left, oval.top, oval.width(), oval.height(), -startAngle, private void arcTo(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean forceMoveTo) { Arc2D arc = new Arc2D.Float(left, top, right - left, bottom - top, -startAngle, -sweepAngle, Arc2D.OPEN); mPath.append(arc, true /*connect*/); Loading
tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java +2 −7 Original line number Diff line number Diff line Loading @@ -148,12 +148,12 @@ public class ICU_Delegate { } @LayoutlibDelegate /*package*/ static String getISO3CountryNative(String locale) { /*package*/ static String getISO3Country(String locale) { return ""; } @LayoutlibDelegate /*package*/ static String getISO3LanguageNative(String locale) { /*package*/ static String getISO3Language(String locale) { return ""; } Loading Loading @@ -183,11 +183,6 @@ public class ICU_Delegate { return ""; } @LayoutlibDelegate /*package*/ static String languageTagForLocale(String locale) { return ""; } @LayoutlibDelegate /*package*/ static boolean initLocaleDataNative(String locale, LocaleData result) { Loading