Skip to content
Snippets Groups Projects
Commit 37c6232d authored by George Nachman's avatar George Nachman
Browse files

More hacks

parent fab9b29e
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -133,7 +133,7 @@
pipelineStateDescriptor.label = [NSString stringWithFormat:@"Pipeline for %@", NSStringFromClass([self class])];
pipelineStateDescriptor.vertexFunction = vertexFunction;
pipelineStateDescriptor.fragmentFunction = fragmentFunction;
pipelineStateDescriptor.colorAttachments[0].pixelFormat = MTLPixelFormatBGRA8Unorm;
pipelineStateDescriptor.colorAttachments[0].pixelFormat = MTLPixelFormatBGRA8Unorm_sRGB;
 
if (blending) {
MTLRenderPipelineColorAttachmentDescriptor *renderbufferAttachment = pipelineStateDescriptor.colorAttachments[0];
Loading
Loading
Loading
Loading
@@ -55,7 +55,6 @@ iTermTextFragmentShaderSolidBackground(iTermTextVertexFunctionOutput in [[stage_
if (bwColor.x == 1 && bwColor.y == 1 && bwColor.z == 1) {
discard_fragment();
}
// For a discussion of this code, see this document:
// https://docs.google.com/document/d/1vfBq6vg409Zky-IQ7ne-Yy7olPtVCl0dq3PG20E8KDs
 
Loading
Loading
@@ -149,10 +148,25 @@ iTermTextFragmentShaderSolidBackground(iTermTextVertexFunctionOutput in [[stage_
float4 f_x_y2 = (x2 - x) / (x2 - x1) * fq12 + (x - x1) / (x2 - x1) * fq22;
float4 f_x_y = (y2 - y) / (y2 - y1) * f_x_y1 + (y - y1) / (y2 - y1) * f_x_y2;
 
return float4(f_x_y.x,
f_x_y.y,
f_x_y.z,
255) / 255.0;
float4 color = float4(f_x_y.x,
f_x_y.y,
f_x_y.z,
255) / 255.0;
#warning TODO: Only do this when transparency is present.
// In the face of transparency, we need to blend non-black colors toward the text color and transparent
float average = (bwColor.x + bwColor.y + bwColor.z) / 3;
// If importance is 1, don't touch it. If importance is 0, make it transparent gray.
float p = 2 * (1 - average);
float importance = pow((1 - average), p);
float unimportance = 1 - importance;
float4 muted = color * importance + in.textColor * unimportance;
float p2 = 0.5 + average;
muted.w = 1 - pow(average, p2);
return muted;
}
 
fragment float4
Loading
Loading
Loading
Loading
@@ -136,6 +136,8 @@ static NSDate* lastResizeDate_;
_metalView = [[MTKView alloc] initWithFrame:_scrollview.contentView.frame
device:MTLCreateSystemDefaultDevice()];
_metalView.layer.opaque = NO;
CAMetalLayer *metalLayer = _metalView.layer;
metalLayer.pixelFormat = MTLPixelFormatBGRA8Unorm_sRGB;
[self addSubview:_metalView];
_metalView.paused = YES;
_metalView.enableSetNeedsDisplay = YES;
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment