@@ -18,13 +18,15 @@ - (void)dealloc;
18
18
- (void )reset : (id <MTLTexture >)destination
19
19
isDstOpaque : (jboolean)isDstOpaque
20
20
isDstPremultiplied : (jboolean)isDstPremultiplied
21
- isAA : (jboolean)isAA ;
21
+ isAA : (jboolean)isAA
22
+ isText : (jboolean)isText ;
22
23
23
24
- (void )updateEncoder : (id <MTLRenderCommandEncoder >)encoder
24
25
context : (MTLContext *)mtlc
25
26
renderOptions : (const RenderOptions *)renderOptions
26
27
forceUpdate : (jboolean)forceUpdate ;
27
28
@property (assign ) jboolean aa;
29
+ @property (assign ) jboolean text;
28
30
@property (retain ) MTLPaint* paint;
29
31
@end
30
32
@@ -37,6 +39,7 @@ @implementation EncoderStates {
37
39
SurfaceRasterFlags _dstFlags;
38
40
39
41
jboolean _isAA;
42
+ jboolean _isText;
40
43
41
44
//
42
45
// Cached 'mutable' states of encoder
@@ -60,6 +63,7 @@ @implementation EncoderStates {
60
63
MTLTransform * _transform;
61
64
}
62
65
@synthesize aa = _isAA;
66
+ @synthesize text = _isText;
63
67
@synthesize paint = _paint;
64
68
65
69
- (id )init {
@@ -89,11 +93,13 @@ - (void)setContext:(MTLContext * _Nonnull)mtlc {
89
93
- (void )reset : (id <MTLTexture >)destination
90
94
isDstOpaque : (jboolean)isDstOpaque
91
95
isDstPremultiplied : (jboolean)isDstPremultiplied
92
- isAA : (jboolean)isAA {
96
+ isAA : (jboolean)isAA
97
+ isText : (jboolean)isText {
93
98
_destination = destination;
94
99
_dstFlags.isOpaque = isDstOpaque;
95
100
_dstFlags.isPremultiplied = isDstPremultiplied;
96
101
_isAA = isAA;
102
+ _isText = isText;
97
103
// NOTE: probably it's better to invalidate/reset all cached states now
98
104
}
99
105
@@ -141,6 +147,7 @@ - (void)updatePipelineState:(id<MTLRenderCommandEncoder>)encoder
141
147
&& [_composite isEqual: mtlc.composite]
142
148
&& (_isTexture == renderOptions->isTexture && (!renderOptions->isTexture || _interpolationMode == renderOptions->interpolation )) // interpolation is used only in texture mode
143
149
&& _isAA == renderOptions->isAA
150
+ && _isText == renderOptions->isText
144
151
&& _srcFlags.isOpaque == renderOptions->srcFlags .isOpaque && _srcFlags.isPremultiplied == renderOptions->srcFlags .isPremultiplied )
145
152
return ;
146
153
@@ -149,6 +156,7 @@ - (void)updatePipelineState:(id<MTLRenderCommandEncoder>)encoder
149
156
_isTexture = renderOptions->isTexture ;
150
157
_interpolationMode = renderOptions->interpolation ;
151
158
_isAA = renderOptions->isAA ;
159
+ _isText = renderOptions->isText ;
152
160
_srcFlags = renderOptions->srcFlags ;
153
161
154
162
if ((jint)[mtlc.composite getCompositeState ] == sun_java2d_SunGraphics2D_COMP_XOR) {
@@ -242,14 +250,14 @@ - (void)setContext:(MTLContex * _Nonnull)mtlc {
242
250
243
251
- (id <MTLRenderCommandEncoder > _Nonnull)getAARenderEncoder : (const BMTLSDOps * _Nonnull)dstOps {
244
252
id <MTLTexture > dstTxt = dstOps->pTexture ;
245
- RenderOptions roptions = {JNI_FALSE, JNI_TRUE, INTERPOLATION_NEAREST_NEIGHBOR, defaultRasterFlags, {dstOps->isOpaque , JNI_TRUE}};
253
+ RenderOptions roptions = {JNI_FALSE, JNI_TRUE, INTERPOLATION_NEAREST_NEIGHBOR, defaultRasterFlags, {dstOps->isOpaque , JNI_TRUE}, JNI_FALSE };
246
254
return [self getEncoder: dstTxt renderOptions: &roptions];
247
255
}
248
256
249
257
- (id <MTLRenderCommandEncoder > _Nonnull)getRenderEncoder : (id <MTLTexture > _Nonnull)dest
250
258
isDstOpaque : (bool )isOpaque
251
259
{
252
- RenderOptions roptions = {JNI_FALSE, JNI_FALSE, INTERPOLATION_NEAREST_NEIGHBOR, defaultRasterFlags, {isOpaque, JNI_TRUE}};
260
+ RenderOptions roptions = {JNI_FALSE, JNI_FALSE, INTERPOLATION_NEAREST_NEIGHBOR, defaultRasterFlags, {isOpaque, JNI_TRUE}, JNI_FALSE };
253
261
return [self getEncoder: dest renderOptions: &roptions];
254
262
}
255
263
@@ -279,7 +287,7 @@ - (void)setContext:(MTLContex * _Nonnull)mtlc {
279
287
interpolation : (int )interpolation
280
288
isAA : (jboolean)isAA
281
289
{
282
- RenderOptions roptions = {JNI_TRUE, isAA, interpolation, { isSrcOpaque, JNI_TRUE }, {isDstOpaque, JNI_TRUE}};
290
+ RenderOptions roptions = {JNI_TRUE, isAA, interpolation, { isSrcOpaque, JNI_TRUE }, {isDstOpaque, JNI_TRUE}, JNI_FALSE };
283
291
return [self getEncoder: dest renderOptions: &roptions];
284
292
}
285
293
@@ -291,6 +299,13 @@ - (void)setContext:(MTLContex * _Nonnull)mtlc {
291
299
return [self getTextureEncoder: dest isSrcOpaque: isSrcOpaque isDstOpaque: isDstOpaque interpolation: interpolation isAA: JNI_FALSE];
292
300
}
293
301
302
+ - (id <MTLRenderCommandEncoder > _Nonnull) getTextEncoder : (const BMTLSDOps * _Nonnull)dstOps
303
+ isSrcOpaque : (bool )isSrcOpaque
304
+ {
305
+ RenderOptions roptions = {JNI_TRUE, JNI_FALSE, INTERPOLATION_NEAREST_NEIGHBOR, { isSrcOpaque, JNI_TRUE }, {dstOps->isOpaque , JNI_TRUE}, JNI_TRUE};
306
+ return [self getEncoder: dstOps->pTexture renderOptions: &roptions];
307
+ }
308
+
294
309
- (id <MTLRenderCommandEncoder > _Nonnull) getEncoder : (id <MTLTexture > _Nonnull)dest
295
310
renderOptions : (const RenderOptions * _Nonnull)renderOptions
296
311
{
@@ -358,7 +373,8 @@ - (void)setContext:(MTLContex * _Nonnull)mtlc {
358
373
[_encoderStates reset: dest
359
374
isDstOpaque: renderOptions->dstFlags.isOpaque
360
375
isDstPremultiplied: YES
361
- isAA: renderOptions->isAA];
376
+ isAA: renderOptions->isAA
377
+ isText: renderOptions->isText];
362
378
}
363
379
364
380
//
0 commit comments