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

Unified Diff: src/core/SkFlattenableBuffers.cpp

Issue 134163010: Refactor read and write buffers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: whoops, read buffers have .size() Created 6 years, 11 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 | « src/core/SkFlattenable.cpp ('k') | src/core/SkFlattenableSerialization.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkFlattenableBuffers.cpp
diff --git a/src/core/SkFlattenableBuffers.cpp b/src/core/SkFlattenableBuffers.cpp
deleted file mode 100644
index fc38529ef7909d4ff726b5561e56e4344767640a..0000000000000000000000000000000000000000
--- a/src/core/SkFlattenableBuffers.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "SkFlattenableBuffers.h"
-#include "SkPaint.h"
-#include "SkTypeface.h"
-
-#include "SkColorFilter.h"
-#include "SkDrawLooper.h"
-#include "SkImageFilter.h"
-#include "SkMaskFilter.h"
-#include "SkPathEffect.h"
-#include "SkPixelRef.h"
-#include "SkRasterizer.h"
-#include "SkShader.h"
-#include "SkUnitMapper.h"
-#include "SkXfermode.h"
-
-SkFlattenableReadBuffer::SkFlattenableReadBuffer() {
- // Set default values. These should be explicitly set by our client
- // via setFlags() if the buffer came from serialization.
- fFlags = 0;
- // TODO: remove this flag, since we're always floats (now)
- fFlags |= kScalarIsFloat_Flag;
- if (8 == sizeof(void*)) {
- fFlags |= kPtrIs64Bit_Flag;
- }
-}
-
-SkFlattenableReadBuffer::~SkFlattenableReadBuffer() { }
-
-void* SkFlattenableReadBuffer::readFunctionPtr() {
- void* proc;
- SkASSERT(sizeof(void*) == this->getArrayCount());
- this->readByteArray(&proc, sizeof(void*));
- return proc;
-}
-
-void SkFlattenableReadBuffer::readPaint(SkPaint* paint) {
- paint->unflatten(*this);
-}
-
-template <typename T> T* SkFlattenableReadBuffer::readFlattenableT() {
- return static_cast<T*>(this->readFlattenable(T::GetFlattenableType()));
-}
-
-SkColorFilter* SkFlattenableReadBuffer::readColorFilter() {
- return this->readFlattenableT<SkColorFilter>();
-}
-
-SkDrawLooper* SkFlattenableReadBuffer::readDrawLooper() {
- return this->readFlattenableT<SkDrawLooper>();
-}
-
-SkImageFilter* SkFlattenableReadBuffer::readImageFilter() {
- return this->readFlattenableT<SkImageFilter>();
-}
-
-SkMaskFilter* SkFlattenableReadBuffer::readMaskFilter() {
- return this->readFlattenableT<SkMaskFilter>();
-}
-
-SkPathEffect* SkFlattenableReadBuffer::readPathEffect() {
- return this->readFlattenableT<SkPathEffect>();
-}
-
-SkPixelRef* SkFlattenableReadBuffer::readPixelRef() {
- return this->readFlattenableT<SkPixelRef>();
-}
-
-SkRasterizer* SkFlattenableReadBuffer::readRasterizer() {
- return this->readFlattenableT<SkRasterizer>();
-}
-
-SkShader* SkFlattenableReadBuffer::readShader() {
- return this->readFlattenableT<SkShader>();
-}
-
-SkUnitMapper* SkFlattenableReadBuffer::readUnitMapper() {
- return this->readFlattenableT<SkUnitMapper>();
-}
-
-SkXfermode* SkFlattenableReadBuffer::readXfermode() {
- return this->readFlattenableT<SkXfermode>();
-}
-
-bool SkFlattenableReadBuffer::validate(bool isValid) {
- return true;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-SkFlattenableWriteBuffer::SkFlattenableWriteBuffer() {
- fFlags = (Flags)0;
-}
-
-SkFlattenableWriteBuffer::~SkFlattenableWriteBuffer() { }
-
-void SkFlattenableWriteBuffer::writeFunctionPtr(void* ptr) {
- void* ptrStorage[] = { ptr };
- this->writeByteArray(ptrStorage, sizeof(void*));
-}
-
-void SkFlattenableWriteBuffer::writePaint(const SkPaint& paint) {
- paint.flatten(*this);
-}
-
-void SkFlattenableWriteBuffer::flattenObject(const SkFlattenable* obj,
- SkFlattenableWriteBuffer& buffer) {
- obj->flatten(buffer);
-}
« no previous file with comments | « src/core/SkFlattenable.cpp ('k') | src/core/SkFlattenableSerialization.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698