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

Unified Diff: src/core/SkValidatingReadBuffer.cpp

Issue 2334123003: Add SkColor4f serialization (Closed)
Patch Set: Fix stack overflow in test 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
Index: src/core/SkValidatingReadBuffer.cpp
diff --git a/src/core/SkValidatingReadBuffer.cpp b/src/core/SkValidatingReadBuffer.cpp
index 326d0cf5754f5c66747aa74c53ccb25fabebaf59..0018dbb36f5e58df8f443c8adf4e664b5a0fa898 100644
--- a/src/core/SkValidatingReadBuffer.cpp
+++ b/src/core/SkValidatingReadBuffer.cpp
@@ -110,6 +110,14 @@ void SkValidatingReadBuffer::readString(SkString* string) {
}
}
+static_assert(SK_SCALAR_IS_FLOAT, "Color4f serialization needs updating");
+void SkValidatingReadBuffer::readColor4f(SkColor4f* color) {
+ color->fR = this->readScalar();
+ color->fG = this->readScalar();
+ color->fB = this->readScalar();
+ color->fA = this->readScalar();
+}
+
void SkValidatingReadBuffer::readPoint(SkPoint* point) {
point->fX = this->readScalar();
point->fY = this->readScalar();
@@ -192,6 +200,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));
}

Powered by Google App Engine
This is Rietveld 408576698