Skip to content

Commit c8efef9

Browse files
committed
Remaked return value for few graphics method
1 parent 386eabb commit c8efef9

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/EmptyFlow.SciterAPI/Client/HostGraphicsAPI.cs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ public void GraphicsDrawLine ( nint hgfx, Vector2 start, Vector2 end, uint color
231231
/// <param name="rx">Radius X.</param>
232232
/// <param name="ry">Radius Y.</param>
233233
[MethodImpl ( MethodImplOptions.AggressiveInlining )]
234-
public void GraphicsDrawEllipse ( nint hgfx, float x1, float y1, float rx, float ry ) {
235-
m_graphicsApi.gEllipse ( hgfx, x1, y1, rx, ry );
234+
public bool GraphicsDrawEllipse ( nint hgfx, float x1, float y1, float rx, float ry ) {
235+
return m_graphicsApi.gEllipse ( hgfx, x1, y1, rx, ry ) == GraphInResult.Ok;
236236
}
237237

238238
/// <summary>
@@ -244,8 +244,8 @@ public void GraphicsDrawEllipse ( nint hgfx, float x1, float y1, float rx, float
244244
/// <param name="x2">X2 coordinate.</param>
245245
/// <param name="y2">Y2 coordinate.</param>
246246
[MethodImpl ( MethodImplOptions.AggressiveInlining )]
247-
public void GraphicsDrawRectangle ( nint hgfx, float x1, float y1, float x2, float y2 ) {
248-
m_graphicsApi.gRectangle ( hgfx, x1, y1, x2, y2 );
247+
public bool GraphicsDrawRectangle ( nint hgfx, float x1, float y1, float x2, float y2 ) {
248+
return m_graphicsApi.gRectangle ( hgfx, x1, y1, x2, y2 ) == GraphInResult.Ok;
249249
}
250250

251251
/// <summary>
@@ -258,8 +258,8 @@ public void GraphicsDrawRectangle ( nint hgfx, float x1, float y1, float x2, flo
258258
/// <param name="y2">Y2 coordinate.</param>
259259
/// <param name="radii8">8 pair array.</param>
260260
[MethodImpl ( MethodImplOptions.AggressiveInlining )]
261-
public void GraphicsDrawRoundedRectangle ( nint hgfx, float x1, float y1, float x2, float y2, float[] radii8 ) {
262-
m_graphicsApi.gRoundedRectangle ( hgfx, x1, y1, x2, y2, radii8 );
261+
public bool GraphicsDrawRoundedRectangle ( nint hgfx, float x1, float y1, float x2, float y2, float[] radii8 ) {
262+
return m_graphicsApi.gRoundedRectangle ( hgfx, x1, y1, x2, y2, radii8 ) == GraphInResult.Ok;
263263
}
264264

265265
public GraphicsTextModel GraphicsCreateTextForElement ( nint he, string text, string className ) {
@@ -301,19 +301,25 @@ public void GraphicsReleaseText ( GraphicsTextModel text ) {
301301
/// <param name="x">X coordinate.</param>
302302
/// <param name="y">Y coordinate.</param>
303303
/// <param name="coordinates">Position (1..9).</param>
304-
public void GraphicsDrawText ( nint hgfx, GraphicsTextModel text, Vector2 coordinates, SciterTextPosition position ) {
305-
var graphResult = m_graphicsApi.gDrawText ( hgfx, text.Id, coordinates.X, coordinates.Y, (uint) position );
306-
if ( graphResult != GraphInResult.Ok ) Console.WriteLine ( "GraphicsDrawText resulted with error, actual result - " + graphResult );
304+
[MethodImpl ( MethodImplOptions.AggressiveInlining )]
305+
public bool GraphicsDrawText ( nint hgfx, GraphicsTextModel text, Vector2 coordinates, SciterTextPosition position ) {
306+
return m_graphicsApi.gDrawText ( hgfx, text.Id, coordinates.X, coordinates.Y, (uint) position ) == GraphInResult.Ok;
307307
}
308308

309+
/// <summary>
310+
/// Draw image.
311+
/// </summary>
309312
[MethodImpl ( MethodImplOptions.AggressiveInlining )]
310-
public void GraphicsDrawImage ( nint hgfx, nint image, float x, float y, float w, float h, uint ix, uint iy, uint iw, uint ih, float opacity ) {
311-
m_graphicsApi.gDrawImage ( hgfx, image, x, y, w, h, ix, iy, iw, ih, opacity );
313+
public bool GraphicsDrawImage ( nint hgfx, nint image, float x, float y, float w, float h, uint ix, uint iy, uint iw, uint ih, float opacity ) {
314+
return m_graphicsApi.gDrawImage ( hgfx, image, x, y, w, h, ix, iy, iw, ih, opacity ) == GraphInResult.Ok;
312315
}
313316

317+
/// <summary>
318+
/// Draw image.
319+
/// </summary>
314320
[MethodImpl ( MethodImplOptions.AggressiveInlining )]
315-
public void GraphicsDrawImage ( nint hgfx, nint image, Vector2 position, Vector2 size, uint ix, uint iy, uint iw, uint ih, float opacity ) {
316-
m_graphicsApi.gDrawImage ( hgfx, image, position.X, position.Y, position.X, position.Y, ix, iy, iw, ih, opacity );
321+
public bool GraphicsDrawImage ( nint hgfx, nint image, Vector2 position, Vector2 size, uint ix, uint iy, uint iw, uint ih, float opacity ) {
322+
return m_graphicsApi.gDrawImage ( hgfx, image, position.X, position.Y, position.X, position.Y, ix, iy, iw, ih, opacity ) == GraphInResult.Ok;
317323
}
318324

319325
[MethodImpl ( MethodImplOptions.AggressiveInlining )]

0 commit comments

Comments
 (0)