Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: java/org/libjpegturbo/turbojpeg/TJScalingFactor.java

Issue 1934113002: Update libjpeg_turbo to 1.4.90 from https://github.com/libjpeg-turbo/ (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (C)2011 D. R. Commander. All Rights Reserved.
3 * Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * - Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * - Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * - Neither the name of the libjpeg-turbo Project nor the names of its
14 * contributors may be used to endorse or promote products derived from this
15 * software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 package org.libjpegturbo.turbojpeg;
31
32 /**
33 * Fractional scaling factor
34 */
35 public class TJScalingFactor {
36
37 public TJScalingFactor(int num, int denom) {
38 if (num < 1 || denom < 1)
39 throw new IllegalArgumentException("Numerator and denominator must be >= 1 ");
40 this.num = num;
41 this.denom = denom;
42 }
43
44 /**
45 * Returns numerator
46 *
47 * @return numerator
48 */
49 public int getNum() {
50 return num;
51 }
52
53 /**
54 * Returns denominator
55 *
56 * @return denominator
57 */
58 public int getDenom() {
59 return denom;
60 }
61
62 /**
63 * Returns the scaled value of <code>dimension</code>. This function
64 * performs the integer equivalent of
65 * <code>ceil(dimension * scalingFactor)</code>.
66 *
67 * @return the scaled value of <code>dimension</code>.
68 */
69 public int getScaled(int dimension) {
70 return (dimension * num + denom - 1) / denom;
71 }
72
73 /**
74 * Returns true or false, depending on whether this instance and
75 * <code>other</code> have the same numerator and denominator.
76 *
77 * @return true or false, depending on whether this instance and
78 * <code>other</code> have the same numerator and denominator.
79 */
80 public boolean equals(TJScalingFactor other) {
81 return this.num == other.num && this.denom == other.denom;
82 }
83
84 /**
85 * Returns true or false, depending on whether this instance is equal to
86 * 1/1.
87 *
88 * @return true or false, depending on whether this instance is equal to
89 * 1/1.
90 */
91 public boolean isOne() {
92 return num == 1 && denom == 1;
93 }
94
95 /**
96 * Numerator
97 */
98 private int num = 1;
99
100 /**
101 * Denominator
102 */
103 private int denom = 1;
104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698