Skip to content

Commit

Permalink
[NUI] PenWave Coding rule
Browse files Browse the repository at this point in the history
  • Loading branch information
JoogabYun committed Jan 14, 2025
1 parent ba0fd63 commit f824d51
Show file tree
Hide file tree
Showing 11 changed files with 270 additions and 269 deletions.
62 changes: 31 additions & 31 deletions src/Tizen.NUI.PenWave/src/Internal/Canvas/CanvasRenderer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright(c) 2024 Samsung Electronics Co., Ltd.
* Copyright(c) 2025 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,38 +37,38 @@ internal class CanvasRenderer
};

// Canvas id.
private uint canvasId;
private uint _canvasId;
// PenWave engine.
private PenWave engine;
private PenWave _engine;

/// <summary>
/// Constructor. Creates a new instance of CanvasRenderer. This constructor sets the current canvas to the specified canvas id. Also it sets paths to resources and initializes textures.
/// </summary>
/// <param name="canvasId">The canvas id</param>
internal CanvasRenderer(uint canvasId)
{
this.canvasId = canvasId;
engine = PenWave.Instance;
engine.SetCurrentCanvas(canvasId);
engine.SetResourcePath(FrameworkInformation.ResourcePath + "images/");
engine.SetFontPath(s_fontPath);
engine.SetTexturePaths(s_texturePaths, s_texturePaths.Length);
_canvasId = canvasId;
_engine = PenWave.Instance;
_engine.SetCurrentCanvas(canvasId);
_engine.SetResourcePath(FrameworkInformation.ResourcePath + "images/");
_engine.SetFontPath(s_fontPath);
_engine.SetTexturePaths(s_texturePaths, s_texturePaths.Length);
}

/// <summary>
/// Initializes OpenGL context. This method must be called before any other methods that require OpenGL context.
/// </summary>
internal void InitializeGL()
{
engine.InitializeGL();
_engine.InitializeGL();
}

/// <summary>
/// Terminates OpenGL context. This method must be called after all methods that require OpenGL context are finished.
/// </summary>
internal void TerminateGL()
{
engine.TerminateGL();
_engine.TerminateGL();
}

/// <summary>
Expand All @@ -78,7 +78,7 @@ internal void TerminateGL()
/// <returns></returns>
internal int RenderFrame(in DirectRenderingGLView.RenderCallbackInput input)
{
return engine.RenderFrameGL();
return _engine.RenderFrameGL();
}

/// <summary>
Expand All @@ -88,16 +88,16 @@ internal int RenderFrame(in DirectRenderingGLView.RenderCallbackInput input)
/// <param name="height">The height</param>
internal void Resize(int width, int height)
{
engine.UpdateGLWindowSize(width, height);
engine.RenderFullyReDraw();
_engine.UpdateGLWindowSize(width, height);
_engine.RenderFullyReDraw();
}

/// <summary>
/// Clears the current canvas. All strokes and pictures will be removed.
/// </summary>
internal void ClearCanvas()
{
engine.ClearCurrentCanvas();
_engine.ClearCurrentCanvas();
}

/// <summary>
Expand All @@ -110,8 +110,8 @@ internal void ClearCanvas()
/// <param name="height">The height</param>
internal void AddPicture(string path, float x, float y, float width, float height)
{
engine.AddPicture(path, x, y, width, height);
engine.RenderFullyReDraw();
_engine.AddPicture(path, x, y, width, height);
_engine.RenderFullyReDraw();
}

/// <summary>
Expand All @@ -120,7 +120,7 @@ internal void AddPicture(string path, float x, float y, float width, float heigh
/// <param name="gridType">The grid type</param>
internal void ToggleGrid(GridDensityType gridType)
{
engine.ToggleGrid((int)gridType);
_engine.ToggleGrid((int)gridType);
}

/// <summary>
Expand All @@ -129,7 +129,7 @@ internal void ToggleGrid(GridDensityType gridType)
/// <param name="color">The background color</param>
internal void SetCanvasColor(Color color)
{
engine.CanvasSetColor(ToHex(color), color.A);
_engine.CanvasSetColor(ToHex(color), color.A);
}

/// <summary>
Expand All @@ -138,7 +138,7 @@ internal void SetCanvasColor(Color color)
/// <param name="path">The file path</param>
internal void SaveCanvas(string path)
{
engine.SaveCanvas(canvasId, path);
_engine.SaveCanvas(_canvasId, path);
}

/// <summary>
Expand All @@ -153,7 +153,7 @@ internal void LoadCanvas(string path)
}
else
{
engine.LoadCanvas(canvasId, path);
_engine.LoadCanvas(_canvasId, path);
}
}

Expand All @@ -168,7 +168,7 @@ internal void LoadCanvas(string path)
/// <param name="callback">Callback when screenshot is complete</param>
internal void TakeScreenShot(string path, int x, int y, int width, int height, PenWave.ScreenShotCallback callback)
{
engine.TakeScreenshot(canvasId, path, x, y, width, height, callback);
_engine.TakeScreenshot(_canvasId, path, x, y, width, height, callback);
}

// Converts Color to hex string.
Expand All @@ -186,7 +186,7 @@ private string ToHex(Color color)
/// <returns>True if the canvas move begin is successful, otherwise false</returns>
internal bool CanvasMoveBegin()
{
return engine.CanvasMoveBegin();
return _engine.CanvasMoveBegin();
}

/// <summary>
Expand All @@ -197,7 +197,7 @@ internal bool CanvasMoveBegin()
/// <returns>True if the canvas move update is successful, otherwise false</returns>
internal bool CanvasMoveUpdate(int x, int y)
{
return engine.CanvasMove(x, y);
return _engine.CanvasMove(x, y);
}

/// <summary>
Expand All @@ -206,7 +206,7 @@ internal bool CanvasMoveUpdate(int x, int y)
/// <returns>True if the canvas move end is successful, otherwise false</returns>
internal bool CanvasMoveEnd()
{
return engine.CanvasMoveEnd();
return _engine.CanvasMoveEnd();
}

/// <summary>
Expand All @@ -215,7 +215,7 @@ internal bool CanvasMoveEnd()
/// <returns>True if the canvas zoom begin is successful, otherwise false</returns>
internal bool CanvasZoomBegin()
{
return engine.CanvasZoomBegin();
return _engine.CanvasZoomBegin();
}

/// <summary>
Expand All @@ -229,7 +229,7 @@ internal bool CanvasZoomBegin()
/// <returns>True if the canvas zoom update is successful, otherwise false</returns>
internal bool CanvasZoomUpdate(float x, float y, float zoom, float dx, float dy)
{
return engine.CanvasZoom(x, y, zoom, dx, dy);
return _engine.CanvasZoom(x, y, zoom, dx, dy);
}

/// <summary>
Expand All @@ -238,7 +238,7 @@ internal bool CanvasZoomUpdate(float x, float y, float zoom, float dx, float dy)
/// <returns>True if the canvas zoom end is successful, otherwise false</returns>
internal bool CanvasZoomEnd()
{
return engine.CanvasZoomEnd();
return _engine.CanvasZoomEnd();
}

/// <summary>
Expand All @@ -247,7 +247,7 @@ internal bool CanvasZoomEnd()
/// <returns>The zoom value</returns>
internal int CanvasGetZoomValue()
{
return engine.CanvasGetZoomValue();
return _engine.CanvasGetZoomValue();
}

/// <summary>
Expand All @@ -256,7 +256,7 @@ internal int CanvasGetZoomValue()
/// <param name="zoomValue">The zoom value</param>
internal void CanvasSetZoomValue(int zoomValue)
{
engine.CanvasSetZoomValue(zoomValue);
_engine.CanvasSetZoomValue(zoomValue);
}

/// <summary>
Expand All @@ -267,7 +267,7 @@ internal void CanvasSetZoomValue(int zoomValue)
/// <param name="zoomValue">The zoom value</param>
internal void CanvasSetZoomValue(int x, int y, int zoomValue)
{
engine.CanvasSetZoomValue(x, y, zoomValue);
_engine.CanvasSetZoomValue(x, y, zoomValue);
}
}
}
4 changes: 2 additions & 2 deletions src/Tizen.NUI.PenWave/src/public/Canvas/PenWave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public class PenWave
[EditorBrowsable(EditorBrowsableState.Never)]
public delegate void ScreenShotCallback();

private static readonly PenWave instance = new PenWave();
private static readonly PenWave s_instance = new PenWave();
private PenWave() { }

/// <summary>
/// Gets the singleton instance of PenWave.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static PenWave Instance => instance;
public static PenWave Instance => s_instance;

/// <summary>
/// Initializes the PenWave library.
Expand Down
Loading

0 comments on commit f824d51

Please sign in to comment.