| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 if (!m_ranges.size()) { | 65 if (!m_ranges.size()) { |
| 66 inverted->add(negInf, posInf); | 66 inverted->add(negInf, posInf); |
| 67 } else { | 67 } else { |
| 68 double start = m_ranges.first().m_start; | 68 double start = m_ranges.first().m_start; |
| 69 if (start != negInf) | 69 if (start != negInf) |
| 70 inverted->add(negInf, start); | 70 inverted->add(negInf, start); |
| 71 | 71 |
| 72 for (size_t index = 0; index + 1 < m_ranges.size(); ++index) | 72 for (size_t index = 0; index + 1 < m_ranges.size(); ++index) |
| 73 inverted->add(m_ranges[index].m_end, m_ranges[index + 1].m_start); | 73 inverted->add(m_ranges[index].m_end, m_ranges[index + 1].m_start); |
| 74 | 74 |
| 75 double end = m_ranges.last().m_end; | 75 double end = m_ranges.back().m_end; |
| 76 if (end != posInf) | 76 if (end != posInf) |
| 77 inverted->add(end, posInf); | 77 inverted->add(end, posInf); |
| 78 } | 78 } |
| 79 | 79 |
| 80 m_ranges.swap(inverted->m_ranges); | 80 m_ranges.swap(inverted->m_ranges); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void TimeRanges::intersectWith(const TimeRanges* other) { | 83 void TimeRanges::intersectWith(const TimeRanges* other) { |
| 84 DCHECK(other); | 84 DCHECK(other); |
| 85 | 85 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 if (delta < bestDelta || | 202 if (delta < bestDelta || |
| 203 (delta == bestDelta && | 203 (delta == bestDelta && |
| 204 std::abs(currentPlaybackPosition - match) < | 204 std::abs(currentPlaybackPosition - match) < |
| 205 std::abs(currentPlaybackPosition - bestMatch))) { | 205 std::abs(currentPlaybackPosition - bestMatch))) { |
| 206 bestDelta = delta; | 206 bestDelta = delta; |
| 207 bestMatch = match; | 207 bestMatch = match; |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 return bestMatch; | 210 return bestMatch; |
| 211 } | 211 } |
| OLD | NEW |