Skip to content

Commit

Permalink
Instead of asking for the context, find it
Browse files Browse the repository at this point in the history
Related to #1388
  • Loading branch information
mattleibow committed Jul 8, 2020
1 parent 39bde0d commit aa6a178
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
26 changes: 11 additions & 15 deletions binding/Binding/GRGlInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,10 @@ public static GRGlInterface CreateWebGl (GRGlGetProcedureAddressDelegate get)
}
}

public static GRGlInterface CreateEvas (IntPtr evas) =>
CreateEvas (evas, IntPtr.Zero);

public static GRGlInterface CreateEvas (IntPtr evas, IntPtr evasGlContext)
public static GRGlInterface CreateEvas (IntPtr evas)
{
#if __TIZEN__
var evasLoader = new EvasGlLoader (evas, evasGlContext);
var evasLoader = new EvasGlLoader (evas);
return CreateGles (name => evasLoader.GetFunctionPointer (name));
#else
return null;
Expand Down Expand Up @@ -241,21 +238,25 @@ public static IntPtr GetProc (string name)
#if __TIZEN__
private class EvasGlLoader
{
private const string libevas = "libevas.so.1";

private static readonly Type IntPtrType;
private static readonly Type EvasGlApiType;
private static readonly FieldInfo[] apiFields;

private readonly IntPtr glEvas;
private readonly IntPtr glContext;
private readonly EvasGlApi api;

[DllImport ("libevas.so.1")]
[DllImport (libevas)]
internal static extern IntPtr evas_gl_api_get (IntPtr evas_gl);

[DllImport ("libevas.so.1")]
[DllImport (libevas)]
internal static extern IntPtr evas_gl_context_api_get (IntPtr evas_gl, IntPtr ctx);

[DllImport ("libevas.so.1")]
[DllImport (libevas)]
internal static extern IntPtr evas_gl_current_context_get (IntPtr evas_gl);

[DllImport (libevas)]
internal static extern IntPtr evas_gl_proc_address_get (IntPtr evas_gl, string name);

static EvasGlLoader ()
Expand All @@ -266,14 +267,9 @@ static EvasGlLoader ()
}

public EvasGlLoader (IntPtr evas)
: this (evas, IntPtr.Zero)
{
}

public EvasGlLoader (IntPtr evas, IntPtr evasGlContext)
{
glEvas = evas;
glContext = evasGlContext;
var glContext = evas_gl_current_context_get (glEvas);

var apiPtr = glContext != IntPtr.Zero
? evas_gl_context_api_get (glEvas, glContext)
Expand Down
2 changes: 1 addition & 1 deletion samples/Basic/Tizen/SkiaSharpSample/tizen-manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest package="org.tizen.example.SkiaSharpSample" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">
<profile name="common" />
<ui-application appid="org.tizen.example.SkiaSharpSample" exec="SkiaSharpSample.dll" multiple="false" nodisplay="false" taskmanage="true" splash-screen-display="true" type="dotnet" launch_mode="single">
<label>SkiaSharpSample</label>
<label>SkiaSharp</label>
<icon>SkiaSharpSample.png</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
</ui-application>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ protected sealed override void CreateDrawingSurface()
Gles.glViewport(0, 0, surfaceSize.Width, surfaceSize.Height);

// create the interface using the function pointers provided by the EFL
var glInterface = GRGlInterface.CreateEvas(glEvas, glContext);
var glInterface = GRGlInterface.CreateEvas(glEvas);
if (glInterface == null)
Log.Error("SKGLSurfaceView", "Unable to create GRGlInterface.");
if (!glInterface.Validate())
Expand Down

0 comments on commit aa6a178

Please sign in to comment.