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

Unified Diff: src/pdf/SkPDFTypes.cpp

Issue 2151863003: SkPdf: smaller color serialization (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkFixed - 2016-07-15 (Friday) 15:45:32 EDT Created 4 years, 5 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/pdf/SkPDFTypes.h ('k') | src/pdf/SkPDFUtils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFTypes.cpp
diff --git a/src/pdf/SkPDFTypes.cpp b/src/pdf/SkPDFTypes.cpp
index f9ab5e492a26396ea0731e71e39acb44ff4d621d..8c59a4a0085c1da9b0ca918457937e8ea2cfb37f 100644
--- a/src/pdf/SkPDFTypes.cpp
+++ b/src/pdf/SkPDFTypes.cpp
@@ -118,6 +118,9 @@ void SkPDFUnion::emitObject(SkWStream* stream,
case Type::kInt:
stream->writeDecAsText(fIntValue);
return;
+ case Type::kColorComponent:
+ SkPDFUtils::AppendColorComponent(SkToU8(fIntValue), stream);
+ return;
case Type::kBool:
stream->writeText(fBoolValue ? "true" : "false");
return;
@@ -159,6 +162,7 @@ void SkPDFUnion::addResources(SkPDFObjNumMap* objNumMap,
const SkPDFSubstituteMap& substituteMap) const {
switch (fType) {
case Type::kInt:
+ case Type::kColorComponent:
case Type::kBool:
case Type::kScalar:
case Type::kName:
@@ -185,6 +189,12 @@ SkPDFUnion SkPDFUnion::Int(int32_t value) {
return u;
}
+SkPDFUnion SkPDFUnion::ColorComponent(uint8_t value) {
+ SkPDFUnion u(Type::kColorComponent);
+ u.fIntValue = value;
+ return u;
+}
+
SkPDFUnion SkPDFUnion::Bool(bool value) {
SkPDFUnion u(Type::kBool);
u.fBoolValue = value;
@@ -300,6 +310,10 @@ void SkPDFArray::appendInt(int32_t value) {
this->append(SkPDFUnion::Int(value));
}
+void SkPDFArray::appendColorComponent(uint8_t value) {
+ this->append(SkPDFUnion::ColorComponent(value));
+}
+
void SkPDFArray::appendBool(bool value) {
this->append(SkPDFUnion::Bool(value));
}
« no previous file with comments | « src/pdf/SkPDFTypes.h ('k') | src/pdf/SkPDFUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698