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

Unified Diff: src/core/SkWriteBuffer.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/SkWriteBuffer.cpp
diff --git a/src/core/SkWriteBuffer.cpp b/src/core/SkWriteBuffer.cpp
index 1159ef3383fef5603d08bbf046a8a47e2cd9a446..34ef24bfe10713c4be18f90c0dc3da5e269bad2a 100644
--- a/src/core/SkWriteBuffer.cpp
+++ b/src/core/SkWriteBuffer.cpp
@@ -78,6 +78,19 @@ void SkBinaryWriteBuffer::writeColorArray(const SkColor* color, uint32_t count)
fWriter.write(color, count * sizeof(SkColor));
}
+static_assert(SK_SCALAR_IS_FLOAT, "Color4f serialization needs updating");
+void SkBinaryWriteBuffer::writeColor4f(const SkColor4f& color) {
reed1 2016/09/13 23:18:07 I've bee using just write to make these simpler/fa
+ fWriter.writeScalar(color.fR);
+ fWriter.writeScalar(color.fG);
+ fWriter.writeScalar(color.fB);
+ fWriter.writeScalar(color.fA);
+}
+
+void SkBinaryWriteBuffer::writeColor4fArray(const SkColor4f* color, uint32_t count) {
+ fWriter.write32(count);
+ fWriter.write(color, count * sizeof(SkColor4f));
+}
+
void SkBinaryWriteBuffer::writePoint(const SkPoint& point) {
fWriter.writeScalar(point.fX);
fWriter.writeScalar(point.fY);

Powered by Google App Engine
This is Rietveld 408576698