Fix test to use the flattenable writer class instead of

flattening the object directly.
Review URL: https://codereview.appspot.com/5901059

git-svn-id: http://skia.googlecode.com/svn/trunk@3490 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
djsollen@google.com 2012-03-26 15:52:10 +00:00
parent fdf6eb75ab
commit cefc865090

View File

@ -12,13 +12,8 @@
#include "SkXfermode.h"
static SkFlattenable* reincarnate_flattenable(SkFlattenable* obj) {
SkFlattenable::Factory fact = obj->getFactory();
if (NULL == fact) {
return NULL;
}
SkFlattenableWriteBuffer wb(1024);
obj->flatten(wb);
wb.writeFlattenable(obj);
size_t size = wb.size();
SkAutoSMalloc<1024> storage(size);
@ -26,7 +21,7 @@ static SkFlattenable* reincarnate_flattenable(SkFlattenable* obj) {
wb.flatten(storage.get());
SkFlattenableReadBuffer rb(storage.get(), size);
return fact(rb);
return rb.readFlattenable();
}
template <typename T> T* reincarnate(T* obj) {