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

Commit 9f63ff26 authored by Xavier Ducrohet's avatar Xavier Ducrohet
Browse files

Layoutlib Canvas and Paint implementation through native delegates

Also fix native delegate generation to put "this" parameter even
for methods that don't have any parameters.

Change-Id: I5dd0c505871370ff7b4cda16de84a5b3ae438f73
parent 5c95212f
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -59,6 +59,20 @@ public class Bitmap_Delegate {

    // ---- Public Helper methods ----

    /**
     * Returns the native delegate associated to a given {@link Bitmap_Delegate} object.
     */
    public static Bitmap_Delegate getDelegate(Bitmap bitmap) {
        return sManager.getDelegate(bitmap.mNativeBitmap);
    }

    /**
     * Returns the native delegate associated to a given an int referencing a {@link Bitmap} object.
     */
    public static Bitmap_Delegate getDelegate(int native_bitmap) {
        return sManager.getDelegate(native_bitmap);
    }

    /**
     * Creates and returns a {@link Bitmap} initialized with the given file content.
     */
@@ -118,6 +132,13 @@ public class Bitmap_Delegate {
        return BufferedImage.TYPE_INT_ARGB;
    }

    /**
     * Returns the {@link BufferedImage} used by the delegate of the given {@link Bitmap}.
     */
    public BufferedImage getImage() {
        return mImage;
    }

    // ---- native methods ----

    /*package*/ static Bitmap nativeCreate(int[] colors, int offset, int stride, int width,
@@ -127,8 +148,7 @@ public class Bitmap_Delegate {
        // create the image
        BufferedImage image = new BufferedImage(width, height, imageType);

        // fill it
        //image.setRGB(x, y, rgb)
        // FIXME fill the bitmap!

        // create a delegate with the content of the stream.
        Bitmap_Delegate delegate = new Bitmap_Delegate(image);
+0 −1247

File deleted.

Preview size limit exceeded, changes collapsed.

+559 −0

File added.

Preview size limit exceeded, changes collapsed.

+0 −1211

File deleted.

Preview size limit exceeded, changes collapsed.

+750 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading