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

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

Issue 143883006: No deduping dictionaries for matrices and regions. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: bump picture version Created 6 years, 11 months 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
« no previous file with comments | « include/core/SkPicture.h ('k') | src/core/SkPathRef.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 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 2051
2052 if (NULL == storage) { 2052 if (NULL == storage) {
2053 const int byteCount = sizeof(int32_t) + fPathRef->writeSize(); 2053 const int byteCount = sizeof(int32_t) + fPathRef->writeSize();
2054 return SkAlign4(byteCount); 2054 return SkAlign4(byteCount);
2055 } 2055 }
2056 2056
2057 SkWBuffer buffer(storage); 2057 SkWBuffer buffer(storage);
2058 2058
2059 int32_t packed = (fConvexity << kConvexity_SerializationShift) | 2059 int32_t packed = (fConvexity << kConvexity_SerializationShift) |
2060 (fFillType << kFillType_SerializationShift) | 2060 (fFillType << kFillType_SerializationShift) |
2061 (fDirection << kDirection_SerializationShift) 2061 (fDirection << kDirection_SerializationShift);
2062 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO O
2063 | (0x1 << kNewFormat_SerializationShift)
2064 #endif
2065 ;
2066 2062
2067 buffer.write32(packed); 2063 buffer.write32(packed);
2068 2064
2069 fPathRef->writeToBuffer(&buffer); 2065 fPathRef->writeToBuffer(&buffer);
2070 2066
2071 buffer.padToAlign4(); 2067 buffer.padToAlign4();
2072 return buffer.pos(); 2068 return buffer.pos();
2073 } 2069 }
2074 2070
2075 size_t SkPath::readFromMemory(const void* storage, size_t length) { 2071 size_t SkPath::readFromMemory(const void* storage, size_t length) {
2076 SkRBufferWithSizeCheck buffer(storage, length); 2072 SkRBufferWithSizeCheck buffer(storage, length);
2077 2073
2078 int32_t packed; 2074 int32_t packed;
2079 if (!buffer.readS32(&packed)) { 2075 if (!buffer.readS32(&packed)) {
2080 return 0; 2076 return 0;
2081 } 2077 }
2082 2078
2083 fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF; 2079 fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF;
2084 fFillType = (packed >> kFillType_SerializationShift) & 0xFF; 2080 fFillType = (packed >> kFillType_SerializationShift) & 0xFF;
2085 fDirection = (packed >> kDirection_SerializationShift) & 0x3; 2081 fDirection = (packed >> kDirection_SerializationShift) & 0x3;
2086 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO O 2082 SkPathRef* pathRef = SkPathRef::CreateFromBuffer(&buffer);
2087 bool newFormat = (packed >> kNewFormat_SerializationShift) & 1;
2088 #endif
2089
2090 SkPathRef* pathRef = SkPathRef::CreateFromBuffer(&buffer
2091 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TO O
2092 , newFormat, packed
2093 #endif
2094 );
2095 2083
2096 size_t sizeRead = 0; 2084 size_t sizeRead = 0;
2097 if (buffer.isValid()) { 2085 if (buffer.isValid()) {
2098 fPathRef.reset(pathRef); 2086 fPathRef.reset(pathRef);
2099 SkDEBUGCODE(this->validate();) 2087 SkDEBUGCODE(this->validate();)
2100 buffer.skipToAlign4(); 2088 buffer.skipToAlign4();
2101 sizeRead = buffer.pos(); 2089 sizeRead = buffer.pos();
2102 } else if (NULL != pathRef) { 2090 } else if (NULL != pathRef) {
2103 // If the buffer is not valid, pathRef should be NULL 2091 // If the buffer is not valid, pathRef should be NULL
2104 sk_throw(); 2092 sk_throw();
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
2885 switch (this->getFillType()) { 2873 switch (this->getFillType()) {
2886 case SkPath::kEvenOdd_FillType: 2874 case SkPath::kEvenOdd_FillType:
2887 case SkPath::kInverseEvenOdd_FillType: 2875 case SkPath::kInverseEvenOdd_FillType:
2888 w &= 1; 2876 w &= 1;
2889 break; 2877 break;
2890 default: 2878 default:
2891 break; 2879 break;
2892 } 2880 }
2893 return SkToBool(w); 2881 return SkToBool(w);
2894 } 2882 }
OLDNEW
« no previous file with comments | « include/core/SkPicture.h ('k') | src/core/SkPathRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698