formalize named picture versions
BUG=skia:
R=mtklein@google.com, robertphillips@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/291913004
git-svn-id: http://skia.googlecode.com/svn/trunk@14807 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 7ac2f07..f3bf01b 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1,4 +1,3 @@
-
/*
* Copyright 2006 The Android Open Source Project
*
@@ -2182,9 +2181,8 @@
this->setStrokeMiter(read_scalar(pod));
this->setColor(*pod++);
- const int picVer = buffer.pictureVersion();
unsigned flatFlags = 0;
- if (picVer > 0 && picVer <= 22) {
+ if (buffer.isVersionLT(SkReadBuffer::kFilterLevelIsEnum_Version)) {
flatFlags = unpack_paint_flags_v22(this, *pod++);
} else {
flatFlags = unpack_paint_flags(this, *pod++);
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index 87cd941..8c77eeb 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -534,7 +534,7 @@
SkReadBuffer buffer(storage.get(), size);
buffer.setFlags(pictInfoFlagsToReadBufferFlags(fInfo.fFlags));
- buffer.setPictureVersion(fInfo.fVersion);
+ buffer.setVersion(fInfo.fVersion);
fFactoryPlayback->setupBuffer(buffer);
fTFPlayback.setupBuffer(buffer);
@@ -634,7 +634,7 @@
SkReadBuffer& buffer,
const SkPictInfo& info) {
SkAutoTDelete<SkPicturePlayback> playback(SkNEW_ARGS(SkPicturePlayback, (picture, info)));
- buffer.setPictureVersion(info.fVersion);
+ buffer.setVersion(info.fVersion);
if (!playback->parseBuffer(picture, buffer)) {
return NULL;
diff --git a/src/core/SkReadBuffer.cpp b/src/core/SkReadBuffer.cpp
index b4bc875..d016d9c 100644
--- a/src/core/SkReadBuffer.cpp
+++ b/src/core/SkReadBuffer.cpp
@@ -25,7 +25,7 @@
SkReadBuffer::SkReadBuffer() {
fFlags = default_flags();
- fPictureVersion = 0;
+ fVersion = 0;
fMemoryPtr = NULL;
fBitmapStorage = NULL;
@@ -43,7 +43,7 @@
SkReadBuffer::SkReadBuffer(const void* data, size_t size) {
fFlags = default_flags();
- fPictureVersion = 0;
+ fVersion = 0;
fReader.setMemory(data, size);
fMemoryPtr = NULL;
@@ -62,7 +62,7 @@
SkReadBuffer::SkReadBuffer(SkStream* stream) {
fFlags = default_flags();
- fPictureVersion = 0;
+ fVersion = 0;
const size_t length = stream->getLength();
fMemoryPtr = sk_malloc_throw(length);
stream->read(fMemoryPtr, length);
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp
index 6a418b6..9484db5 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -255,7 +255,7 @@
SkColorShader::SkColorShader(SkReadBuffer& b) : INHERITED(b) {
// V25_COMPATIBILITY_CODE We had a boolean to make the color shader inherit the paint's
// color. We don't support that any more.
- if (b.pictureVersion() < 26 && 0 != b.pictureVersion()) {
+ if (b.isVersionLT(SkReadBuffer::kColorShaderNoBool_Version)) {
if (b.readBool()) {
SkDEBUGFAIL("We shouldn't have pictures that recorded the inherited case.");
fColor = SK_ColorWHITE;