OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 "SkMallocPixelRef.h" | 8 #include "SkMallocPixelRef.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkFlattenableBuffers.h" | 10 #include "SkFlattenableBuffers.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 buffer.writeBool(fCTable != NULL); | 47 buffer.writeBool(fCTable != NULL); |
48 if (fCTable) { | 48 if (fCTable) { |
49 fCTable->writeToBuffer(buffer); | 49 fCTable->writeToBuffer(buffer); |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 SkMallocPixelRef::SkMallocPixelRef(SkFlattenableReadBuffer& buffer) | 53 SkMallocPixelRef::SkMallocPixelRef(SkFlattenableReadBuffer& buffer) |
54 : INHERITED(buffer, NULL) { | 54 : INHERITED(buffer, NULL) { |
55 fSize = buffer.getArrayCount(); | 55 fSize = buffer.getArrayCount(); |
56 fStorage = sk_malloc_throw(fSize); | 56 fStorage = sk_malloc_throw(fSize); |
57 buffer.readByteArray(fStorage); | 57 buffer.readByteArray(fStorage, fSize); |
58 if (buffer.readBool()) { | 58 if (buffer.readBool()) { |
59 fCTable = SkNEW_ARGS(SkColorTable, (buffer)); | 59 fCTable = SkNEW_ARGS(SkColorTable, (buffer)); |
60 } else { | 60 } else { |
61 fCTable = NULL; | 61 fCTable = NULL; |
62 } | 62 } |
63 fOwnPixels = true; | 63 fOwnPixels = true; |
64 | 64 |
65 this->setPreLocked(fStorage, fCTable); | 65 this->setPreLocked(fStorage, fCTable); |
66 } | 66 } |
OLD | NEW |