Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove old border code path. #1200

Merged
merged 1 commit into from May 4, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

This file was deleted.

This file was deleted.

This file was deleted.

@@ -86,14 +86,26 @@ void write_color(vec4 color0, vec4 color1, int style, vec2 delta, int instance_k
vColor11 = vec4(color1.rgb * modulate.w, color1.a);
}

int select_style(int color_select, vec2 style) {
int select_style(int color_select, vec2 fstyle) {
ivec2 style = ivec2(fstyle);

switch (color_select) {
case SIDE_BOTH:
return int(style.x);
// TODO(gw): A temporary hack! While we don't support
// border corners that have dots or dashes
// with another style, pretend they are solid
// border corners.
bool has_dots = style.x == BORDER_STYLE_DOTTED ||
style.y == BORDER_STYLE_DOTTED;
bool has_dashes = style.x == BORDER_STYLE_DASHED ||
style.y == BORDER_STYLE_DASHED;
if (style.x != style.y && (has_dots || has_dashes))
return BORDER_STYLE_SOLID;
return style.x;
case SIDE_FIRST:
return int(style.x);
return style.x;
case SIDE_SECOND:
return int(style.y);
return style.y;
}
}

@@ -39,7 +39,6 @@ pub enum BorderCornerKind {
Solid,
Clip(BorderCornerInstance),
Mask(BorderCornerClipData, LayerSize, LayerSize, BorderCornerClipKind),
Unhandled,
}

impl BorderCornerKind {
@@ -175,13 +174,17 @@ impl NormalBorderHelpers for NormalBorder {
*border_rect)
}

// TODO(gw): Handle border corners with both dots and dashes.
// Once these are handled, the old border path can
// be removed.
// Draw border transitions with dots and/or dashes as
// solid segments. The old border path didn't support
// this anyway, so we might as well start using the new
// border path here, since the dashing in the edges is
// much higher quality anyway.
(BorderStyle::Dotted, _) |
(_, BorderStyle::Dotted) |
(BorderStyle::Dashed, _) |
(_, BorderStyle::Dashed) => BorderCornerKind::Unhandled,
(_, BorderStyle::Dashed) => {
BorderCornerKind::Clip(BorderCornerInstance::Single)
}

// Everything else can be handled by drawing the corner twice,
// where the shader outputs zero alpha for the side it's not
@@ -223,7 +226,6 @@ impl FrameBuilder {
widths: &BorderWidths,
clip_and_scroll: ClipAndScrollInfo,
clip_region: &ClipRegion,
use_new_border_path: bool,
corner_instances: [BorderCornerInstance; 4],
extra_clips: &[ClipSource]) {
let radius = &border.radius;
@@ -239,7 +241,6 @@ impl FrameBuilder {
let bottom_color = bottom.border_color(2.0/3.0, 1.0, 0.7, 0.3);

let prim_cpu = BorderPrimitiveCpu {
use_new_border_path: use_new_border_path,
corner_instances: corner_instances,
};

@@ -326,19 +327,6 @@ impl FrameBuilder {
rect),
];

// If any of the corners are unhandled, fall back to slow path for now.
if corners.iter().any(|c| *c == BorderCornerKind::Unhandled) {
self.add_normal_border_primitive(rect,
border,
widths,
clip_and_scroll,
clip_region,
false,
[BorderCornerInstance::Single; 4],
&[]);
return;
}

let (left_edge, left_len) = border.get_edge(left, widths.left);
let (top_edge, top_len) = border.get_edge(top, widths.top);
let (right_edge, right_len) = border.get_edge(right, widths.right);
@@ -427,7 +415,6 @@ impl FrameBuilder {
widths,
clip_and_scroll,
clip_region,
true,
corner_instances,
&extra_clips);
}
@@ -217,9 +217,6 @@ impl YuvImagePrimitiveGpu {

#[derive(Debug, Clone)]
pub struct BorderPrimitiveCpu {
// TODO(gw): Remove this when all border kinds are switched
// over to the new border path!
pub use_new_border_path: bool,
pub corner_instances: [BorderCornerInstance; 4],
}

@@ -77,7 +77,6 @@ const GPU_TAG_PRIM_GRADIENT: GpuProfileTag = GpuProfileTag { label: "Gradient",
const GPU_TAG_PRIM_ANGLE_GRADIENT: GpuProfileTag = GpuProfileTag { label: "AngleGradient", color: debug_colors::POWDERBLUE };
const GPU_TAG_PRIM_RADIAL_GRADIENT: GpuProfileTag = GpuProfileTag { label: "RadialGradient", color: debug_colors::LIGHTPINK };
const GPU_TAG_PRIM_BOX_SHADOW: GpuProfileTag = GpuProfileTag { label: "BoxShadow", color: debug_colors::CYAN };
const GPU_TAG_PRIM_BORDER: GpuProfileTag = GpuProfileTag { label: "Border", color: debug_colors::ORANGE };
const GPU_TAG_PRIM_BORDER_CORNER: GpuProfileTag = GpuProfileTag { label: "BorderCorner", color: debug_colors::DARKSLATEGREY };
const GPU_TAG_PRIM_BORDER_EDGE: GpuProfileTag = GpuProfileTag { label: "BorderEdge", color: debug_colors::LAVENDER };
const GPU_TAG_PRIM_CACHE_IMAGE: GpuProfileTag = GpuProfileTag { label: "CacheImage", color: debug_colors::SILVER };
@@ -537,7 +536,6 @@ pub struct Renderer {
ps_text_run_subpixel: PrimitiveShader,
ps_image: Vec<Option<PrimitiveShader>>,
ps_yuv_image: Vec<Option<PrimitiveShader>>,
ps_border: PrimitiveShader,
ps_border_corner: PrimitiveShader,
ps_border_edge: PrimitiveShader,
ps_gradient: PrimitiveShader,
@@ -814,13 +812,6 @@ impl Renderer {
}
}

let ps_border = try!{
PrimitiveShader::new("ps_border",
&mut device,
&[],
options.precache_shaders)
};

let ps_border_corner = try!{
PrimitiveShader::new("ps_border_corner",
&mut device,
@@ -1092,7 +1083,6 @@ impl Renderer {
ps_text_run_subpixel: ps_text_run_subpixel,
ps_image: ps_image,
ps_yuv_image: ps_yuv_image,
ps_border: ps_border,
ps_border_corner: ps_border_corner,
ps_border_edge: ps_border_edge,
ps_box_shadow: ps_box_shadow,
@@ -1555,10 +1545,6 @@ impl Renderer {
let shader = self.ps_yuv_image[shader_index].as_mut().unwrap().get(&mut self.device, transform_kind);
(GPU_TAG_PRIM_YUV_IMAGE, shader)
}
AlphaBatchKind::Border => {
let shader = self.ps_border.get(&mut self.device, transform_kind);
(GPU_TAG_PRIM_BORDER, shader)
}
AlphaBatchKind::BorderCorner => {
let shader = self.ps_border_corner.get(&mut self.device, transform_kind);
(GPU_TAG_PRIM_BORDER_CORNER, shader)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.