| 345 | } |
| 346 | |
| 347 | void Layer::updateMatrix(Scalar width, Scalar height) { |
| 348 | _matrix.setIdentity(); |
| 349 | |
| 350 | auto scaledWidth = width; |
| 351 | auto scaledHeight = height; |
| 352 | auto translationX = _translation.width; |
| 353 | auto translationY = _translation.height; |
| 354 | |
| 355 | // Compensate for the change of size so that it appears as if we are scaling from the center |
| 356 | if (_scaleX != 1.0f) { |
| 357 | scaledWidth *= _scaleX; |
| 358 | |
| 359 | translationX += (width - scaledWidth) / 2.0f; |
| 360 | _matrix.setScaleX(_scaleX); |
| 361 | } |
| 362 | |
| 363 | if (_scaleY != 1.0f) { |
| 364 | scaledHeight *= _scaleY; |
| 365 | |
| 366 | translationY += (height - scaledHeight) / 2.0f; |
| 367 | _matrix.setScaleY(_scaleY); |
| 368 | } |
| 369 | |
| 370 | _matrix.setTranslateX(_frame.left + translationX); |
| 371 | _matrix.setTranslateY(_frame.top + translationY); |
| 372 | |
| 373 | if (_rotation != 0.0f) { |
| 374 | Scalar centerX = _matrix.getTranslateX() + scaledWidth / 2.0f; |
| 375 | Scalar centerY = _matrix.getTranslateY() + scaledHeight / 2.0f; |
| 376 | _matrix.postRotate(_rotation, centerX, centerY); |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | void Layer::setTouchAreaExtension(Scalar left, Scalar right, Scalar top, Scalar bottom) { |
| 381 | _touchAreaExtensionLeft = left; |
nothing calls this directly
no test coverage detected