Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit b865234

Browse files
author
Yuncong Zhang
committed
Code cleanup.
1 parent a054c47 commit b865234

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

Runtime/flow/raster_cache.cs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ internal _RasterCacheKey(Picture picture, Matrix3 matrix, float devicePixelRatio
5858
var y = this.matrix[5] * devicePixelRatio;
5959
this.matrix[2] = (x - (int) x) / devicePixelRatio; // x
6060
this.matrix[5] = (y - (int) y) / devicePixelRatio; // y
61-
61+
6262
D.assert(Mathf.Abs(this.matrix[2]) <= 1e-5);
6363
D.assert(Mathf.Abs(this.matrix[5]) <= 1e-5);
6464
return true;
6565
});
66-
66+
6767
this.matrix[2] = 0.0f;
68-
this.matrix[5] = 0.0f;
68+
this.matrix[5] = 0.0f;
6969
this.devicePixelRatio = devicePixelRatio;
7070
this.antiAliasing = antiAliasing;
7171
}
@@ -145,12 +145,14 @@ public RasterCache(int threshold = 3) {
145145
readonly Dictionary<_RasterCacheKey, _RasterCacheEntry> _cache;
146146

147147
MeshPool _meshPool;
148+
148149
public MeshPool meshPool {
149150
set { this._meshPool = value; }
150151
}
151152

152153
public RasterCacheResult getPrerolledImage(
153-
Picture picture, Matrix3 transform, float devicePixelRatio, int antiAliasing, bool isComplex, bool willChange) {
154+
Picture picture, Matrix3 transform, float devicePixelRatio, int antiAliasing, bool isComplex,
155+
bool willChange) {
154156
if (this.threshold == 0) {
155157
return null;
156158
}
@@ -176,7 +178,8 @@ public RasterCacheResult getPrerolledImage(
176178

177179
if (entry.image == null) {
178180
D.assert(this._meshPool != null);
179-
entry.image = this._rasterizePicture(picture, transform, devicePixelRatio, antiAliasing, this._meshPool);
181+
entry.image =
182+
this._rasterizePicture(picture, transform, devicePixelRatio, antiAliasing, this._meshPool);
180183
}
181184

182185
return entry.image;
@@ -216,18 +219,26 @@ static bool _canRasterizePicture(Picture picture) {
216219
foreach (DrawCmd drawCmd in picture.drawCmds) {
217220
switch (drawCmd) {
218221
case DrawImage cmd: {
219-
if (cmd.image.isDynamic)
222+
if (cmd.image.isDynamic) {
220223
return false;
224+
}
225+
221226
break;
222227
}
228+
223229
case DrawImageNine cmd: {
224-
if (cmd.image.isDynamic)
230+
if (cmd.image.isDynamic) {
225231
return false;
232+
}
233+
226234
break;
227235
}
236+
228237
case DrawImageRect cmd: {
229-
if (cmd.image.isDynamic)
238+
if (cmd.image.isDynamic) {
230239
return false;
240+
}
241+
231242
break;
232243
}
233244
}

Runtime/ui/painting/codec_gif.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections;
33
using System.IO;
4-
using RSG;
54
using Unity.UIWidgets.foundation;
65
using UnityEngine;
76

@@ -63,6 +62,7 @@ IEnumerator _startDecoding() {
6362
this._image = new Image(this._texture, isDynamic: true);
6463
this._frameData.frameInfo.image = this._image;
6564
}
65+
6666
this._frameData.gifFrame = this._decoder.currentFrame;
6767
D.assert(this._frameData.gifFrame != null);
6868

Runtime/ui/painting/image.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ public class Image : IEquatable<Image>, IDisposable {
1111
readonly bool _isDynamic;
1212
AssetBundle _bundle;
1313

14-
public Image(Texture texture, bool noDispose = false, bool isAsset = false, AssetBundle bundle = null, bool isDynamic = false) {
14+
public Image(Texture texture, bool noDispose = false, bool isAsset = false, AssetBundle bundle = null,
15+
bool isDynamic = false) {
1516
D.assert(!noDispose || !isAsset && bundle == null);
1617
D.assert(isAsset || bundle == null);
1718

@@ -35,7 +36,7 @@ public Texture texture {
3536
}
3637

3738
public bool isDynamic {
38-
get { return this._isDynamic; }
39+
get { return this._isDynamic; }
3940
}
4041

4142
~Image() {

0 commit comments

Comments
 (0)