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 // Original code is licensed as follows: | 6 // Original code is licensed as follows: |
7 /* | 7 /* |
8 * Copyright 2007 ZXing authors | 8 * Copyright 2007 ZXing authors |
9 * | 9 * |
10 * Licensed under the Apache License, Version 2.0 (the "License"); | 10 * Licensed under the Apache License, Version 2.0 (the "License"); |
(...skipping 30 matching lines...) Expand all Loading... |
41 FX_FLOAT x1p, FX_FLOAT y1p, | 41 FX_FLOAT x1p, FX_FLOAT y1p, |
42 FX_FLOAT x2p, FX_FLOAT y2p, | 42 FX_FLOAT x2p, FX_FLOAT y2p, |
43 FX_FLOAT x3p, FX_FLOAT y3p) | 43 FX_FLOAT x3p, FX_FLOAT y3p) |
44 { | 44 { |
45 CBC_AutoPtr<CBC_CommonPerspectiveTransform> qToS(QuadrilateralToSquare(x0, y
0, x1, y1, x2, y2, x3, y3)); | 45 CBC_AutoPtr<CBC_CommonPerspectiveTransform> qToS(QuadrilateralToSquare(x0, y
0, x1, y1, x2, y2, x3, y3)); |
46 CBC_AutoPtr<CBC_CommonPerspectiveTransform> sToQ(SquareToQuadrilateral(x0p,
y0p, x1p, y1p, x2p, y2p, x3p, y3p)); | 46 CBC_AutoPtr<CBC_CommonPerspectiveTransform> sToQ(SquareToQuadrilateral(x0p,
y0p, x1p, y1p, x2p, y2p, x3p, y3p)); |
47 return sToQ->Times(*(qToS.get())); | 47 return sToQ->Times(*(qToS.get())); |
48 } | 48 } |
49 void CBC_CommonPerspectiveTransform::TransformPoints(CFX_FloatArray *points) | 49 void CBC_CommonPerspectiveTransform::TransformPoints(CFX_FloatArray *points) |
50 { | 50 { |
51 FX_INT32 max = points->GetSize(); | 51 int32_t max = points->GetSize(); |
52 FX_FLOAT a11 = m_a11; | 52 FX_FLOAT a11 = m_a11; |
53 FX_FLOAT a12 = m_a12; | 53 FX_FLOAT a12 = m_a12; |
54 FX_FLOAT a13 = m_a13; | 54 FX_FLOAT a13 = m_a13; |
55 FX_FLOAT a21 = m_a21; | 55 FX_FLOAT a21 = m_a21; |
56 FX_FLOAT a22 = m_a22; | 56 FX_FLOAT a22 = m_a22; |
57 FX_FLOAT a23 = m_a23; | 57 FX_FLOAT a23 = m_a23; |
58 FX_FLOAT a31 = m_a31; | 58 FX_FLOAT a31 = m_a31; |
59 FX_FLOAT a32 = m_a32; | 59 FX_FLOAT a32 = m_a32; |
60 FX_FLOAT a33 = m_a33; | 60 FX_FLOAT a33 = m_a33; |
61 FX_INT32 i; | 61 int32_t i; |
62 for (i = 0; i < max; i += 2) { | 62 for (i = 0; i < max; i += 2) { |
63 FX_FLOAT x = (*points)[i]; | 63 FX_FLOAT x = (*points)[i]; |
64 FX_FLOAT y = (*points)[i + 1]; | 64 FX_FLOAT y = (*points)[i + 1]; |
65 FX_FLOAT denominator = a13 * x + a23 * y + a33; | 65 FX_FLOAT denominator = a13 * x + a23 * y + a33; |
66 (*points)[i] = (a11 * x + a21 * y + a31) / denominator; | 66 (*points)[i] = (a11 * x + a21 * y + a31) / denominator; |
67 (*points)[i + 1] = (a12 * x + a22 * y + a32) / denominator; | 67 (*points)[i + 1] = (a12 * x + a22 * y + a32) / denominator; |
68 } | 68 } |
69 } | 69 } |
70 CBC_CommonPerspectiveTransform *CBC_CommonPerspectiveTransform::SquareToQuadrila
teral(FX_FLOAT x0, FX_FLOAT y0, | 70 CBC_CommonPerspectiveTransform *CBC_CommonPerspectiveTransform::SquareToQuadrila
teral(FX_FLOAT x0, FX_FLOAT y0, |
71 FX_FLOAT x1, FX_FLOAT y1, | 71 FX_FLOAT x1, FX_FLOAT y1, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return FX_NEW CBC_CommonPerspectiveTransform(m_a11 * other.m_a11 + m_a21 * o
ther.m_a12 + m_a31 * other.m_a13, | 116 return FX_NEW CBC_CommonPerspectiveTransform(m_a11 * other.m_a11 + m_a21 * o
ther.m_a12 + m_a31 * other.m_a13, |
117 m_a11 * other.m_a21 + m_a21 * other.m_a22 + m_a31 * other.m_a23, | 117 m_a11 * other.m_a21 + m_a21 * other.m_a22 + m_a31 * other.m_a23, |
118 m_a11 * other.m_a31 + m_a21 * other.m_a32 + m_a31 * other.m_a33, | 118 m_a11 * other.m_a31 + m_a21 * other.m_a32 + m_a31 * other.m_a33, |
119 m_a12 * other.m_a11 + m_a22 * other.m_a12 + m_a32 * other.m_a13, | 119 m_a12 * other.m_a11 + m_a22 * other.m_a12 + m_a32 * other.m_a13, |
120 m_a12 * other.m_a21 + m_a22 * other.m_a22 + m_a32 * other.m_a23, | 120 m_a12 * other.m_a21 + m_a22 * other.m_a22 + m_a32 * other.m_a23, |
121 m_a12 * other.m_a31 + m_a22 * other.m_a32 + m_a32 * other.m_a33, | 121 m_a12 * other.m_a31 + m_a22 * other.m_a32 + m_a32 * other.m_a33, |
122 m_a13 * other.m_a11 + m_a23 * other.m_a12 + m_a33 * other.m_a13, | 122 m_a13 * other.m_a11 + m_a23 * other.m_a12 + m_a33 * other.m_a13, |
123 m_a13 * other.m_a21 + m_a23 * other.m_a22 + m_a33 * other.m_a23, | 123 m_a13 * other.m_a21 + m_a23 * other.m_a22 + m_a33 * other.m_a23, |
124 m_a13 * other.m_a31 + m_a23 * other.m_a32 + m_a33 * other.m_a33); | 124 m_a13 * other.m_a31 + m_a23 * other.m_a32 + m_a33 * other.m_a33); |
125 } | 125 } |
OLD | NEW |