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

Unified Diff: src/core/SkColorShader.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 | « include/core/SkWriteBuffer.h ('k') | src/core/SkReadBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorShader.cpp
diff --git a/src/core/SkColorShader.cpp b/src/core/SkColorShader.cpp
index d8c9f29327241e585b5f884e388547421e97c1e2..cfa071fed8d4505efb6c8805813ea35c5c2f7814 100644
--- a/src/core/SkColorShader.cpp
+++ b/src/core/SkColorShader.cpp
@@ -130,10 +130,7 @@ SkColor4Shader::SkColor4Shader(const SkColor4f& color, sk_sp<SkColorSpace> space
sk_sp<SkFlattenable> SkColor4Shader::CreateProc(SkReadBuffer& buffer) {
SkColor4f color;
- color.fR = buffer.readScalar(); // readFloat()
- color.fG = buffer.readScalar();
- color.fB = buffer.readScalar();
- color.fA = buffer.readScalar();
+ buffer.readColor4f(&color);
if (buffer.readBool()) {
// TODO how do we unflatten colorspaces
}
@@ -141,10 +138,7 @@ sk_sp<SkFlattenable> SkColor4Shader::CreateProc(SkReadBuffer& buffer) {
}
void SkColor4Shader::flatten(SkWriteBuffer& buffer) const {
- buffer.writeScalar(fColor4.fR); // writeFloat()
- buffer.writeScalar(fColor4.fG);
- buffer.writeScalar(fColor4.fB);
- buffer.writeScalar(fColor4.fA);
+ buffer.writeColor4f(fColor4);
buffer.writeBool(false); // TODO how do we flatten colorspaces?
}
« no previous file with comments | « include/core/SkWriteBuffer.h ('k') | src/core/SkReadBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698