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

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: Fixed up 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
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 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after
2077 const int byteCount = sizeof(int32_t) + fPathRef->writeSize(); 2077 const int byteCount = sizeof(int32_t) + fPathRef->writeSize();
2078 return SkAlign4(byteCount); 2078 return SkAlign4(byteCount);
2079 } 2079 }
2080 2080
2081 SkWBuffer buffer(storage); 2081 SkWBuffer buffer(storage);
2082 2082
2083 int32_t packed = ((fIsOval & 1) << kIsOval_SerializationShift) | 2083 int32_t packed = ((fIsOval & 1) << kIsOval_SerializationShift) |
2084 (fConvexity << kConvexity_SerializationShift) | 2084 (fConvexity << kConvexity_SerializationShift) |
2085 (fFillType << kFillType_SerializationShift) | 2085 (fFillType << kFillType_SerializationShift) |
2086 (fSegmentMask << kSegmentMask_SerializationShift) | 2086 (fSegmentMask << kSegmentMask_SerializationShift) |
2087 (fDirection << kDirection_SerializationShift) 2087 (fDirection << kDirection_SerializationShift);
2088 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO O
2089 | (0x1 << kNewFormat_SerializationShift)
2090 #endif
2091 ;
2092 2088
2093 buffer.write32(packed); 2089 buffer.write32(packed);
2094 2090
2095 fPathRef->writeToBuffer(&buffer); 2091 fPathRef->writeToBuffer(&buffer);
2096 2092
2097 buffer.padToAlign4(); 2093 buffer.padToAlign4();
2098 return buffer.pos(); 2094 return buffer.pos();
2099 } 2095 }
2100 2096
2101 size_t SkPath::readFromMemory(const void* storage, size_t length) { 2097 size_t SkPath::readFromMemory(const void* storage, size_t length) {
2102 SkRBufferWithSizeCheck buffer(storage, length); 2098 SkRBufferWithSizeCheck buffer(storage, length);
2103 2099
2104 int32_t packed; 2100 int32_t packed;
2105 if (!buffer.readS32(&packed)) { 2101 if (!buffer.readS32(&packed)) {
2106 return 0; 2102 return 0;
2107 } 2103 }
2108 2104
2109 fIsOval = (packed >> kIsOval_SerializationShift) & 1; 2105 fIsOval = (packed >> kIsOval_SerializationShift) & 1;
2110 fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF; 2106 fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF;
2111 fFillType = (packed >> kFillType_SerializationShift) & 0xFF; 2107 fFillType = (packed >> kFillType_SerializationShift) & 0xFF;
2112 fSegmentMask = (packed >> kSegmentMask_SerializationShift) & 0xF; 2108 fSegmentMask = (packed >> kSegmentMask_SerializationShift) & 0xF;
2113 fDirection = (packed >> kDirection_SerializationShift) & 0x3; 2109 fDirection = (packed >> kDirection_SerializationShift) & 0x3;
2114 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO O
2115 bool newFormat = (packed >> kNewFormat_SerializationShift) & 1;
2116 #endif
2117 2110
2118 SkPathRef* pathRef = SkPathRef::CreateFromBuffer(&buffer 2111 SkPathRef* pathRef = SkPathRef::CreateFromBuffer(&buffer);
2119 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO O
2120 , newFormat, packed
2121 #endif
2122 );
2123 2112
2124 size_t sizeRead = 0; 2113 size_t sizeRead = 0;
2125 if (buffer.isValid()) { 2114 if (buffer.isValid()) {
2126 fPathRef.reset(pathRef); 2115 fPathRef.reset(pathRef);
2127 SkDEBUGCODE(this->validate();) 2116 SkDEBUGCODE(this->validate();)
2128 buffer.skipToAlign4(); 2117 buffer.skipToAlign4();
2129 sizeRead = buffer.pos(); 2118 sizeRead = buffer.pos();
2130 } else if (NULL != pathRef) { 2119 } else if (NULL != pathRef) {
2131 // If the buffer is not valid, pathRef should be NULL 2120 // If the buffer is not valid, pathRef should be NULL
2132 sk_throw(); 2121 sk_throw();
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
2941 switch (this->getFillType()) { 2930 switch (this->getFillType()) {
2942 case SkPath::kEvenOdd_FillType: 2931 case SkPath::kEvenOdd_FillType:
2943 case SkPath::kInverseEvenOdd_FillType: 2932 case SkPath::kInverseEvenOdd_FillType:
2944 w &= 1; 2933 w &= 1;
2945 break; 2934 break;
2946 default: 2935 default:
2947 break; 2936 break;
2948 } 2937 }
2949 return SkToBool(w); 2938 return SkToBool(w);
2950 } 2939 }
OLDNEW
« include/core/SkPath.h ('K') | « include/core/SkPicture.h ('k') | src/core/SkPathRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698