OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../include/fxcrt/fx_basic.h" | 7 #include "../../include/fxcrt/fx_basic.h" |
8 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 8 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <dirent.h> | 10 #include <dirent.h> |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 #endif | 435 #endif |
436 } | 436 } |
437 FX_WCHAR FX_GetFolderSeparator() | 437 FX_WCHAR FX_GetFolderSeparator() |
438 { | 438 { |
439 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 439 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
440 return '\\'; | 440 return '\\'; |
441 #else | 441 #else |
442 return '/'; | 442 return '/'; |
443 #endif | 443 #endif |
444 } | 444 } |
| 445 |
| 446 CFX_Matrix_3by3 CFX_Matrix_3by3::Inverse() |
| 447 { |
| 448 FX_FLOAT det = a*(e*i - f*h) - b*(i*d - f*g) + c*(d*h - e*g); |
| 449 if (FXSYS_fabs(det) < 0.0000001) |
| 450 return CFX_Matrix_3by3(); |
| 451 else |
| 452 return CFX_Matrix_3by3( |
| 453 (e*i - f*h) / det, |
| 454 -(b*i - c*h) / det, |
| 455 (b*f - c*e) / det, |
| 456 -(d*i - f*g) / det, |
| 457 (a*i - c*g) / det, |
| 458 -(a*f - c*d) / det, |
| 459 (d*h - e*g) / det, |
| 460 -(a*h - b*g) / det, |
| 461 (a*e - b*d) / det |
| 462 ); |
| 463 } |
| 464 |
| 465 CFX_Matrix_3by3 CFX_Matrix_3by3::Multiply(const CFX_Matrix_3by3 &m) |
| 466 { |
| 467 return CFX_Matrix_3by3( |
| 468 a*m.a + b*m.d + c*m.g, |
| 469 a*m.b + b*m.e + c*m.h, |
| 470 a*m.c + b*m.f + c*m.i, |
| 471 d*m.a + e*m.d + f*m.g, |
| 472 d*m.b + e*m.e + f*m.h, |
| 473 d*m.c + e*m.f + f*m.i, |
| 474 g*m.a + h*m.d + i*m.g, |
| 475 g*m.b + h*m.e + i*m.h, |
| 476 g*m.c + h*m.f + i*m.i |
| 477 ); |
| 478 } |
| 479 |
| 480 CFX_Vector_3by1 CFX_Matrix_3by3::TransformVector(const CFX_Vector_3by1 &v) |
| 481 { |
| 482 return CFX_Vector_3by1( |
| 483 a * v.a + b * v.b + c * v.c, |
| 484 d * v.a + e * v.b + f * v.c, |
| 485 g * v.a + h * v.b + i * v.c |
| 486 ); |
| 487 } |
OLD | NEW |