Skip to content

Commit

Permalink
modified to perform SetMargins() only if its arguments change and mod…
Browse files Browse the repository at this point in the history
…ified to avoid rendering if texture dimension is zero.
  • Loading branch information
KojiNakamaru committed Oct 19, 2020
1 parent 903b55d commit 7920b9e
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions plugins/WebViewObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,13 @@ public void SetMargins(int left, int top, int right, int bottom, bool relative =
if (webView == null)
return;
#endif
if (mMarginLeft == left
&& mMarginTop == top
&& mMarginRight == right
&& mMarginBottom == bottom)
{
return;
}
mMarginLeft = left;
mMarginTop = top;
mMarginRight = right;
Expand Down Expand Up @@ -1023,11 +1030,13 @@ void Update()
textureDataBuffer = new byte[w * h * 4];
}
}
var gch = GCHandle.Alloc(textureDataBuffer, GCHandleType.Pinned);
_CWebViewPlugin_Render(webView, gch.AddrOfPinnedObject());
gch.Free();
texture.LoadRawTextureData(textureDataBuffer);
texture.Apply();
if (textureDataBuffer.Length > 0) {
var gch = GCHandle.Alloc(textureDataBuffer, GCHandleType.Pinned);
_CWebViewPlugin_Render(webView, gch.AddrOfPinnedObject());
gch.Free();
texture.LoadRawTextureData(textureDataBuffer);
texture.Apply();
}
}
}

Expand Down

0 comments on commit 7920b9e

Please sign in to comment.