Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 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 #include "SkFlattenableBuffers.h" | 8 #include "SkFlattenableBuffers.h" |
| 9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
| 10 #include "SkTypeface.h" | 10 #include "SkTypeface.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 if (8 == sizeof(void*)) { | 30 if (8 == sizeof(void*)) { |
| 31 fFlags |= kPtrIs64Bit_Flag; | 31 fFlags |= kPtrIs64Bit_Flag; |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 SkFlattenableReadBuffer::~SkFlattenableReadBuffer() { } | 35 SkFlattenableReadBuffer::~SkFlattenableReadBuffer() { } |
| 36 | 36 |
| 37 void* SkFlattenableReadBuffer::readFunctionPtr() { | 37 void* SkFlattenableReadBuffer::readFunctionPtr() { |
| 38 void* proc; | 38 void* proc; |
| 39 SkASSERT(sizeof(void*) == this->getArrayCount()); | 39 SkASSERT(sizeof(void*) == this->getArrayCount()); |
| 40 this->readByteArray(&proc); | 40 this->readByteArray(&proc, sizeof(void*)); |
|
Tom Sepez
2013/11/08 20:59:01
drive-by: Code like this always scares the crap ou
sugoi
2013/11/08 21:31:16
Thanks for your comment ! Yes, code like this was
| |
| 41 return proc; | 41 return proc; |
| 42 } | 42 } |
| 43 | 43 |
| 44 void SkFlattenableReadBuffer::readPaint(SkPaint* paint) { | 44 void SkFlattenableReadBuffer::readPaint(SkPaint* paint) { |
| 45 paint->unflatten(*this); | 45 paint->unflatten(*this); |
| 46 } | 46 } |
| 47 | 47 |
| 48 template <typename T> T* SkFlattenableReadBuffer::readFlattenableT() { | 48 template <typename T> T* SkFlattenableReadBuffer::readFlattenableT() { |
| 49 return static_cast<T*>(this->readFlattenable(T::GetFlattenableType())); | 49 return static_cast<T*>(this->readFlattenable(T::GetFlattenableType())); |
| 50 } | 50 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 } | 103 } |
| 104 | 104 |
| 105 void SkFlattenableWriteBuffer::writePaint(const SkPaint& paint) { | 105 void SkFlattenableWriteBuffer::writePaint(const SkPaint& paint) { |
| 106 paint.flatten(*this); | 106 paint.flatten(*this); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void SkFlattenableWriteBuffer::flattenObject(const SkFlattenable* obj, | 109 void SkFlattenableWriteBuffer::flattenObject(const SkFlattenable* obj, |
| 110 SkFlattenableWriteBuffer& buffer) { | 110 SkFlattenableWriteBuffer& buffer) { |
| 111 obj->flatten(buffer); | 111 obj->flatten(buffer); |
| 112 } | 112 } |
| OLD | NEW |