OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010, 2011 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 } | 395 } |
396 | 396 |
397 enum { | 397 enum { |
398 Shape1, | 398 Shape1, |
399 Shape2, | 399 Shape2, |
400 }; | 400 }; |
401 | 401 |
402 template<typename Operation> | 402 template<typename Operation> |
403 Region::Shape Region::Shape::shapeOperation(const Shape& shape1, const Shape& sh
ape2) | 403 Region::Shape Region::Shape::shapeOperation(const Shape& shape1, const Shape& sh
ape2) |
404 { | 404 { |
405 COMPILE_ASSERT(!(!Operation::shouldAddRemainingSegmentsFromSpan1 && Operatio
n::shouldAddRemainingSegmentsFromSpan2), invalid_segment_combination); | 405 static_assert(!(!Operation::shouldAddRemainingSegmentsFromSpan1 && Operation
::shouldAddRemainingSegmentsFromSpan2), "invalid segment combination"); |
406 COMPILE_ASSERT(!(!Operation::shouldAddRemainingSpansFromShape1 && Operation:
:shouldAddRemainingSpansFromShape2), invalid_span_combination); | 406 static_assert(!(!Operation::shouldAddRemainingSpansFromShape1 && Operation::
shouldAddRemainingSpansFromShape2), "invalid span combination"); |
407 | 407 |
408 size_t segmentsCapacity = shape1.segmentsSize() + shape2.segmentsSize(); | 408 size_t segmentsCapacity = shape1.segmentsSize() + shape2.segmentsSize(); |
409 size_t spansCapacity = shape1.spansSize() + shape2.spansSize(); | 409 size_t spansCapacity = shape1.spansSize() + shape2.spansSize(); |
410 Shape result(segmentsCapacity, spansCapacity); | 410 Shape result(segmentsCapacity, spansCapacity); |
411 if (Operation::trySimpleOperation(shape1, shape2, result)) | 411 if (Operation::trySimpleOperation(shape1, shape2, result)) |
412 return result; | 412 return result; |
413 | 413 |
414 SpanIterator spans1 = shape1.spansBegin(); | 414 SpanIterator spans1 = shape1.spansBegin(); |
415 SpanIterator spans1End = shape1.spansEnd(); | 415 SpanIterator spans1End = shape1.spansEnd(); |
416 | 416 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 m_bounds = m_shape.bounds(); | 622 m_bounds = m_shape.bounds(); |
623 } | 623 } |
624 | 624 |
625 void Region::translate(const IntSize& offset) | 625 void Region::translate(const IntSize& offset) |
626 { | 626 { |
627 m_bounds.move(offset); | 627 m_bounds.move(offset); |
628 m_shape.translate(offset); | 628 m_shape.translate(offset); |
629 } | 629 } |
630 | 630 |
631 } // namespace blink | 631 } // namespace blink |
OLD | NEW |