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

Render solid line decorations in the opaque pass #3232

Merged
merged 1 commit into from Oct 25, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -1294,7 +1294,8 @@ impl AlphaBatchBuilder {
for (segment_index, (segment, segment_data)) in segment_desc.segments
.iter()
.zip(segment_data.iter())
.enumerate() {
.enumerate()
{
self.add_segment_to_batch(
segment,
segment_data,
@@ -1315,7 +1316,8 @@ impl AlphaBatchBuilder {
// between all segments.
for (segment_index, segment) in segment_desc.segments
.iter()
.enumerate() {
.enumerate()
{
self.add_segment_to_batch(
segment,
segment_data,
@@ -1333,6 +1335,7 @@ impl AlphaBatchBuilder {
}
(None, SegmentDataKind::Shared(ref segment_data)) => {
// No segments, and thus no per-segment instance data.
// Note: the blend mode already takes opacity into account
let batch_key = BatchKey {
blend_mode: non_segmented_blend_mode,
kind: BatchKind::Brush(params.batch_kind),
@@ -1907,7 +1907,8 @@ impl PrimitiveStore {
prim_instance.clipped_world_rect = Some(pic_state.map_pic_to_world.bounds);
} else {
if prim.local_rect.size.width <= 0.0 ||
prim.local_rect.size.height <= 0.0 {
prim.local_rect.size.height <= 0.0
{
if cfg!(debug_assertions) && is_chased {
println!("\tculled for zero local rectangle");
}
@@ -1954,6 +1955,9 @@ impl PrimitiveStore {
let clip_chain = match clip_chain {
Some(clip_chain) => clip_chain,
None => {
if cfg!(debug_assertions) && is_chased {
println!("\tunable to build the clip chain, skipping");
}
prim_instance.clipped_world_rect = None;
return false;
}
@@ -2060,8 +2064,8 @@ impl PrimitiveStore {
let prim_index = prim_instance.prim_index;
let is_chased = Some(prim_index) == self.chase_id;

if is_chased {
println!("\tpreparing prim {:?} in pipeline {:?}",
if cfg!(debug_assertions) && is_chased {
println!("\tpreparing {:?} in {:?}",
prim_instance.prim_index, pic_context.pipeline_id);
}

@@ -2784,16 +2788,28 @@ impl PrimitiveInstance {
}
}
}
BrushKind::LineDecoration { ref mut handle, style, orientation, wavy_line_thickness, .. } => {
// Work out the device pixel size to be used to cache this line decoration.
BrushKind::LineDecoration { color, ref mut handle, style, orientation, wavy_line_thickness } => {
// Update opacity for this primitive to ensure the correct

This comment has been minimized.

@gw3583

gw3583 Oct 25, 2018

Collaborator

Nice 👍

// batching parameters are used.
self.opacity.is_opaque = match style {
LineStyle::Solid => color.a == 1.0,
LineStyle::Dotted |
LineStyle::Dashed |
LineStyle::Wavy => false,
};

// Work out the device pixel size to be used to cache this line decoration.
let size = get_line_decoration_sizes(
&prim_local_rect.size,
orientation,
style,
wavy_line_thickness,
);

if is_chased {

This comment has been minimized.

@lqd

lqd Oct 25, 2018

would a if cfg!(debug_assertions) be interesting here as well, to match the other ones ?

println!("\tline decoration opaque={}, sizes={:?}", self.opacity.is_opaque, size);
}

if let Some((inline_size, block_size)) = size {
let size = match orientation {
LineOrientation::Horizontal => LayoutSize::new(inline_size, block_size),
@@ -52,7 +52,7 @@ fn render_task_sanity_check(size: &DeviceIntSize) {
#[cfg_attr(feature = "replay", derive(Deserialize))]
pub struct RenderTaskId(pub u32, FrameId); // TODO(gw): Make private when using GPU cache!

#[derive(Debug, Copy, Clone)]
#[derive(Debug, Copy, Clone, PartialEq)]
#[repr(C)]
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.