Skip to content

Remove ResourceList structure and usage. #523

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

Merged
merged 2 commits into from
Nov 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion webrender/res/clip_shared.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ void write_clip(ClipInfo clip) {
clip.bottom_right.outer_inner_radius.x,
clip.bottom_left.outer_inner_radius.x);
//TODO: interpolate the final mask UV
vClipMaskUvRect = clip.mask_info.uv_rect;
vec2 texture_size = textureSize(sMask, 0);
vClipMaskUvRect = clip.mask_info.uv_rect / texture_size.xyxy;
vClipMaskLocalRect = clip.mask_info.local_rect; //TODO: transform
}
#endif
Expand Down
4 changes: 0 additions & 4 deletions webrender/res/prim_shared.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,6 @@ struct Image {
vec4 st_rect; // Location of the image texture in the texture atlas.
vec4 stretch_size_and_tile_spacing; // Size of the actual image and amount of space between
// tiled instances of this image.
bool has_pixel_coords;
};

Image fetch_image(int index) {
Expand All @@ -605,9 +604,6 @@ Image fetch_image(int index) {
image.st_rect = texelFetchOffset(sData32, uv, 0, ivec2(0, 0));
image.stretch_size_and_tile_spacing = texelFetchOffset(sData32, uv, 0, ivec2(1, 0));

image.has_pixel_coords = image.st_rect.z < 0.0;
image.st_rect.z = abs(image.st_rect.z);

return image;
}

Expand Down
11 changes: 3 additions & 8 deletions webrender/res/ps_image.vs.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,9 @@ void main(void) {
#endif

// vUv will contain how many times this image has wrapped around the image size.
vec2 st0 = image.st_rect.xy;
vec2 st1 = image.st_rect.zw;

if (image.has_pixel_coords) {
vec2 texture_size = vec2(textureSize(sDiffuse, 0));
st0 /= texture_size;
st1 /= texture_size;
}
vec2 texture_size = vec2(textureSize(sDiffuse, 0));
vec2 st0 = image.st_rect.xy / texture_size;
vec2 st1 = image.st_rect.zw / texture_size;

vTextureSize = st1 - st0;
vTextureOffset = st0;
Expand Down
2 changes: 1 addition & 1 deletion webrender/res/shared.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#define varying in

// Uniform inputs
uniform sampler2D sMask;

// Fragment shader outputs
out vec4 oFragColor;
Expand All @@ -35,6 +34,7 @@
// Shared shader uniforms
//======================================================================================
uniform sampler2D sDiffuse;
uniform sampler2D sMask;

//======================================================================================
// Interpolator definitions
Expand Down
18 changes: 0 additions & 18 deletions webrender/src/internal_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,24 +475,6 @@ pub struct PolygonPosColorUv {
pub vertices: Vec<WorkVertex>,
}

#[derive(PartialEq, Eq, Hash)]
pub struct Glyph {
pub size: Au,
pub blur_radius: Au,
pub index: u32,
}

impl Glyph {
#[inline]
pub fn new(size: Au, blur_radius: Au, index: u32) -> Glyph {
Glyph {
size: size,
blur_radius: blur_radius,
index: index,
}
}
}

#[derive(Debug, Clone)]
#[repr(C)]
pub struct PackedVertexForTextureCacheUpdate {
Expand Down
1 change: 0 additions & 1 deletion webrender/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ mod profiler;
mod record;
mod render_backend;
mod resource_cache;
mod resource_list;
mod scene;
mod spring;
mod texture_cache;
Expand Down
16 changes: 10 additions & 6 deletions webrender/src/platform/macos/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,18 @@ impl FontContext {
size: Au,
character: u32,
device_pixel_ratio: f32) -> Option<GlyphDimensions> {
self.get_ct_font(font_key, size, device_pixel_ratio).map(|ref ct_font| {
self.get_ct_font(font_key, size, device_pixel_ratio).and_then(|ref ct_font| {
let glyph = character as CGGlyph;
let metrics = get_glyph_metrics(ct_font, glyph);
GlyphDimensions {
left: metrics.rasterized_left,
top: metrics.rasterized_ascent,
width: metrics.rasterized_width as u32,
height: metrics.rasterized_height as u32,
if metrics.rasterized_width == 0 || metrics.rasterized_height == 0 {
None
} else {
Some(GlyphDimensions {
left: metrics.rasterized_left,
top: metrics.rasterized_ascent,
width: metrics.rasterized_width as u32,
height: metrics.rasterized_height as u32,
})
}
})
}
Expand Down
16 changes: 10 additions & 6 deletions webrender/src/platform/unix/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,17 @@ impl FontContext {
size: Au,
character: u32,
device_pixel_ratio: f32) -> Option<GlyphDimensions> {
self.load_glyph(font_key, size, character, device_pixel_ratio).map(|slot| {
self.load_glyph(font_key, size, character, device_pixel_ratio).and_then(|slot| {
let metrics = unsafe { &(*slot).metrics };
GlyphDimensions {
left: (metrics.horiBearingX >> 6) as i32,
top: (metrics.horiBearingY >> 6) as i32,
width: (metrics.width >> 6) as u32,
height: (metrics.height >> 6) as u32,
if metrics.width == 0 || metrics.height == 0 {
None
} else {
Some(GlyphDimensions {
left: (metrics.horiBearingX >> 6) as i32,
top: (metrics.horiBearingY >> 6) as i32,
width: (metrics.width >> 6) as u32,
height: (metrics.height >> 6) as u32,
})
}
})
}
Expand Down
Loading