Lines Matching refs:layer

79 function is_opaque(layer) {  argument
80 if (layer.color == undefined || layer.color.a == undefined || layer.color.a != 1) return false;
81 return layer.isOpaque;
84 function fills_color(layer) { argument
85 return layer.color && layer.color.a > 0 &&
86 layer.color.r >= 0 && layer.color.g >= 0 &&
87 layer.color.b >= 0;
90 function draws_shadows(layer) { argument
91 return layer.shadowRadius && layer.shadowRadius > 0;
94 function has_blur(layer) { argument
95 return layer.backgroundBlurRadius && layer.backgroundBlurRadius > 0;
98 function has_effects(layer) { argument
100 if (layer.type === 'ColorLayer') return true;
103 return layer.type === 'EffectLayer' &&
104 (fills_color(layer) || draws_shadows(layer) || has_blur(layer))
107 function is_hidden_by_policy(layer) { argument
108 return layer.flags & FLAG_HIDDEN == FLAG_HIDDEN ||
110 layer.id == 0x7FFFFFFD;
117 function is_visible(layer, hiddenByPolicy, includesCompositionState) { argument
120 return !is_empty(layer.visibleRegion);
127 if (!layer.activeBuffer && !has_effects(layer)) {
131 if (!layer.color || !layer.color.a || layer.color.a == 0) {
135 if (layer.occludedBy && layer.occludedBy.length > 0) {
139 if (!layer.bounds || is_empty_rect(layer.bounds)) {
146 function get_visibility_reason(layer) { argument
147 if (layer.type === 'ContainerLayer') {
151 if (is_hidden_by_policy(layer)) {
155 if (layer.hidden) {
159 let isBufferLayer = (layer.type === 'BufferStateLayer' || layer.type === 'BufferQueueLayer');
160 if (isBufferLayer && (!layer.activeBuffer ||
161 layer.activeBuffer.height === 0 || layer.activeBuffer.width === 0)) {
165 if (!layer.color || !layer.color.a || layer.color.a == 0) {
169 if (is_rect_empty_and_valid(layer.crop)) {
173 if (!layer.bounds || is_empty_rect(layer.bounds)) {
177 if (is_transform_invalid(layer.transform)) {
180 if (layer.isRelativeOf && layer.zOrderRelativeOf == -1) {
184 let isEffectLayer = (layer.type === 'EffectLayer');
185 if (isEffectLayer && !fills_color(layer) && !draws_shadows(layer) && !has_blur(layer)) {
189 if (layer.occludedBy && layer.occludedBy.length > 0) {
190 return 'Layer is occluded by:' + layer.occludedBy.join();
193 if (layer.visible) {
215 function screen_bounds(layer) { argument
216 if (layer.screenBounds) return layer.screenBounds;
217 let transformMatrix = layer.transform;
218 var tx = layer.position ? layer.position.x || 0 : 0;
219 var ty = layer.position ? layer.position.y || 0 : 0;
223 return multiply_rect(transformMatrix, layer.bounds);
228 const layers = rootLayers.filter(layer => !layer.isRelativeOf);
229 …yerMap, layers, {opaqueRects:[], transparentRects:[], screenBounds:null}, (layer, globalState) => {
231 if (layer.name.startsWith("Root#0") && layer.sourceBounds) {
232 …globalState.screenBounds = {left:0, top:0, bottom:layer.sourceBounds.bottom, right:layer.sourceBo…
235 const visible = is_visible(layer, layer.hidden, includesCompositionState);
237 let fullyOccludes = (testLayer) => contains(testLayer, layer);
238 … let partiallyOccludes = (testLayer) => overlaps(screen_bounds(testLayer), screen_bounds(layer));
239 let covers = (testLayer) => overlaps(screen_bounds(testLayer), screen_bounds(layer));
241 layer.occludedBy = globalState.opaqueRects.filter(fullyOccludes).map(layer => layer.id);
242layer.partiallyOccludedBy = globalState.opaqueRects.filter(partiallyOccludes).map(layer => layer.i…
243 layer.coveredBy = globalState.transparentRects.filter(covers).map(layer => layer.id);
245 if (is_opaque(layer)) {
246 globalState.opaqueRects.push(layer);
248 globalState.transparentRects.push(layer);
252 layer.visible = is_visible(layer, layer.hidden, includesCompositionState);
253 if (!layer.visible) {
254 layer.invisibleDueTo = get_visibility_reason(layer);
265 const traverseList = relatives.concat(children.filter(layer => !layer.isRelativeOf));
268 traverseList.filter((layer) => layer.z >=0).forEach(layer => {
269 traverse_top_to_bottom(layerMap, [layer], globalState, fn);
274 traverseList.filter((layer) => layer.z < 0).forEach(layer => {
275 traverse_top_to_bottom(layerMap, [layer], globalState, fn);
283 traverse(layerMap, rootLayers, (layer, parent) => {
285 layer.hidden = is_hidden_by_policy(layer) || parentHidden;
286 layer.verboseFlags = flags_to_string(layer.flags);
288 if (!layer.bounds) {
289 if (!layer.sourceBounds) {
290 layer.bounds = layer.sourceBounds;
292 layer.bounds = parent.bounds;
294 layer.bounds = {left:0, top:0, right:0, bottom:0};