1
1
#import " iTermCursorGuideRenderer.h"
2
2
3
3
@interface iTermCursorGuideRendererTransientState ()
4
- @property (nonatomic , strong ) id <MTLTexture > horizontalTexture, verticalTexture;
4
+ @property (nonatomic , strong ) id <MTLTexture > horizontalTexture;
5
+ @property (nonatomic , strong ) id <MTLTexture > verticalTexture;
5
6
@property (nonatomic ) int row;
6
7
@property (nonatomic ) int column;
7
- @property (nonatomic ) id <MTLBuffer > horizontalVertexBuffer, verticalVertexBuffer, upperVertexBuffer, lowerVertexBuffer;
8
+ @property (nonatomic ) id <MTLBuffer > horizontalVertexBuffer;
9
+ @property (nonatomic ) id <MTLBuffer > verticalVertexBuffer;
10
+ @property (nonatomic ) id <MTLBuffer > upperVertexBuffer;
11
+ @property (nonatomic ) id <MTLBuffer > lowerVertexBuffer;
8
12
@end
9
13
10
14
@implementation iTermCursorGuideRendererTransientState {
11
15
int _row;
12
16
int _column;
13
- id <MTLBuffer > _horizontalVertexBuffer, _verticalVertexBuffer;
14
- id <MTLBuffer > _upperVertexBuffer, _lowerVertexBuffer;
17
+ id <MTLBuffer > _horizontalVertexBuffer;
18
+ id <MTLBuffer > _verticalVertexBuffer;
19
+ id <MTLBuffer > _upperVertexBuffer;
20
+ id <MTLBuffer > _lowerVertexBuffer;
15
21
}
16
22
17
23
- (id <MTLBuffer >)tessellateRect : (CGRect )rect withTexture : (CGRect )textureRect withPool : (iTermMetalBufferPool *)verticesPool {
@@ -43,6 +49,7 @@ - (void)setCursorCoord:(VT100GridCoord)coord {
43
49
- (void )initializeVerticesWithPool : (iTermMetalBufferPool *)verticesPool
44
50
horizontal : (BOOL )horizontal
45
51
vertical : (BOOL )vertical {
52
+ assert (horizontal || vertical);
46
53
CGSize cellSize = self.cellConfiguration .cellSize ;
47
54
VT100GridSize gridSize = self.cellConfiguration .gridSize ;
48
55
@@ -90,7 +97,8 @@ - (void)writeDebugInfoToFolder:(NSURL *)folder {
90
97
91
98
@implementation iTermCursorGuideRenderer {
92
99
iTermMetalCellRenderer *_cellRenderer;
93
- id <MTLTexture > _horizontalTexture, _verticalTexture;
100
+ id <MTLTexture > _horizontalTexture;
101
+ id <MTLTexture > _verticalTexture;
94
102
NSColor *_color;
95
103
CGSize _lastCellSize;
96
104
}
@@ -156,7 +164,7 @@ - (void)drawWithFrameData:(iTermMetalFrameData *)frameData
156
164
}
157
165
158
166
if (tState.row >= 0 && tState.column >= 0 && self.horizontalEnabled && self.verticalEnabled ) {
159
- [tState initializeVerticesWithPool: _cellRenderer.verticesPool horizontal: TRUE vertical: TRUE ];
167
+ [tState initializeVerticesWithPool: _cellRenderer.verticesPool horizontal: YES vertical: YES ];
160
168
[_cellRenderer drawWithTransientState: tState
161
169
renderEncoder: frameData.renderEncoder
162
170
numberOfVertices: 6
@@ -179,7 +187,7 @@ - (void)drawWithFrameData:(iTermMetalFrameData *)frameData
179
187
fragmentBuffers: @{}
180
188
textures: @{ @(iTermTextureIndexPrimary): tState.verticalTexture } ];
181
189
} else if (tState.row >= 0 && self.horizontalEnabled ) {
182
- [tState initializeVerticesWithPool: _cellRenderer.verticesPool horizontal: TRUE vertical: FALSE ];
190
+ [tState initializeVerticesWithPool: _cellRenderer.verticesPool horizontal: YES vertical: NO ];
183
191
[_cellRenderer drawWithTransientState: tState
184
192
renderEncoder: frameData.renderEncoder
185
193
numberOfVertices: 6
@@ -188,7 +196,7 @@ - (void)drawWithFrameData:(iTermMetalFrameData *)frameData
188
196
fragmentBuffers: @{}
189
197
textures: @{ @(iTermTextureIndexPrimary): tState.horizontalTexture } ];
190
198
} else if (tState.column >= 0 && self.verticalEnabled ) {
191
- [tState initializeVerticesWithPool: _cellRenderer.verticesPool horizontal: FALSE vertical: TRUE ];
199
+ [tState initializeVerticesWithPool: _cellRenderer.verticesPool horizontal: NO vertical: YES ];
192
200
[_cellRenderer drawWithTransientState: tState
193
201
renderEncoder: frameData.renderEncoder
194
202
numberOfVertices: 6
0 commit comments