Snap for 6533464 from 5d4e25e03b4dcc5c16a253d593d896de9b993a65 to sdk-release
Change-Id: I9a897ac8838740495d02a9983e481d6e4eace056
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..5c3f89c
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,3 @@
+third_party {
+ license_type: RECIPROCAL
+}
diff --git a/src/core/SkRecord.h b/src/core/SkRecord.h
index 088975b..feabec8 100644
--- a/src/core/SkRecord.h
+++ b/src/core/SkRecord.h
@@ -141,22 +141,20 @@
// A typed pointer to some bytes in fAlloc. visit() and mutate() allow polymorphic dispatch.
struct Record {
- // On 32-bit machines we store type in 4 bytes, followed by a pointer. Simple.
- // On 64-bit machines we store a pointer with the type slotted into two top (unused) bytes.
- // FWIW, SkRecords::Type is tiny. It can easily fit in one byte.
- uint64_t fTypeAndPtr;
- static const int kTypeShift = sizeof(void*) == 4 ? 32 : 48;
+ SkRecords::Type fType;
+ void* fPtr;
// Point this record to its data in fAlloc. Returns ptr for convenience.
template <typename T>
T* set(T* ptr) {
- fTypeAndPtr = ((uint64_t)T::kType) << kTypeShift | (uintptr_t)ptr;
+ fType = T::kType;
+ fPtr = ptr;
SkASSERT(this->ptr() == ptr && this->type() == T::kType);
return ptr;
}
- SkRecords::Type type() const { return (SkRecords::Type)(fTypeAndPtr >> kTypeShift); }
- void* ptr() const { return (void*)(fTypeAndPtr & ((1ull<<kTypeShift)-1)); }
+ SkRecords::Type type() const { return fType; }
+ void* ptr() const { return fPtr; }
// Visit this record with functor F (see public API above).
template <typename F>