OLD | NEW |
---|---|
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/fpdfapi/page/cpdf_page.h" | 7 #include "core/fpdfapi/page/cpdf_page.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 void CPDF_Page::GetDisplayMatrix(CFX_Matrix& matrix, | 119 void CPDF_Page::GetDisplayMatrix(CFX_Matrix& matrix, |
120 int xPos, | 120 int xPos, |
121 int yPos, | 121 int yPos, |
122 int xSize, | 122 int xSize, |
123 int ySize, | 123 int ySize, |
124 int iRotate) const { | 124 int iRotate) const { |
125 if (m_PageWidth == 0 || m_PageHeight == 0) { | 125 if (m_PageWidth == 0 || m_PageHeight == 0) { |
126 return; | 126 return; |
127 } | 127 } |
128 CFX_Matrix display_matrix; | 128 CFX_Matrix display_matrix; |
129 int x0 = 0; | 129 float x0 = 0; |
Lei Zhang
2016/10/12 18:59:53
No need to initialize?
dsinclair
2016/10/12 19:03:18
Done.
| |
130 int y0 = 0; | 130 float y0 = 0; |
131 int x1 = 0; | 131 float x1 = 0; |
132 int y1 = 0; | 132 float y1 = 0; |
133 int x2 = 0; | 133 float x2 = 0; |
134 int y2 = 0; | 134 float y2 = 0; |
135 iRotate %= 4; | 135 iRotate %= 4; |
136 switch (iRotate) { | 136 switch (iRotate) { |
137 case 0: | 137 case 0: |
138 x0 = xPos; | 138 x0 = xPos; |
139 y0 = yPos + ySize; | 139 y0 = yPos + ySize; |
140 x1 = xPos; | 140 x1 = xPos; |
141 y1 = yPos; | 141 y1 = yPos; |
142 x2 = xPos + xSize; | 142 x2 = xPos + xSize; |
143 y2 = yPos + ySize; | 143 y2 = yPos + ySize; |
144 break; | 144 break; |
(...skipping 15 matching lines...) Expand all Loading... | |
160 break; | 160 break; |
161 case 3: | 161 case 3: |
162 x0 = xPos + xSize; | 162 x0 = xPos + xSize; |
163 y0 = yPos + ySize; | 163 y0 = yPos + ySize; |
164 x1 = xPos; | 164 x1 = xPos; |
165 y1 = yPos + ySize; | 165 y1 = yPos + ySize; |
166 x2 = xPos + xSize; | 166 x2 = xPos + xSize; |
167 y2 = yPos; | 167 y2 = yPos; |
168 break; | 168 break; |
169 } | 169 } |
170 display_matrix.Set( | 170 display_matrix.Set((x2 - x0) / m_PageWidth, (y2 - y0) / m_PageWidth, |
171 ((FX_FLOAT)(x2 - x0)) / m_PageWidth, ((FX_FLOAT)(y2 - y0)) / m_PageWidth, | 171 (x1 - x0) / m_PageHeight, (y1 - y0) / m_PageHeight, x0, |
172 ((FX_FLOAT)(x1 - x0)) / m_PageHeight, | 172 y0); |
173 ((FX_FLOAT)(y1 - y0)) / m_PageHeight, (FX_FLOAT)x0, (FX_FLOAT)y0); | |
174 matrix = m_PageMatrix; | 173 matrix = m_PageMatrix; |
175 matrix.Concat(display_matrix); | 174 matrix.Concat(display_matrix); |
176 } | 175 } |
OLD | NEW |