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

Unified Diff: src/core/SkValidatingReadBuffer.cpp

Issue 2334123003: Add SkColor4f serialization (Closed)
Patch Set: Switched to memcpy, rebased Created 4 years, 3 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/SkValidatingReadBuffer.h ('k') | src/core/SkWriteBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkValidatingReadBuffer.cpp
diff --git a/src/core/SkValidatingReadBuffer.cpp b/src/core/SkValidatingReadBuffer.cpp
index 1566af948819355cff8846cf0d022f687df8e139..d57e499cc198177dbfd4d364ebdd45df0c08374f 100644
--- a/src/core/SkValidatingReadBuffer.cpp
+++ b/src/core/SkValidatingReadBuffer.cpp
@@ -110,6 +110,13 @@ void SkValidatingReadBuffer::readString(SkString* string) {
}
}
+void SkValidatingReadBuffer::readColor4f(SkColor4f* color) {
+ const void* ptr = this->skip(sizeof(SkColor4f));
+ if (!fError) {
+ memcpy(color, ptr, sizeof(SkColor4f));
+ }
+}
+
void SkValidatingReadBuffer::readPoint(SkPoint* point) {
point->fX = this->readScalar();
point->fY = this->readScalar();
@@ -197,6 +204,10 @@ bool SkValidatingReadBuffer::readColorArray(SkColor* colors, size_t size) {
return readArray(colors, size, sizeof(SkColor));
}
+bool SkValidatingReadBuffer::readColor4fArray(SkColor4f* colors, size_t size) {
+ return readArray(colors, size, sizeof(SkColor4f));
+}
+
bool SkValidatingReadBuffer::readIntArray(int32_t* values, size_t size) {
return readArray(values, size, sizeof(int32_t));
}
« no previous file with comments | « src/core/SkValidatingReadBuffer.h ('k') | src/core/SkWriteBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698