projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix mis-timed subtitles with non-zero video PTS offsets.
[dcpomatic.git]
/
src
/
lib
/
types.cc
diff --git
a/src/lib/types.cc
b/src/lib/types.cc
index 78cb4cd6490990bee12d75526c4a6178530152ff..bc4f5f8d9d425d0d9305f1015c124ee92590dcb7 100644
(file)
--- a/
src/lib/types.cc
+++ b/
src/lib/types.cc
@@
-21,6
+21,7
@@
using std::max;
using std::min;
using std::max;
using std::min;
+using std::string;
bool operator== (Crop const & a, Crop const & b)
{
bool operator== (Crop const & a, Crop const & b)
{
@@
-32,25
+33,35
@@
bool operator!= (Crop const & a, Crop const & b)
return !(a == b);
}
return !(a == b);
}
-
-/** @param other A Rect.
- * @return The intersection of this with `other'.
+/** @param r Resolution.
+ * @return Untranslated string representation.
*/
*/
-dcpomatic::Rect
-dcpomatic::Rect::intersection (Rect const & other) const
+string
+resolution_to_string (Resolution r)
{
{
- int const tx = max (x, other.x);
- int const ty = max (y, other.y);
-
- return Rect (
- tx, ty,
- min (x + width, other.x + other.width) - tx,
- min (y + height, other.y + other.height) - ty
- );
+ switch (r) {
+ case RESOLUTION_2K:
+ return "2K";
+ case RESOLUTION_4K:
+ return "4K";
+ }
+
+ assert (false);
+ return "";
}
}
-bool
-dcpomatic::Rect::contains (Position p) const
+
+Resolution
+string_to_resolution (string s)
{
{
- return (p.x >= x && p.x <= (x + width) && p.y >= y && p.y <= (y + height));
+ if (s == "2K") {
+ return RESOLUTION_2K;
+ }
+
+ if (s == "4K") {
+ return RESOLUTION_4K;
+ }
+
+ assert (false);
+ return RESOLUTION_2K;
}
}