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

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

Issue 26702002: force readbuffer clients to use specialized readFoo for flattenables (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkFlattenableBuffers.cpp ('k') | src/core/SkImageFilter.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkFlattenableSerialization.h" 8 #include "SkFlattenableSerialization.h"
9 9
10 #include "SkData.h" 10 #include "SkData.h"
11 #include "SkFlattenable.h" 11 #include "SkFlattenable.h"
12 #include "SkImageFilter.h"
12 #include "SkOrderedReadBuffer.h" 13 #include "SkOrderedReadBuffer.h"
13 #include "SkOrderedWriteBuffer.h" 14 #include "SkOrderedWriteBuffer.h"
14 15
15 SkData* SkSerializeFlattenable(SkFlattenable* flattenable) { 16 SkData* SkSerializeFlattenable(SkFlattenable* flattenable) {
16 SkOrderedWriteBuffer writer(1024); 17 SkOrderedWriteBuffer writer(1024);
17 writer.setFlags(SkOrderedWriteBuffer::kCrossProcess_Flag); 18 writer.setFlags(SkOrderedWriteBuffer::kCrossProcess_Flag);
18 writer.writeFlattenable(flattenable); 19 writer.writeFlattenable(flattenable);
19 uint32_t size = writer.bytesWritten(); 20 uint32_t size = writer.bytesWritten();
20 void* data = sk_malloc_throw(size); 21 void* data = sk_malloc_throw(size);
21 writer.writeToMemory(data); 22 writer.writeToMemory(data);
22 return SkData::NewFromMalloc(data, size); 23 return SkData::NewFromMalloc(data, size);
23 } 24 }
24 25
26 // TODO: this guy should be renamed to ImageFilter, or take SkEffectType as
27 // a parameter.
25 SkFlattenable* SkDeserializeFlattenable(const void* data, size_t size) { 28 SkFlattenable* SkDeserializeFlattenable(const void* data, size_t size) {
26 SkOrderedReadBuffer buffer(data, size); 29 SkOrderedReadBuffer buffer(data, size);
27 return buffer.readFlattenable(); 30 return buffer.readImageFilter();
28 } 31 }
OLDNEW
« no previous file with comments | « src/core/SkFlattenableBuffers.cpp ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698