OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 this._lastSelection = {}; | 62 this._lastSelection = {}; |
63 this._layerTree = null; | 63 this._layerTree = null; |
64 this._textureManager = new WebInspector.LayerTextureManager(); | 64 this._textureManager = new WebInspector.LayerTextureManager(); |
65 this._textureManager.addEventListener(WebInspector.LayerTextureManager.Event
s.TextureUpdated, this._update, this); | 65 this._textureManager.addEventListener(WebInspector.LayerTextureManager.Event
s.TextureUpdated, this._update, this); |
66 /** @type Array.<!WebGLTexture|undefined> */ | 66 /** @type Array.<!WebGLTexture|undefined> */ |
67 this._chromeTextures = []; | 67 this._chromeTextures = []; |
68 this._rects = []; | 68 this._rects = []; |
69 | 69 |
70 this._layerViewHost.showInternalLayersSetting().addChangeListener(this._upda
te, this); | 70 this._layerViewHost.showInternalLayersSetting().addChangeListener(this._upda
te, this); |
71 } | 71 }; |
72 | 72 |
73 /** @typedef {{borderColor: !Array.<number>, borderWidth: number}} */ | 73 /** @typedef {{borderColor: !Array.<number>, borderWidth: number}} */ |
74 WebInspector.Layers3DView.LayerStyle; | 74 WebInspector.Layers3DView.LayerStyle; |
75 | 75 |
76 /** @typedef {{layerId: string, rect: !Array.<number>, snapshot: !WebInspector.P
aintProfilerSnapshot, traceEvent: !WebInspector.TracingModel.Event}} */ | 76 /** @typedef {{layerId: string, rect: !Array.<number>, snapshot: !WebInspector.P
aintProfilerSnapshot, traceEvent: !WebInspector.TracingModel.Event}} */ |
77 WebInspector.Layers3DView.PaintTile; | 77 WebInspector.Layers3DView.PaintTile; |
78 | 78 |
79 /** | 79 /** |
80 * @enum {string} | 80 * @enum {string} |
81 */ | 81 */ |
82 WebInspector.Layers3DView.OutlineType = { | 82 WebInspector.Layers3DView.OutlineType = { |
83 Hovered: "hovered", | 83 Hovered: "hovered", |
84 Selected: "selected" | 84 Selected: "selected" |
85 } | 85 }; |
86 | 86 |
87 /** | 87 /** |
88 * @enum {string} | 88 * @enum {string} |
89 */ | 89 */ |
90 /** @enum {symbol} */ | 90 /** @enum {symbol} */ |
91 WebInspector.Layers3DView.Events = { | 91 WebInspector.Layers3DView.Events = { |
92 LayerSnapshotRequested: Symbol("LayerSnapshotRequested"), | 92 LayerSnapshotRequested: Symbol("LayerSnapshotRequested"), |
93 PaintProfilerRequested: Symbol("PaintProfilerRequested"), | 93 PaintProfilerRequested: Symbol("PaintProfilerRequested"), |
94 ScaleChanged: Symbol("ScaleChanged") | 94 ScaleChanged: Symbol("ScaleChanged") |
95 } | 95 }; |
96 | 96 |
97 /** | 97 /** |
98 * @enum {number} | 98 * @enum {number} |
99 */ | 99 */ |
100 WebInspector.Layers3DView.ChromeTexture = { | 100 WebInspector.Layers3DView.ChromeTexture = { |
101 Left: 0, | 101 Left: 0, |
102 Middle: 1, | 102 Middle: 1, |
103 Right: 2 | 103 Right: 2 |
104 } | 104 }; |
105 | 105 |
106 /** | 106 /** |
107 * @enum {string} | 107 * @enum {string} |
108 */ | 108 */ |
109 WebInspector.Layers3DView.ScrollRectTitles = { | 109 WebInspector.Layers3DView.ScrollRectTitles = { |
110 RepaintsOnScroll: WebInspector.UIString("repaints on scroll"), | 110 RepaintsOnScroll: WebInspector.UIString("repaints on scroll"), |
111 TouchEventHandler: WebInspector.UIString("touch event listener"), | 111 TouchEventHandler: WebInspector.UIString("touch event listener"), |
112 WheelEventHandler: WebInspector.UIString("mousewheel event listener") | 112 WheelEventHandler: WebInspector.UIString("mousewheel event listener") |
113 } | 113 }; |
114 | 114 |
115 WebInspector.Layers3DView.FragmentShader = "" + | 115 WebInspector.Layers3DView.FragmentShader = "" + |
116 "precision mediump float;\n" + | 116 "precision mediump float;\n" + |
117 "varying vec4 vColor;\n" + | 117 "varying vec4 vColor;\n" + |
118 "varying vec2 vTextureCoord;\n" + | 118 "varying vec2 vTextureCoord;\n" + |
119 "uniform sampler2D uSampler;\n" + | 119 "uniform sampler2D uSampler;\n" + |
120 "void main(void)\n" + | 120 "void main(void)\n" + |
121 "{\n" + | 121 "{\n" + |
122 " gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.
t)) * vColor;\n" + | 122 " gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.
t)) * vColor;\n" + |
123 "}"; | 123 "}"; |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 if (selection) { | 804 if (selection) { |
805 if (selection.type() === WebInspector.LayerView.Selection.Type.Tile) | 805 if (selection.type() === WebInspector.LayerView.Selection.Type.Tile) |
806 this.dispatchEventToListeners(WebInspector.Layers3DView.Events.P
aintProfilerRequested, selection.traceEvent()); | 806 this.dispatchEventToListeners(WebInspector.Layers3DView.Events.P
aintProfilerRequested, selection.traceEvent()); |
807 else if (selection.layer()) | 807 else if (selection.layer()) |
808 this.dispatchEventToListeners(WebInspector.Layers3DView.Events.L
ayerSnapshotRequested, selection.layer()); | 808 this.dispatchEventToListeners(WebInspector.Layers3DView.Events.L
ayerSnapshotRequested, selection.layer()); |
809 } | 809 } |
810 event.stopPropagation(); | 810 event.stopPropagation(); |
811 }, | 811 }, |
812 | 812 |
813 __proto__: WebInspector.VBox.prototype | 813 __proto__: WebInspector.VBox.prototype |
814 } | 814 }; |
815 | 815 |
816 /** | 816 /** |
817 * @constructor | 817 * @constructor |
818 * @extends {WebInspector.Object} | 818 * @extends {WebInspector.Object} |
819 */ | 819 */ |
820 WebInspector.LayerTextureManager = function() | 820 WebInspector.LayerTextureManager = function() |
821 { | 821 { |
822 WebInspector.Object.call(this); | 822 WebInspector.Object.call(this); |
823 this.reset(); | 823 this.reset(); |
824 } | 824 }; |
825 | 825 |
826 /** @enum {symbol} */ | 826 /** @enum {symbol} */ |
827 WebInspector.LayerTextureManager.Events = { | 827 WebInspector.LayerTextureManager.Events = { |
828 TextureUpdated: Symbol("TextureUpated") | 828 TextureUpdated: Symbol("TextureUpated") |
829 } | 829 }; |
830 | 830 |
831 WebInspector.LayerTextureManager.prototype = { | 831 WebInspector.LayerTextureManager.prototype = { |
832 reset: function() | 832 reset: function() |
833 { | 833 { |
834 /** @type {!Object.<string, !Array.<!WebInspector.LayerTextureManager.Ti
le>>} */ | 834 /** @type {!Object.<string, !Array.<!WebInspector.LayerTextureManager.Ti
le>>} */ |
835 this._tilesByLayerId = {}; | 835 this._tilesByLayerId = {}; |
836 this._scale = 0; | 836 this._scale = 0; |
837 }, | 837 }, |
838 | 838 |
839 /** | 839 /** |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA
, this._gl.UNSIGNED_BYTE, texture.image); | 972 this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA
, this._gl.UNSIGNED_BYTE, texture.image); |
973 this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER,
this._gl.LINEAR); | 973 this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER,
this._gl.LINEAR); |
974 this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER,
this._gl.LINEAR); | 974 this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER,
this._gl.LINEAR); |
975 this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, thi
s._gl.CLAMP_TO_EDGE); | 975 this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, thi
s._gl.CLAMP_TO_EDGE); |
976 this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, thi
s._gl.CLAMP_TO_EDGE); | 976 this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, thi
s._gl.CLAMP_TO_EDGE); |
977 this._gl.bindTexture(this._gl.TEXTURE_2D, null); | 977 this._gl.bindTexture(this._gl.TEXTURE_2D, null); |
978 return texture; | 978 return texture; |
979 }, | 979 }, |
980 | 980 |
981 __proto__: WebInspector.Object.prototype | 981 __proto__: WebInspector.Object.prototype |
982 } | 982 }; |
983 | 983 |
984 /** | 984 /** |
985 * @constructor | 985 * @constructor |
986 * @param {?WebInspector.LayerView.Selection} relatedObject | 986 * @param {?WebInspector.LayerView.Selection} relatedObject |
987 */ | 987 */ |
988 WebInspector.Layers3DView.Rectangle = function(relatedObject) | 988 WebInspector.Layers3DView.Rectangle = function(relatedObject) |
989 { | 989 { |
990 this.relatedObject = relatedObject; | 990 this.relatedObject = relatedObject; |
991 /** @type {number} */ | 991 /** @type {number} */ |
992 this.lineWidth = 1; | 992 this.lineWidth = 1; |
993 /** @type {?Array.<number>} */ | 993 /** @type {?Array.<number>} */ |
994 this.borderColor = null; | 994 this.borderColor = null; |
995 /** @type {?Array.<number>} */ | 995 /** @type {?Array.<number>} */ |
996 this.fillColor = null; | 996 this.fillColor = null; |
997 /** @type {?WebGLTexture} */ | 997 /** @type {?WebGLTexture} */ |
998 this.texture = null; | 998 this.texture = null; |
999 } | 999 }; |
1000 | 1000 |
1001 WebInspector.Layers3DView.Rectangle.prototype = { | 1001 WebInspector.Layers3DView.Rectangle.prototype = { |
1002 /** | 1002 /** |
1003 * @param {!Array.<number>} quad | 1003 * @param {!Array.<number>} quad |
1004 * @param {number} z | 1004 * @param {number} z |
1005 */ | 1005 */ |
1006 setVertices: function(quad, z) | 1006 setVertices: function(quad, z) |
1007 { | 1007 { |
1008 this.vertices = [quad[0], quad[1], z, quad[2], quad[3], z, quad[4], quad
[5], z, quad[6], quad[7], z]; | 1008 this.vertices = [quad[0], quad[1], z, quad[2], quad[3], z, quad[4], quad
[5], z, quad[6], quad[7], z]; |
1009 }, | 1009 }, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 var tVects = points.map(WebInspector.Geometry.subtract.bind(null, pt)); | 1083 var tVects = points.map(WebInspector.Geometry.subtract.bind(null, pt)); |
1084 // Intersection point lies inside of the polygon if scalar products of n
ormal of the plane and | 1084 // Intersection point lies inside of the polygon if scalar products of n
ormal of the plane and |
1085 // cross products of successive tVects are all nonstrictly above or all
nonstrictly below zero | 1085 // cross products of successive tVects are all nonstrictly above or all
nonstrictly below zero |
1086 for (i = 0; i < tVects.length; ++i) { | 1086 for (i = 0; i < tVects.length; ++i) { |
1087 var product = WebInspector.Geometry.scalarProduct(normal, WebInspect
or.Geometry.crossProduct(tVects[i], tVects[(i + 1) % tVects.length])); | 1087 var product = WebInspector.Geometry.scalarProduct(normal, WebInspect
or.Geometry.crossProduct(tVects[i], tVects[(i + 1) % tVects.length])); |
1088 if (product < 0) | 1088 if (product < 0) |
1089 return undefined; | 1089 return undefined; |
1090 } | 1090 } |
1091 return t; | 1091 return t; |
1092 } | 1092 } |
1093 } | 1093 }; |
1094 | 1094 |
1095 /** | 1095 /** |
1096 * @constructor | 1096 * @constructor |
1097 * @param {!WebInspector.PaintProfilerSnapshot} snapshot | 1097 * @param {!WebInspector.PaintProfilerSnapshot} snapshot |
1098 * @param {!Array.<number>} rect | 1098 * @param {!Array.<number>} rect |
1099 * @param {!WebInspector.TracingModel.Event} traceEvent | 1099 * @param {!WebInspector.TracingModel.Event} traceEvent |
1100 */ | 1100 */ |
1101 WebInspector.LayerTextureManager.Tile = function(snapshot, rect, traceEvent) | 1101 WebInspector.LayerTextureManager.Tile = function(snapshot, rect, traceEvent) |
1102 { | 1102 { |
1103 this.snapshot = snapshot; | 1103 this.snapshot = snapshot; |
1104 this.rect = rect; | 1104 this.rect = rect; |
1105 this.traceEvent = traceEvent; | 1105 this.traceEvent = traceEvent; |
1106 this.scale = 0; | 1106 this.scale = 0; |
1107 /** @type {?WebGLTexture} */ | 1107 /** @type {?WebGLTexture} */ |
1108 this.texture = null; | 1108 this.texture = null; |
1109 } | 1109 }; |
OLD | NEW |