@@ -54,7 +54,7 @@ bool _performSubmit() {
5454 }
5555
5656 public interface Surface : IDisposable {
57- SurfaceFrame acquireFrame ( Size size , float devicePixelRatio ) ;
57+ SurfaceFrame acquireFrame ( Size size , float devicePixelRatio , int antiAliasing ) ;
5858
5959 MeshPool getMeshPool ( ) ;
6060 }
@@ -104,8 +104,8 @@ public WindowSurfaceImpl(DrawToTargetFunc drawToTargetFunc = null) {
104104 this . _drawToTargetFunc = drawToTargetFunc ;
105105 }
106106
107- public SurfaceFrame acquireFrame ( Size size , float devicePixelRatio ) {
108- this . _createOrUpdateRenderTexture ( size , devicePixelRatio ) ;
107+ public SurfaceFrame acquireFrame ( Size size , float devicePixelRatio , int antiAliasing ) {
108+ this . _createOrUpdateRenderTexture ( size , devicePixelRatio , antiAliasing ) ;
109109
110110 return new SurfaceFrame ( this . _surface ,
111111 ( frame , canvas ) => this . _presentSurface ( canvas ) ) ;
@@ -151,10 +151,11 @@ protected bool _presentSurface(Canvas canvas) {
151151 return true ;
152152 }
153153
154- void _createOrUpdateRenderTexture ( Size size , float devicePixelRatio ) {
154+ void _createOrUpdateRenderTexture ( Size size , float devicePixelRatio , int antiAliasing ) {
155155 if ( this . _surface != null
156156 && this . _surface . size == size
157157 && this . _surface . devicePixelRatio == devicePixelRatio
158+ && this . _surface . antiAliasing == antiAliasing
158159 && this . _surface . getRenderTexture ( ) != null ) {
159160 return ;
160161 }
@@ -164,14 +165,16 @@ void _createOrUpdateRenderTexture(Size size, float devicePixelRatio) {
164165 this . _surface = null ;
165166 }
166167
167- this . _surface = new GrSurface ( size , devicePixelRatio , this . _meshPool ) ;
168+ this . _surface = new GrSurface ( size , devicePixelRatio , antiAliasing , this . _meshPool ) ;
168169 }
169170 }
170171
171172 public class GrSurface : IDisposable {
172173 public readonly Size size ;
173174
174175 public readonly float devicePixelRatio ;
176+
177+ public readonly int antiAliasing ;
175178
176179 readonly MeshPool _meshPool ;
177180
@@ -192,16 +195,21 @@ public Canvas getCanvas() {
192195 return this . _canvas ;
193196 }
194197
195- public GrSurface ( Size size , float devicePixelRatio , MeshPool meshPool ) {
198+ public GrSurface ( Size size , float devicePixelRatio , int antiAliasing , MeshPool meshPool ) {
196199 this . size = size ;
197200 this . devicePixelRatio = devicePixelRatio ;
201+ this . antiAliasing = antiAliasing ;
198202
199203 var desc = new RenderTextureDescriptor (
200204 ( int ) this . size . width , ( int ) this . size . height ,
201205 RenderTextureFormat . Default , 24 ) {
202206 useMipMap = false ,
203207 autoGenerateMips = false ,
204208 } ;
209+
210+ if ( antiAliasing != 0 ) {
211+ desc . msaaSamples = antiAliasing ;
212+ }
205213
206214 this . _renderTexture = new RenderTexture ( desc ) ;
207215 this . _renderTexture . hideFlags = HideFlags . HideAndDontSave ;
0 commit comments