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

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

Issue 27392002: Remove SkColorTable from SkFlattenable hierarchy. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: reupload Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkColorTable.cpp ('k') | src/ports/SkGlobalInitialization_default.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 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 28 matching lines...) Expand all
39 void SkMallocPixelRef::onUnlockPixels() { 39 void SkMallocPixelRef::onUnlockPixels() {
40 // nothing to do 40 // nothing to do
41 } 41 }
42 42
43 void SkMallocPixelRef::flatten(SkFlattenableWriteBuffer& buffer) const { 43 void SkMallocPixelRef::flatten(SkFlattenableWriteBuffer& buffer) const {
44 this->INHERITED::flatten(buffer); 44 this->INHERITED::flatten(buffer);
45 45
46 buffer.writeByteArray(fStorage, fSize); 46 buffer.writeByteArray(fStorage, fSize);
47 buffer.writeBool(fCTable != NULL); 47 buffer.writeBool(fCTable != NULL);
48 if (fCTable) { 48 if (fCTable) {
49 buffer.writeFlattenable(fCTable); 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);
58 if (buffer.readBool()) { 58 if (buffer.readBool()) {
59 fCTable = buffer.readFlattenableT<SkColorTable>(); 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 }
OLDNEW
« no previous file with comments | « src/core/SkColorTable.cpp ('k') | src/ports/SkGlobalInitialization_default.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698