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

Unified Diff: src/core/SkDataTable.cpp

Issue 26223009: Remove SkDataTable from SkFlattenable hierarchy. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkDataTable.h ('k') | tests/DataRefTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDataTable.cpp
diff --git a/src/core/SkDataTable.cpp b/src/core/SkDataTable.cpp
index 608d147024385bd62f3bf28b87e2be1c566c0b65..917445c98fe7dfb66f44eed7d65355934a6db8da 100644
--- a/src/core/SkDataTable.cpp
+++ b/src/core/SkDataTable.cpp
@@ -7,7 +7,6 @@
#include "SkData.h"
#include "SkDataTable.h"
-#include "SkFlattenableBuffers.h"
SK_DEFINE_INST_COUNT(SkDataTable)
@@ -77,65 +76,6 @@ const void* SkDataTable::at(int index, size_t* size) const {
}
}
-SkDataTable::SkDataTable(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {
- fElemSize = 0;
- fU.fElems = NULL;
- fFreeProc = NULL;
- fFreeProcContext = NULL;
-
- fCount = buffer.read32();
- if (fCount) {
- fElemSize = buffer.read32();
- if (fElemSize) {
- size_t size = buffer.getArrayCount();
- // size is the size of our elems data
- SkASSERT(fCount * fElemSize == size);
- void* addr = sk_malloc_throw(size);
- if (buffer.readByteArray(addr) != size) {
- sk_throw();
- }
- fU.fElems = (const char*)addr;
- fFreeProcContext = addr;
- } else {
- size_t dataSize = buffer.read32();
-
- size_t allocSize = fCount * sizeof(Dir) + dataSize;
- void* addr = sk_malloc_throw(allocSize);
- Dir* dir = (Dir*)addr;
- char* elem = (char*)(dir + fCount);
- for (int i = 0; i < fCount; ++i) {
- dir[i].fPtr = elem;
- dir[i].fSize = buffer.readByteArray(elem);
- elem += dir[i].fSize;
- }
- fU.fDir = dir;
- fFreeProcContext = addr;
- }
- fFreeProc = malloc_freeproc;
- }
-}
-
-void SkDataTable::flatten(SkFlattenableWriteBuffer& buffer) const {
- this->INHERITED::flatten(buffer);
-
- buffer.write32(fCount);
- if (fCount) {
- buffer.write32(fElemSize);
- if (fElemSize) {
- buffer.writeByteArray(fU.fElems, fCount * fElemSize);
- } else {
- size_t dataSize = 0;
- for (int i = 0; i < fCount; ++i) {
- dataSize += fU.fDir[i].fSize;
- }
- buffer.write32(dataSize);
- for (int i = 0; i < fCount; ++i) {
- buffer.writeByteArray(fU.fDir[i].fPtr, fU.fDir[i].fSize);
- }
- }
- }
-}
-
///////////////////////////////////////////////////////////////////////////////
SkDataTable* SkDataTable::NewEmpty() {
« no previous file with comments | « include/core/SkDataTable.h ('k') | tests/DataRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698