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" | |
16 | 15 |
17 //////////////////////////////////////////////////////////////////////////// | 16 //////////////////////////////////////////////////////////////////////////// |
18 | 17 |
19 /** | 18 /** |
20 * Path.bounds is defined to be the bounds of all the control points. | 19 * Path.bounds is defined to be the bounds of all the control points. |
21 * If we called bounds.join(r) we would skip r if r was empty, which breaks | 20 * If we called bounds.join(r) we would skip r if r was empty, which breaks |
22 * our promise. Hence we have a custom joiner that doesn't look at emptiness | 21 * our promise. Hence we have a custom joiner that doesn't look at emptiness |
23 */ | 22 */ |
24 static void joinNoEmptyChecks(SkRect* dst, const SkRect& src) { | 23 static void joinNoEmptyChecks(SkRect* dst, const SkRect& src) { |
25 dst->fLeft = SkMinScalar(dst->fLeft, src.fLeft); | 24 dst->fLeft = SkMinScalar(dst->fLeft, src.fLeft); |
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 | 1873 |
1875 size_t SkPath::readFromMemory(const void* storage, size_t length) { | 1874 size_t SkPath::readFromMemory(const void* storage, size_t length) { |
1876 SkRBufferWithSizeCheck buffer(storage, length); | 1875 SkRBufferWithSizeCheck buffer(storage, length); |
1877 | 1876 |
1878 int32_t packed; | 1877 int32_t packed; |
1879 if (!buffer.readS32(&packed)) { | 1878 if (!buffer.readS32(&packed)) { |
1880 return 0; | 1879 return 0; |
1881 } | 1880 } |
1882 | 1881 |
1883 unsigned version = packed & 0xFF; | 1882 unsigned version = packed & 0xFF; |
1884 | 1883 |
1885 fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF; | 1884 fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF; |
1886 fFillType = (packed >> kFillType_SerializationShift) & 0xFF; | 1885 fFillType = (packed >> kFillType_SerializationShift) & 0xFF; |
1887 uint8_t dir = (packed >> kDirection_SerializationShift) & 0x3; | 1886 uint8_t dir = (packed >> kDirection_SerializationShift) & 0x3; |
1888 fIsVolatile = (packed >> kIsVolatile_SerializationShift) & 0x1; | 1887 fIsVolatile = (packed >> kIsVolatile_SerializationShift) & 0x1; |
1889 SkPathRef* pathRef = SkPathRef::CreateFromBuffer(&buffer); | 1888 SkPathRef* pathRef = SkPathRef::CreateFromBuffer(&buffer); |
1890 | 1889 |
1891 // compatibility check | 1890 // compatibility check |
1892 if (version < kPathPrivFirstDirection_Version) { | 1891 if (version < kPathPrivFirstDirection_Version) { |
1893 switch (dir) { // old values | 1892 switch (dir) { // old values |
1894 case 0: | 1893 case 0: |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2809 switch (this->getFillType()) { | 2808 switch (this->getFillType()) { |
2810 case SkPath::kEvenOdd_FillType: | 2809 case SkPath::kEvenOdd_FillType: |
2811 case SkPath::kInverseEvenOdd_FillType: | 2810 case SkPath::kInverseEvenOdd_FillType: |
2812 w &= 1; | 2811 w &= 1; |
2813 break; | 2812 break; |
2814 default: | 2813 default: |
2815 break; | 2814 break; |
2816 } | 2815 } |
2817 return SkToBool(w); | 2816 return SkToBool(w); |
2818 } | 2817 } |
OLD | NEW |