MCPcopy
hub / github.com/jabbany/CommentCoreLibrary / _updateBox

Method _updateBox

src/scripting/api/Display/Bitmap.ts:138–168  ·  view source on GitHub ↗
(changeRect:Rectangle = null)

Source from the content-addressed store, hash-verified

136 }
137
138 private _updateBox(changeRect:Rectangle = null):void {
139 if (this._dirtyArea.isEmpty()) {
140 // Don't update anything if nothing was changed
141 return;
142 }
143 if (this._locked) {
144 // Don't send updates if this is locked
145 return;
146 }
147 var change:Rectangle = changeRect === null ? this._dirtyArea.asRect() :
148 changeRect;
149
150 // Make sure we're not out-of-bounds
151 if (!this._rect.containsRect(change)) {
152 __trace('BitmapData._updateBox box ' + change.toString() +
153 ' out of bonunds ' + this._rect.toString(), 'err');
154 throw new Error('Rectangle provided was not within image bounds.');
155 }
156 // Extract the values
157 var region:Array<number> = [];
158 for (var i = 0; i < change.height; i++) {
159 for (var j = 0; j < change.width; j++) {
160 region.push(this._byteArray[(change.y + i) * this._rect.width +
161 change.x + j]);
162 }
163 }
164 this._call('updateBox', {
165 'box': change.serialize(),
166 'values': region
167 });
168 }
169
170 private _call(method:string, args:any):void {
171 __pchannel('Runtime:CallMethod', {

Callers 1

unlockMethod · 0.95

Calls 7

_callMethod · 0.95
__traceFunction · 0.85
asRectMethod · 0.80
containsRectMethod · 0.80
serializeMethod · 0.65
isEmptyMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected