OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBuffer.h" | 8 #include "SkBuffer.h" |
9 #include "SkErrorInternals.h" | 9 #include "SkErrorInternals.h" |
10 #include "SkGeometry.h" | 10 #include "SkGeometry.h" |
11 #include "SkMath.h" | 11 #include "SkMath.h" |
12 #include "SkPathPriv.h" | 12 #include "SkPathPriv.h" |
13 #include "SkPathRef.h" | 13 #include "SkPathRef.h" |
14 #include "SkRRect.h" | 14 #include "SkRRect.h" |
| 15 #include "SkThread.h" |
15 | 16 |
16 //////////////////////////////////////////////////////////////////////////// | 17 //////////////////////////////////////////////////////////////////////////// |
17 | 18 |
18 /** | 19 /** |
19 * Path.bounds is defined to be the bounds of all the control points. | 20 * Path.bounds is defined to be the bounds of all the control points. |
20 * If we called bounds.join(r) we would skip r if r was empty, which breaks | 21 * If we called bounds.join(r) we would skip r if r was empty, which breaks |
21 * our promise. Hence we have a custom joiner that doesn't look at emptiness | 22 * our promise. Hence we have a custom joiner that doesn't look at emptiness |
22 */ | 23 */ |
23 static void joinNoEmptyChecks(SkRect* dst, const SkRect& src) { | 24 static void joinNoEmptyChecks(SkRect* dst, const SkRect& src) { |
24 dst->fLeft = SkMinScalar(dst->fLeft, src.fLeft); | 25 dst->fLeft = SkMinScalar(dst->fLeft, src.fLeft); |
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1873 | 1874 |
1874 size_t SkPath::readFromMemory(const void* storage, size_t length) { | 1875 size_t SkPath::readFromMemory(const void* storage, size_t length) { |
1875 SkRBufferWithSizeCheck buffer(storage, length); | 1876 SkRBufferWithSizeCheck buffer(storage, length); |
1876 | 1877 |
1877 int32_t packed; | 1878 int32_t packed; |
1878 if (!buffer.readS32(&packed)) { | 1879 if (!buffer.readS32(&packed)) { |
1879 return 0; | 1880 return 0; |
1880 } | 1881 } |
1881 | 1882 |
1882 unsigned version = packed & 0xFF; | 1883 unsigned version = packed & 0xFF; |
1883 | 1884 |
1884 fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF; | 1885 fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF; |
1885 fFillType = (packed >> kFillType_SerializationShift) & 0xFF; | 1886 fFillType = (packed >> kFillType_SerializationShift) & 0xFF; |
1886 uint8_t dir = (packed >> kDirection_SerializationShift) & 0x3; | 1887 uint8_t dir = (packed >> kDirection_SerializationShift) & 0x3; |
1887 fIsVolatile = (packed >> kIsVolatile_SerializationShift) & 0x1; | 1888 fIsVolatile = (packed >> kIsVolatile_SerializationShift) & 0x1; |
1888 SkPathRef* pathRef = SkPathRef::CreateFromBuffer(&buffer); | 1889 SkPathRef* pathRef = SkPathRef::CreateFromBuffer(&buffer); |
1889 | 1890 |
1890 // compatibility check | 1891 // compatibility check |
1891 if (version < kPathPrivFirstDirection_Version) { | 1892 if (version < kPathPrivFirstDirection_Version) { |
1892 switch (dir) { // old values | 1893 switch (dir) { // old values |
1893 case 0: | 1894 case 0: |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2808 switch (this->getFillType()) { | 2809 switch (this->getFillType()) { |
2809 case SkPath::kEvenOdd_FillType: | 2810 case SkPath::kEvenOdd_FillType: |
2810 case SkPath::kInverseEvenOdd_FillType: | 2811 case SkPath::kInverseEvenOdd_FillType: |
2811 w &= 1; | 2812 w &= 1; |
2812 break; | 2813 break; |
2813 default: | 2814 default: |
2814 break; | 2815 break; |
2815 } | 2816 } |
2816 return SkToBool(w); | 2817 return SkToBool(w); |
2817 } | 2818 } |
OLD | NEW |