OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkBuffer.h" | 10 #include "SkBuffer.h" |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 SkDEBUGCODE(this->validate();) | 604 SkDEBUGCODE(this->validate();) |
605 int currVerb = 0; | 605 int currVerb = 0; |
606 const SkPoint* pts = fPathRef->points(); | 606 const SkPoint* pts = fPathRef->points(); |
607 const SkPoint* first = pts; | 607 const SkPoint* first = pts; |
608 if (!isRectContour(true, &currVerb, &pts, NULL, NULL)) { | 608 if (!isRectContour(true, &currVerb, &pts, NULL, NULL)) { |
609 return false; | 609 return false; |
610 } | 610 } |
611 const SkPoint* last = pts; | 611 const SkPoint* last = pts; |
612 SkRect testRects[2]; | 612 SkRect testRects[2]; |
613 if (isRectContour(false, &currVerb, &pts, NULL, NULL)) { | 613 if (isRectContour(false, &currVerb, &pts, NULL, NULL)) { |
614 testRects[0].set(first, last - first); | 614 testRects[0].set(first, SkToS32(last - first)); |
615 testRects[1].set(last, pts - last); | 615 testRects[1].set(last, SkToS32(pts - last)); |
616 if (testRects[0].contains(testRects[1])) { | 616 if (testRects[0].contains(testRects[1])) { |
617 if (rects) { | 617 if (rects) { |
618 rects[0] = testRects[0]; | 618 rects[0] = testRects[0]; |
619 rects[1] = testRects[1]; | 619 rects[1] = testRects[1]; |
620 } | 620 } |
621 return true; | 621 return true; |
622 } | 622 } |
623 if (testRects[1].contains(testRects[0])) { | 623 if (testRects[1].contains(testRects[0])) { |
624 if (rects) { | 624 if (rects) { |
625 rects[0] = testRects[1]; | 625 rects[0] = testRects[1]; |
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2077 (fSegmentMask << kSegmentMask_SerializationShift) | | 2077 (fSegmentMask << kSegmentMask_SerializationShift) | |
2078 (fDirection << kDirection_SerializationShift); | 2078 (fDirection << kDirection_SerializationShift); |
2079 | 2079 |
2080 buffer.write32(packed); | 2080 buffer.write32(packed); |
2081 | 2081 |
2082 fPathRef->writeToBuffer(&buffer); | 2082 fPathRef->writeToBuffer(&buffer); |
2083 | 2083 |
2084 buffer.write(&bounds, sizeof(bounds)); | 2084 buffer.write(&bounds, sizeof(bounds)); |
2085 | 2085 |
2086 buffer.padToAlign4(); | 2086 buffer.padToAlign4(); |
2087 return buffer.pos(); | 2087 return SkToU32(buffer.pos()); |
2088 } | 2088 } |
2089 | 2089 |
2090 uint32_t SkPath::readFromMemory(const void* storage) { | 2090 uint32_t SkPath::readFromMemory(const void* storage) { |
2091 SkRBuffer buffer(storage); | 2091 SkRBuffer buffer(storage); |
2092 #if !NEW_PICTURE_FORMAT | 2092 #if !NEW_PICTURE_FORMAT |
2093 int32_t pcount = buffer.readS32(); | 2093 int32_t pcount = buffer.readS32(); |
2094 int32_t vcount = buffer.readS32(); | 2094 int32_t vcount = buffer.readS32(); |
2095 #endif | 2095 #endif |
2096 | 2096 |
2097 uint32_t packed = buffer.readS32(); | 2097 uint32_t packed = buffer.readS32(); |
(...skipping 11 matching lines...) Expand all Loading... |
2109 #endif | 2109 #endif |
2110 | 2110 |
2111 buffer.read(&fBounds, sizeof(fBounds)); | 2111 buffer.read(&fBounds, sizeof(fBounds)); |
2112 fBoundsIsDirty = false; | 2112 fBoundsIsDirty = false; |
2113 | 2113 |
2114 buffer.skipToAlign4(); | 2114 buffer.skipToAlign4(); |
2115 | 2115 |
2116 GEN_ID_INC; | 2116 GEN_ID_INC; |
2117 | 2117 |
2118 SkDEBUGCODE(this->validate();) | 2118 SkDEBUGCODE(this->validate();) |
2119 return buffer.pos(); | 2119 return SkToU32(buffer.pos()); |
2120 } | 2120 } |
2121 | 2121 |
2122 /////////////////////////////////////////////////////////////////////////////// | 2122 /////////////////////////////////////////////////////////////////////////////// |
2123 | 2123 |
2124 #include "SkString.h" | 2124 #include "SkString.h" |
2125 | 2125 |
2126 static void append_scalar(SkString* str, SkScalar value) { | 2126 static void append_scalar(SkString* str, SkScalar value) { |
2127 SkString tmp; | 2127 SkString tmp; |
2128 tmp.printf("%g", value); | 2128 tmp.printf("%g", value); |
2129 if (tmp.contains('.')) { | 2129 if (tmp.contains('.')) { |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2960 switch (this->getFillType()) { | 2960 switch (this->getFillType()) { |
2961 case SkPath::kEvenOdd_FillType: | 2961 case SkPath::kEvenOdd_FillType: |
2962 case SkPath::kInverseEvenOdd_FillType: | 2962 case SkPath::kInverseEvenOdd_FillType: |
2963 w &= 1; | 2963 w &= 1; |
2964 break; | 2964 break; |
2965 default: | 2965 default: |
2966 break; | 2966 break; |
2967 } | 2967 } |
2968 return SkToBool(w); | 2968 return SkToBool(w); |
2969 } | 2969 } |
OLD | NEW |