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

If a stacking context is isolated, disable subpixel AA on it. #1844

Merged
merged 1 commit into from Oct 11, 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

If a stacking context is isolated, disable subpixel AA on it.

This is a workaround / hack for #1839, until we properly support
subpixel AA on transparent surfaces. It extends the set of
conditions that disable subpixel AA on a stacking context.

Fixes #1839.
  • Loading branch information
gw3583 committed Oct 11, 2017
commit b2a2c1a917ae31f95f7c675e05aa5632cd56a6f8
@@ -1153,7 +1153,7 @@ impl FrameBuilder {
// we handle subpixel blending.
if let Some(sc_index) = self.stacking_context_stack.last() {
let stacking_context = &self.stacking_context_store[sc_index.0];
if stacking_context.composite_ops.count() > 0 {
if !stacking_context.allow_subpixel_aa {
render_mode = FontRenderMode::Alpha;
}
}
@@ -1601,6 +1601,11 @@ pub struct StackingContext {

/// Current stacking context visibility of backface.
pub is_backface_visible: bool,

/// Allow subpixel AA for text runs on this stacking context.
/// This is a temporary hack while we don't support subpixel AA
/// on transparent stacking contexts.
pub allow_subpixel_aa: bool,
}

impl StackingContext {
@@ -1618,6 +1623,8 @@ impl StackingContext {
TransformStyle::Flat => ContextIsolation::None,
TransformStyle::Preserve3D => ContextIsolation::Items,
};
let allow_subpixel_aa = composite_ops.count() == 0 &&
isolation == ContextIsolation::None;
StackingContext {
pipeline_id,
reference_frame_offset,
@@ -1630,6 +1637,7 @@ impl StackingContext {
is_pipeline_root,
is_visible: false,
is_backface_visible,
allow_subpixel_aa,
}
}

Binary file not shown.
@@ -0,0 +1,14 @@
root:
items:
- type: stacking-context
bounds: [0, 0, 1000, 100]
transform: perspective(1000)
items:
- type: stacking-context
bounds: [0, 0, 1000, 100]
transform-style: preserve-3d
items:
- text: "Cats making all the muffins knock over christmas tree"
origin: 20 30
size: 20
font: "FreeSans.ttf"
@@ -23,3 +23,5 @@ fuzzy(1,160) == shadow-grey.yaml shadow-grey-ref.yaml
# enable when synthetic-italics implemented on mac
platform(linux) != synthetic-italics.yaml synthetic-italics-ref.yaml
options(disable-subpixel) == ahem.yaml ahem-ref.yaml
platform(linux) == isolated-text.yaml isolated-text.png

@@ -332,6 +332,9 @@ impl YamlHelper for Yaml {
"rotate-y" if args.len() == 1 => {
make_rotation(transform_origin, args[0].parse().unwrap(), 0.0, 1.0, 0.0)
}
"perspective" if args.len() == 1 => {
LayoutTransform::create_perspective(args[0].parse().unwrap())
}
_ => {
println!("unknown function {}", function);
break;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.