11#import " iTermCursorGuideRenderer.h"
22
33@interface iTermCursorGuideRendererTransientState ()
4- @property (nonatomic , strong ) id <MTLTexture > horizontalTexture, verticalTexture;
4+ @property (nonatomic , strong ) id <MTLTexture > horizontalTexture;
5+ @property (nonatomic , strong ) id <MTLTexture > verticalTexture;
56@property (nonatomic ) int row;
67@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;
812@end
913
1014@implementation iTermCursorGuideRendererTransientState {
1115 int _row;
1216 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;
1521}
1622
1723- (id <MTLBuffer >)tessellateRect : (CGRect)rect withTexture : (CGRect)textureRect withPool : (iTermMetalBufferPool *)verticesPool {
@@ -43,6 +49,7 @@ - (void)setCursorCoord:(VT100GridCoord)coord {
4349- (void )initializeVerticesWithPool : (iTermMetalBufferPool *)verticesPool
4450 horizontal : (BOOL )horizontal
4551 vertical : (BOOL )vertical {
52+ assert (horizontal || vertical);
4653 CGSize cellSize = self.cellConfiguration .cellSize ;
4754 VT100GridSize gridSize = self.cellConfiguration .gridSize ;
4855
@@ -90,7 +97,8 @@ - (void)writeDebugInfoToFolder:(NSURL *)folder {
9097
9198@implementation iTermCursorGuideRenderer {
9299 iTermMetalCellRenderer *_cellRenderer;
93- id <MTLTexture > _horizontalTexture, _verticalTexture;
100+ id <MTLTexture > _horizontalTexture;
101+ id <MTLTexture > _verticalTexture;
94102 NSColor *_color;
95103 CGSize _lastCellSize;
96104}
@@ -156,7 +164,7 @@ - (void)drawWithFrameData:(iTermMetalFrameData *)frameData
156164 }
157165
158166 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 ];
160168 [_cellRenderer drawWithTransientState: tState
161169 renderEncoder: frameData.renderEncoder
162170 numberOfVertices: 6
@@ -179,7 +187,7 @@ - (void)drawWithFrameData:(iTermMetalFrameData *)frameData
179187 fragmentBuffers: @{}
180188 textures: @{ @(iTermTextureIndexPrimary): tState.verticalTexture } ];
181189 } 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 ];
183191 [_cellRenderer drawWithTransientState: tState
184192 renderEncoder: frameData.renderEncoder
185193 numberOfVertices: 6
@@ -188,7 +196,7 @@ - (void)drawWithFrameData:(iTermMetalFrameData *)frameData
188196 fragmentBuffers: @{}
189197 textures: @{ @(iTermTextureIndexPrimary): tState.horizontalTexture } ];
190198 } 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 ];
192200 [_cellRenderer drawWithTransientState: tState
193201 renderEncoder: frameData.renderEncoder
194202 numberOfVertices: 6
0 commit comments