Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: src/core/SkPath.cpp

Issue 88233003: Code cleanup following recapture of skps (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: More cleanup Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/core/SkPicture.h ('k') | src/core/SkPicture.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after
2042 const int byteCount = sizeof(int32_t) + fPathRef->writeSize(); 2042 const int byteCount = sizeof(int32_t) + fPathRef->writeSize();
2043 return SkAlign4(byteCount); 2043 return SkAlign4(byteCount);
2044 } 2044 }
2045 2045
2046 SkWBuffer buffer(storage); 2046 SkWBuffer buffer(storage);
2047 2047
2048 int32_t packed = (fConvexity << kConvexity_SerializationShift) | 2048 int32_t packed = (fConvexity << kConvexity_SerializationShift) |
2049 (fFillType << kFillType_SerializationShift) | 2049 (fFillType << kFillType_SerializationShift) |
2050 (fSegmentMask << kSegmentMask_SerializationShift) | 2050 (fSegmentMask << kSegmentMask_SerializationShift) |
2051 (fDirection << kDirection_SerializationShift) 2051 (fDirection << kDirection_SerializationShift)
2052 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO O 2052 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO O
2053 | (0x1 << kNewFormat_SerializationShift) 2053 | (0x1 << kNewFormat_SerializationShift)
2054 #endif 2054 #endif
2055 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO O
2056 | (0x1 << kNewFormat2_SerializationShift)
2057 #endif
2058 ; 2055 ;
2059 2056
2060 buffer.write32(packed); 2057 buffer.write32(packed);
2061 2058
2062 fPathRef->writeToBuffer(&buffer); 2059 fPathRef->writeToBuffer(&buffer);
2063 2060
2064 buffer.padToAlign4(); 2061 buffer.padToAlign4();
2065 return buffer.pos(); 2062 return buffer.pos();
2066 } 2063 }
2067 2064
2068 size_t SkPath::readFromMemory(const void* storage, size_t length) { 2065 size_t SkPath::readFromMemory(const void* storage, size_t length) {
2069 SkRBufferWithSizeCheck buffer(storage, length); 2066 SkRBufferWithSizeCheck buffer(storage, length);
2070 2067
2071 int32_t packed; 2068 int32_t packed;
2072 if (!buffer.readS32(&packed)) { 2069 if (!buffer.readS32(&packed)) {
2073 return 0; 2070 return 0;
2074 } 2071 }
2075 2072
2076 fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF; 2073 fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF;
2077 fFillType = (packed >> kFillType_SerializationShift) & 0xFF; 2074 fFillType = (packed >> kFillType_SerializationShift) & 0xFF;
2078 fSegmentMask = (packed >> kSegmentMask_SerializationShift) & 0xF; 2075 fSegmentMask = (packed >> kSegmentMask_SerializationShift) & 0xF;
2079 fDirection = (packed >> kDirection_SerializationShift) & 0x3; 2076 fDirection = (packed >> kDirection_SerializationShift) & 0x3;
2080 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO O 2077 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO O
2081 bool newFormat = (packed >> kNewFormat2_SerializationShift) & 1; 2078 bool newFormat = (packed >> kNewFormat_SerializationShift) & 1;
2082 #endif 2079 #endif
2083 2080
2084 SkPathRef* pathRef = SkPathRef::CreateFromBuffer(&buffer 2081 SkPathRef* pathRef = SkPathRef::CreateFromBuffer(&buffer
2085 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO O 2082 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO O
2086 , newFormat, packed 2083 , newFormat, packed
2087 #endif 2084 #endif
2088 ); 2085 );
2089 2086
2090 size_t sizeRead = 0; 2087 size_t sizeRead = 0;
2091 if (buffer.isValid()) { 2088 if (buffer.isValid()) {
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
2907 switch (this->getFillType()) { 2904 switch (this->getFillType()) {
2908 case SkPath::kEvenOdd_FillType: 2905 case SkPath::kEvenOdd_FillType:
2909 case SkPath::kInverseEvenOdd_FillType: 2906 case SkPath::kInverseEvenOdd_FillType:
2910 w &= 1; 2907 w &= 1;
2911 break; 2908 break;
2912 default: 2909 default:
2913 break; 2910 break;
2914 } 2911 }
2915 return SkToBool(w); 2912 return SkToBool(w);
2916 } 2913 }
OLDNEW
« no previous file with comments | « include/core/SkPicture.h ('k') | src/core/SkPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698