Loading core/java/com/android/internal/widget/remotecompose/core/CoreDocument.java +0 −3 Original line number Diff line number Diff line Loading @@ -119,7 +119,6 @@ public class CoreDocument implements Serializable { private boolean mIsUpdateDoc = false; private int mHostExceptionID = 0; private int mBitmapMemory = 0; private int mBitmapCount = 0; public CoreDocument() { this(new SystemClock()); Loading Loading @@ -837,7 +836,6 @@ public class CoreDocument implements Serializable { } } mBitmapMemory = 0; mBitmapCount = 0; mOperations = inflateComponents(mOperations); mBuffer = buffer; Loading Loading @@ -871,7 +869,6 @@ public class CoreDocument implements Serializable { if (o instanceof BitmapData) { BitmapData bitmap = (BitmapData) o; mBitmapMemory += bitmap.getHeight() * bitmap.getWidth() * 4; mBitmapCount++; } if (o instanceof Container) { Container container = (Container) o; Loading core/java/com/android/internal/widget/remotecompose/core/Operations.java +10 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.internal.widget.remotecompose.core.operations.DebugMessage; import com.android.internal.widget.remotecompose.core.operations.DrawArc; import com.android.internal.widget.remotecompose.core.operations.DrawBitmap; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapFontText; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapFontTextOnPath; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapInt; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapScaled; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapTextAnchored; Loading @@ -60,6 +61,7 @@ import com.android.internal.widget.remotecompose.core.operations.FloatFunctionDe import com.android.internal.widget.remotecompose.core.operations.FontData; import com.android.internal.widget.remotecompose.core.operations.HapticFeedback; import com.android.internal.widget.remotecompose.core.operations.Header; import com.android.internal.widget.remotecompose.core.operations.IdLookup; import com.android.internal.widget.remotecompose.core.operations.ImageAttribute; import com.android.internal.widget.remotecompose.core.operations.IntegerExpression; import com.android.internal.widget.remotecompose.core.operations.MatrixFromPath; Loading Loading @@ -198,6 +200,7 @@ public class Operations { public static final int PAINT_VALUES = 40; public static final int DRAW_RECT = 42; public static final int DRAW_BITMAP_FONT_TEXT_RUN = 48; public static final int DRAW_BITMAP_FONT_TEXT_RUN_ON_PATH = 49; public static final int DRAW_TEXT_RUN = 43; public static final int DRAW_CIRCLE = 46; public static final int DRAW_LINE = 47; Loading Loading @@ -270,6 +273,7 @@ public class Operations { public static final int DATA_FONT = 189; public static final int DRAW_TO_BITMAP = 190; public static final int WAKE_IN = 191; public static final int ID_LOOKUP = 192; ///////////////////////////////////////// ====================== Loading Loading @@ -435,11 +439,13 @@ public class Operations { sMapV7AndroidX.put(MATRIX_FROM_PATH, MatrixFromPath::read); sMapV7AndroidX.put(TEXT_SUBTEXT, TextSubtext::read); sMapV7AndroidX.put(BITMAP_TEXT_MEASURE, BitmapTextMeasure::read); sMapV7AndroidX.put(DRAW_BITMAP_FONT_TEXT_RUN_ON_PATH, DrawBitmapFontTextOnPath::read); sMapV7AndroidX.put(DRAW_BITMAP_TEXT_ANCHORED, DrawBitmapTextAnchored::read); sMapV7AndroidX.put(DATA_SHADER, ShaderData::read); sMapV7AndroidX.put(DATA_FONT, FontData::read); sMapV7AndroidX.put(DRAW_TO_BITMAP, DrawToBitmap::read); sMapV7AndroidX.put(WAKE_IN, WakeIn::read); sMapV7AndroidX.put(ID_LOOKUP, IdLookup::read); } return sMapV7AndroidX; } Loading @@ -466,7 +472,11 @@ public class Operations { sMapV7Widgets.put(MATRIX_FROM_PATH, MatrixFromPath::read); sMapV7Widgets.put(TEXT_SUBTEXT, TextSubtext::read); sMapV7Widgets.put(BITMAP_TEXT_MEASURE, BitmapTextMeasure::read); sMapV7Widgets.put(DRAW_BITMAP_FONT_TEXT_RUN_ON_PATH, DrawBitmapFontTextOnPath::read); sMapV7Widgets.put(DRAW_BITMAP_TEXT_ANCHORED, DrawBitmapTextAnchored::read); sMapV7Widgets.put(DRAW_TO_BITMAP, DrawToBitmap::read); sMapV7Widgets.put(WAKE_IN, WakeIn::read); sMapV7AndroidX.put(ID_LOOKUP, IdLookup::read); } return sMapV7Widgets; } Loading core/java/com/android/internal/widget/remotecompose/core/PaintOperation.java +21 −0 Original line number Diff line number Diff line Loading @@ -56,4 +56,25 @@ public abstract class PaintOperation extends Operation implements Serializable { // by default expects the op to not be suitable return false; } /** Path or Bitmap need to be dereferenced */ public static final int PTR_DEREFERENCE = 0x1 << 30; /** Valid bits in Path or Bitmap */ public static final int VALUE_MASK = 0xFFFF; /** * Get the id from the context if needed * * @param id the id to get * @param context the context * @return the id dereferenced if needed */ protected int getId(int id, @NonNull PaintContext context) { int returnId = id & VALUE_MASK; if ((id & PTR_DEREFERENCE) != 0) { returnId = context.getContext().getInteger(returnId); } return returnId; } } core/java/com/android/internal/widget/remotecompose/core/RemoteComposeBuffer.java +47 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.internal.widget.remotecompose.core.operations.DebugMessage; import com.android.internal.widget.remotecompose.core.operations.DrawArc; import com.android.internal.widget.remotecompose.core.operations.DrawBitmap; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapFontText; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapFontTextOnPath; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapInt; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapScaled; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapTextAnchored; Loading @@ -60,6 +61,7 @@ import com.android.internal.widget.remotecompose.core.operations.FloatFunctionDe import com.android.internal.widget.remotecompose.core.operations.FontData; import com.android.internal.widget.remotecompose.core.operations.HapticFeedback; import com.android.internal.widget.remotecompose.core.operations.Header; import com.android.internal.widget.remotecompose.core.operations.IdLookup; import com.android.internal.widget.remotecompose.core.operations.ImageAttribute; import com.android.internal.widget.remotecompose.core.operations.IntegerExpression; import com.android.internal.widget.remotecompose.core.operations.MatrixFromPath; Loading Loading @@ -143,6 +145,7 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Set; /** Provides an abstract buffer to encode/decode RemoteCompose operations */ Loading Loading @@ -444,7 +447,24 @@ public class RemoteComposeBuffer { * @return id of the BitmapFont */ public int addBitmapFont(int id, @NonNull BitmapFontData.Glyph [] glyphs) { BitmapFontData.apply(mBuffer, id, glyphs); BitmapFontData.apply(mBuffer, id, glyphs, null); return id; } /** * Records a bitmap font and returns an ID. * * @param id the id to use * @param glyphs The glyphs that define the bitmap font * @param kerningTable The kerning table, where the key is pairs of glyphs (literally $1$2) and * the value is the horizontal adjustment in pixels for that glyph pair. Can be empty. * @return id of the BitmapFont */ public int addBitmapFont( int id, @NonNull BitmapFontData.Glyph [] glyphs, @NonNull Map<String, Short> kerningTable) { BitmapFontData.apply(mBuffer, id, glyphs, kerningTable); return id; } Loading Loading @@ -621,6 +641,21 @@ public class RemoteComposeBuffer { DrawBitmapFontText.apply(mBuffer, textId, bitmapFontId, start, end, x, y); } /** * Draw the text with a bitmap font along the path. * * @param textId The text to be drawn * @param bitmapFontId The id of the bitmap font to draw with * @param pathId The id of the path to draw along * @param start The index of the first character in text to draw * @param end (end - 1) is the index of the last character in text to draw * @param yAdj Adjustment away from the path along the normal at that point */ public void addDrawBitmapFontTextRunOnPath( int textId, int bitmapFontId, int pathId, int start, int end, float yAdj) { DrawBitmapFontTextOnPath.apply(mBuffer, textId, bitmapFontId, pathId, start, end, yAdj); } /** * Draw a text on canvas at relative to position (x, y), offset panX and panY. <br> * The panning factors (panX, panY) mapped to the resulting bounding box of the text, in such a Loading Loading @@ -1218,6 +1253,17 @@ public class RemoteComposeBuffer { TextLookup.apply(mBuffer, id, Utils.idFromNan(dataSet), index); } /** * This provides access to text in RemoteList * * @param id id of integer to write * @param dataSet the array * @param index index as a float variable */ public void idLookup(int id, float dataSet, float index) { IdLookup.apply(mBuffer, id, Utils.idFromNan(dataSet), index); } /** * This provides access to text in RemoteList * Loading core/java/com/android/internal/widget/remotecompose/core/RemoteComposeState.java +10 −0 Original line number Diff line number Diff line Loading @@ -467,6 +467,16 @@ public class RemoteComposeState implements CollectionsAccess { add(id, variableSupport); } /** * get Commands that listen to variables. * * @param id id of variable to listen to * @return Commands that listen to variable */ public @Nullable ArrayList<VariableSupport> getListeners(int id) { return mVarListeners.get(id); } /** * Is any command listening to this variable * Loading Loading
core/java/com/android/internal/widget/remotecompose/core/CoreDocument.java +0 −3 Original line number Diff line number Diff line Loading @@ -119,7 +119,6 @@ public class CoreDocument implements Serializable { private boolean mIsUpdateDoc = false; private int mHostExceptionID = 0; private int mBitmapMemory = 0; private int mBitmapCount = 0; public CoreDocument() { this(new SystemClock()); Loading Loading @@ -837,7 +836,6 @@ public class CoreDocument implements Serializable { } } mBitmapMemory = 0; mBitmapCount = 0; mOperations = inflateComponents(mOperations); mBuffer = buffer; Loading Loading @@ -871,7 +869,6 @@ public class CoreDocument implements Serializable { if (o instanceof BitmapData) { BitmapData bitmap = (BitmapData) o; mBitmapMemory += bitmap.getHeight() * bitmap.getWidth() * 4; mBitmapCount++; } if (o instanceof Container) { Container container = (Container) o; Loading
core/java/com/android/internal/widget/remotecompose/core/Operations.java +10 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.internal.widget.remotecompose.core.operations.DebugMessage; import com.android.internal.widget.remotecompose.core.operations.DrawArc; import com.android.internal.widget.remotecompose.core.operations.DrawBitmap; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapFontText; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapFontTextOnPath; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapInt; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapScaled; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapTextAnchored; Loading @@ -60,6 +61,7 @@ import com.android.internal.widget.remotecompose.core.operations.FloatFunctionDe import com.android.internal.widget.remotecompose.core.operations.FontData; import com.android.internal.widget.remotecompose.core.operations.HapticFeedback; import com.android.internal.widget.remotecompose.core.operations.Header; import com.android.internal.widget.remotecompose.core.operations.IdLookup; import com.android.internal.widget.remotecompose.core.operations.ImageAttribute; import com.android.internal.widget.remotecompose.core.operations.IntegerExpression; import com.android.internal.widget.remotecompose.core.operations.MatrixFromPath; Loading Loading @@ -198,6 +200,7 @@ public class Operations { public static final int PAINT_VALUES = 40; public static final int DRAW_RECT = 42; public static final int DRAW_BITMAP_FONT_TEXT_RUN = 48; public static final int DRAW_BITMAP_FONT_TEXT_RUN_ON_PATH = 49; public static final int DRAW_TEXT_RUN = 43; public static final int DRAW_CIRCLE = 46; public static final int DRAW_LINE = 47; Loading Loading @@ -270,6 +273,7 @@ public class Operations { public static final int DATA_FONT = 189; public static final int DRAW_TO_BITMAP = 190; public static final int WAKE_IN = 191; public static final int ID_LOOKUP = 192; ///////////////////////////////////////// ====================== Loading Loading @@ -435,11 +439,13 @@ public class Operations { sMapV7AndroidX.put(MATRIX_FROM_PATH, MatrixFromPath::read); sMapV7AndroidX.put(TEXT_SUBTEXT, TextSubtext::read); sMapV7AndroidX.put(BITMAP_TEXT_MEASURE, BitmapTextMeasure::read); sMapV7AndroidX.put(DRAW_BITMAP_FONT_TEXT_RUN_ON_PATH, DrawBitmapFontTextOnPath::read); sMapV7AndroidX.put(DRAW_BITMAP_TEXT_ANCHORED, DrawBitmapTextAnchored::read); sMapV7AndroidX.put(DATA_SHADER, ShaderData::read); sMapV7AndroidX.put(DATA_FONT, FontData::read); sMapV7AndroidX.put(DRAW_TO_BITMAP, DrawToBitmap::read); sMapV7AndroidX.put(WAKE_IN, WakeIn::read); sMapV7AndroidX.put(ID_LOOKUP, IdLookup::read); } return sMapV7AndroidX; } Loading @@ -466,7 +472,11 @@ public class Operations { sMapV7Widgets.put(MATRIX_FROM_PATH, MatrixFromPath::read); sMapV7Widgets.put(TEXT_SUBTEXT, TextSubtext::read); sMapV7Widgets.put(BITMAP_TEXT_MEASURE, BitmapTextMeasure::read); sMapV7Widgets.put(DRAW_BITMAP_FONT_TEXT_RUN_ON_PATH, DrawBitmapFontTextOnPath::read); sMapV7Widgets.put(DRAW_BITMAP_TEXT_ANCHORED, DrawBitmapTextAnchored::read); sMapV7Widgets.put(DRAW_TO_BITMAP, DrawToBitmap::read); sMapV7Widgets.put(WAKE_IN, WakeIn::read); sMapV7AndroidX.put(ID_LOOKUP, IdLookup::read); } return sMapV7Widgets; } Loading
core/java/com/android/internal/widget/remotecompose/core/PaintOperation.java +21 −0 Original line number Diff line number Diff line Loading @@ -56,4 +56,25 @@ public abstract class PaintOperation extends Operation implements Serializable { // by default expects the op to not be suitable return false; } /** Path or Bitmap need to be dereferenced */ public static final int PTR_DEREFERENCE = 0x1 << 30; /** Valid bits in Path or Bitmap */ public static final int VALUE_MASK = 0xFFFF; /** * Get the id from the context if needed * * @param id the id to get * @param context the context * @return the id dereferenced if needed */ protected int getId(int id, @NonNull PaintContext context) { int returnId = id & VALUE_MASK; if ((id & PTR_DEREFERENCE) != 0) { returnId = context.getContext().getInteger(returnId); } return returnId; } }
core/java/com/android/internal/widget/remotecompose/core/RemoteComposeBuffer.java +47 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.internal.widget.remotecompose.core.operations.DebugMessage; import com.android.internal.widget.remotecompose.core.operations.DrawArc; import com.android.internal.widget.remotecompose.core.operations.DrawBitmap; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapFontText; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapFontTextOnPath; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapInt; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapScaled; import com.android.internal.widget.remotecompose.core.operations.DrawBitmapTextAnchored; Loading @@ -60,6 +61,7 @@ import com.android.internal.widget.remotecompose.core.operations.FloatFunctionDe import com.android.internal.widget.remotecompose.core.operations.FontData; import com.android.internal.widget.remotecompose.core.operations.HapticFeedback; import com.android.internal.widget.remotecompose.core.operations.Header; import com.android.internal.widget.remotecompose.core.operations.IdLookup; import com.android.internal.widget.remotecompose.core.operations.ImageAttribute; import com.android.internal.widget.remotecompose.core.operations.IntegerExpression; import com.android.internal.widget.remotecompose.core.operations.MatrixFromPath; Loading Loading @@ -143,6 +145,7 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Set; /** Provides an abstract buffer to encode/decode RemoteCompose operations */ Loading Loading @@ -444,7 +447,24 @@ public class RemoteComposeBuffer { * @return id of the BitmapFont */ public int addBitmapFont(int id, @NonNull BitmapFontData.Glyph [] glyphs) { BitmapFontData.apply(mBuffer, id, glyphs); BitmapFontData.apply(mBuffer, id, glyphs, null); return id; } /** * Records a bitmap font and returns an ID. * * @param id the id to use * @param glyphs The glyphs that define the bitmap font * @param kerningTable The kerning table, where the key is pairs of glyphs (literally $1$2) and * the value is the horizontal adjustment in pixels for that glyph pair. Can be empty. * @return id of the BitmapFont */ public int addBitmapFont( int id, @NonNull BitmapFontData.Glyph [] glyphs, @NonNull Map<String, Short> kerningTable) { BitmapFontData.apply(mBuffer, id, glyphs, kerningTable); return id; } Loading Loading @@ -621,6 +641,21 @@ public class RemoteComposeBuffer { DrawBitmapFontText.apply(mBuffer, textId, bitmapFontId, start, end, x, y); } /** * Draw the text with a bitmap font along the path. * * @param textId The text to be drawn * @param bitmapFontId The id of the bitmap font to draw with * @param pathId The id of the path to draw along * @param start The index of the first character in text to draw * @param end (end - 1) is the index of the last character in text to draw * @param yAdj Adjustment away from the path along the normal at that point */ public void addDrawBitmapFontTextRunOnPath( int textId, int bitmapFontId, int pathId, int start, int end, float yAdj) { DrawBitmapFontTextOnPath.apply(mBuffer, textId, bitmapFontId, pathId, start, end, yAdj); } /** * Draw a text on canvas at relative to position (x, y), offset panX and panY. <br> * The panning factors (panX, panY) mapped to the resulting bounding box of the text, in such a Loading Loading @@ -1218,6 +1253,17 @@ public class RemoteComposeBuffer { TextLookup.apply(mBuffer, id, Utils.idFromNan(dataSet), index); } /** * This provides access to text in RemoteList * * @param id id of integer to write * @param dataSet the array * @param index index as a float variable */ public void idLookup(int id, float dataSet, float index) { IdLookup.apply(mBuffer, id, Utils.idFromNan(dataSet), index); } /** * This provides access to text in RemoteList * Loading
core/java/com/android/internal/widget/remotecompose/core/RemoteComposeState.java +10 −0 Original line number Diff line number Diff line Loading @@ -467,6 +467,16 @@ public class RemoteComposeState implements CollectionsAccess { add(id, variableSupport); } /** * get Commands that listen to variables. * * @param id id of variable to listen to * @return Commands that listen to variable */ public @Nullable ArrayList<VariableSupport> getListeners(int id) { return mVarListeners.get(id); } /** * Is any command listening to this variable * Loading