Update native delegates

After changes 9ff994d988, 6e3658a638 and 18e9f9f377
Test: Existing layoutlib tests

Change-Id: I8e39f26ccb0a8cb73a724f16734e66cf95c08656
This commit is contained in:
Diego Perez
2017-02-02 16:08:41 +00:00
parent abf19d1aa4
commit 2a1b23966a
4 changed files with 36 additions and 3 deletions

View File

@@ -636,6 +636,20 @@ public final class Bitmap_Delegate {
Bitmap.getDefaultDensity());
}
@LayoutlibDelegate
/*package*/ static Bitmap nativeCreateHardwareBitmap(GraphicBuffer buffer) {
Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
"Bitmap.nativeCreateHardwareBitmap() is not supported", null /*data*/);
return null;
}
@LayoutlibDelegate
/*package*/ static GraphicBuffer nativeCreateGraphicBufferHandle(long nativeBitmap) {
Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
"Bitmap.nativeCreateGraphicBufferHandle() is not supported", null /*data*/);
return null;
}
// ---- Private delegate/helper methods ----
private Bitmap_Delegate(BufferedImage image, Config config) {

View File

@@ -313,7 +313,8 @@ public class FontFamily_Delegate {
}
@LayoutlibDelegate
/*package*/ static boolean nAddFontFromAsset(long builderPtr, AssetManager mgr, String path) {
/*package*/ static boolean nAddFontFromAssetManager(long builderPtr, AssetManager mgr, String path,
int cookie, boolean isAsset) {
FontFamily_Delegate ffd = sManager.getDelegate(builderPtr);
if (ffd == null) {
return false;
@@ -388,6 +389,10 @@ public class FontFamily_Delegate {
return false;
}
@LayoutlibDelegate
/*package*/ static void nAbort(long builderPtr) {
sManager.removeJavaReferenceFor(builderPtr);
}
// ---- private helper methods ----

View File

@@ -16,12 +16,14 @@
package android.graphics;
import android.text.FontConfig;
import com.android.ide.common.rendering.api.LayoutLog;
import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.impl.DelegateManager;
import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
import android.annotation.NonNull;
import android.graphics.FontFamily_Delegate.FontVariant;
import android.text.FontConfig;
import java.awt.Font;
import java.io.File;
@@ -159,6 +161,18 @@ public final class Typeface_Delegate {
delegate.mWeight));
}
@LayoutlibDelegate
/*package*/ static synchronized long nativeCreateFromTypefaceWithVariation(long native_instance,
List<FontConfig.Axis> axes) {
long newInstance = nativeCreateFromTypeface(native_instance, 0);
if (newInstance != 0) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"nativeCreateFromTypefaceWithVariation is not supported", null, null);
}
return newInstance;
}
@LayoutlibDelegate
/*package*/ static long nativeCreateWeightAlias(long native_instance, int weight) {
Typeface_Delegate delegate = sManager.getDelegate(native_instance);

View File

@@ -57,7 +57,7 @@ public class RenderNode_Delegate {
private String mName;
@LayoutlibDelegate
/*package*/ static long nCreate(RenderNode thisRenderNode, String name) {
/*package*/ static long nCreate(String name) {
RenderNode_Delegate renderNodeDelegate = new RenderNode_Delegate();
renderNodeDelegate.mName = name;
return sManager.addNewDelegate(renderNodeDelegate);