@@ -54,7 +54,7 @@ bool _performSubmit() {
54
54
}
55
55
56
56
public interface Surface : IDisposable {
57
- SurfaceFrame acquireFrame ( Size size , float devicePixelRatio ) ;
57
+ SurfaceFrame acquireFrame ( Size size , float devicePixelRatio , int antiAliasing ) ;
58
58
59
59
MeshPool getMeshPool ( ) ;
60
60
}
@@ -104,8 +104,8 @@ public WindowSurfaceImpl(DrawToTargetFunc drawToTargetFunc = null) {
104
104
this . _drawToTargetFunc = drawToTargetFunc ;
105
105
}
106
106
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 ) ;
109
109
110
110
return new SurfaceFrame ( this . _surface ,
111
111
( frame , canvas ) => this . _presentSurface ( canvas ) ) ;
@@ -151,10 +151,11 @@ protected bool _presentSurface(Canvas canvas) {
151
151
return true ;
152
152
}
153
153
154
- void _createOrUpdateRenderTexture ( Size size , float devicePixelRatio ) {
154
+ void _createOrUpdateRenderTexture ( Size size , float devicePixelRatio , int antiAliasing ) {
155
155
if ( this . _surface != null
156
156
&& this . _surface . size == size
157
157
&& this . _surface . devicePixelRatio == devicePixelRatio
158
+ && this . _surface . antiAliasing == antiAliasing
158
159
&& this . _surface . getRenderTexture ( ) != null ) {
159
160
return ;
160
161
}
@@ -164,14 +165,16 @@ void _createOrUpdateRenderTexture(Size size, float devicePixelRatio) {
164
165
this . _surface = null ;
165
166
}
166
167
167
- this . _surface = new GrSurface ( size , devicePixelRatio , this . _meshPool ) ;
168
+ this . _surface = new GrSurface ( size , devicePixelRatio , antiAliasing , this . _meshPool ) ;
168
169
}
169
170
}
170
171
171
172
public class GrSurface : IDisposable {
172
173
public readonly Size size ;
173
174
174
175
public readonly float devicePixelRatio ;
176
+
177
+ public readonly int antiAliasing ;
175
178
176
179
readonly MeshPool _meshPool ;
177
180
@@ -192,16 +195,21 @@ public Canvas getCanvas() {
192
195
return this . _canvas ;
193
196
}
194
197
195
- public GrSurface ( Size size , float devicePixelRatio , MeshPool meshPool ) {
198
+ public GrSurface ( Size size , float devicePixelRatio , int antiAliasing , MeshPool meshPool ) {
196
199
this . size = size ;
197
200
this . devicePixelRatio = devicePixelRatio ;
201
+ this . antiAliasing = antiAliasing ;
198
202
199
203
var desc = new RenderTextureDescriptor (
200
204
( int ) this . size . width , ( int ) this . size . height ,
201
205
RenderTextureFormat . Default , 24 ) {
202
206
useMipMap = false ,
203
207
autoGenerateMips = false ,
204
208
} ;
209
+
210
+ if ( antiAliasing != 0 ) {
211
+ desc . msaaSamples = antiAliasing ;
212
+ }
205
213
206
214
this . _renderTexture = new RenderTexture ( desc ) ;
207
215
this . _renderTexture . hideFlags = HideFlags . HideAndDontSave ;
0 commit comments