mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
Re-factor the CSS_PIXELS_PER_INCH
/PDF_PIXELS_PER_INCH
exports (PR 13991 follow-up)
For improved maintainability, since these constants are being exposed in the official API, this patch moves them into an Object instead.
This commit is contained in:
parent
bd51bbfd16
commit
0e54f568fb
7 changed files with 18 additions and 20 deletions
|
@ -12,7 +12,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { CSS_PIXELS_PER_INCH, PDF_PIXELS_PER_INCH } from "./display_utils.js";
|
||||
|
||||
import {
|
||||
FONT_IDENTITY_MATRIX,
|
||||
IDENTITY_MATRIX,
|
||||
|
@ -28,6 +28,7 @@ import {
|
|||
warn,
|
||||
} from "../shared/util.js";
|
||||
import { getShadingPattern, TilingPattern } from "./pattern_helper.js";
|
||||
import { PixelsPerInch } from "./display_utils.js";
|
||||
|
||||
// <canvas> contexts store most of the state we need natively.
|
||||
// However, PDF needs a bit more state, which we store here.
|
||||
|
@ -878,8 +879,7 @@ function getImageSmoothingEnabled(transform, interpolate) {
|
|||
scale[0] = Math.fround(scale[0]);
|
||||
scale[1] = Math.fround(scale[1]);
|
||||
const actualScale = Math.fround(
|
||||
((globalThis.devicePixelRatio || 1) * CSS_PIXELS_PER_INCH) /
|
||||
PDF_PIXELS_PER_INCH
|
||||
((globalThis.devicePixelRatio || 1) * PixelsPerInch.CSS) / PixelsPerInch.PDF
|
||||
);
|
||||
if (interpolate !== undefined) {
|
||||
// If the value is explicitly set use it.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue