| Index: src/pdf/SkPDFUtils.cpp
|
| diff --git a/src/pdf/SkPDFUtils.cpp b/src/pdf/SkPDFUtils.cpp
|
| index 16abc2f9f252b381a26a4d8c016361018d71c712..d034270e07447f07503e603109868d72e9d252f9 100644
|
| --- a/src/pdf/SkPDFUtils.cpp
|
| +++ b/src/pdf/SkPDFUtils.cpp
|
| @@ -17,6 +17,17 @@
|
| #include "SkString.h"
|
| #include "SkPDFTypes.h"
|
|
|
| +//static
|
| +SkPDFArray* SkPDFUtils::RectToArray(const SkRect& rect) {
|
| + SkPDFArray* result = new SkPDFArray();
|
| + result->reserve(4);
|
| + result->appendScalar(rect.fLeft);
|
| + result->appendScalar(rect.fTop);
|
| + result->appendScalar(rect.fRight);
|
| + result->appendScalar(rect.fBottom);
|
| + return result;
|
| +}
|
| +
|
| // static
|
| SkPDFArray* SkPDFUtils::MatrixToArray(const SkMatrix& matrix) {
|
| SkScalar values[6];
|
| @@ -222,3 +233,17 @@ void SkPDFUtils::ApplyGraphicState(int objectIndex, SkWStream* content) {
|
| objectIndex).c_str());
|
| content->writeText(" gs\n");
|
| }
|
| +
|
| +// static
|
| +void SkPDFUtils::ApplyPattern(int objectIndex, SkWStream* content) {
|
| + // Select Pattern color space (CS, cs) and set pattern object as current
|
| + // color (SCN, scn)
|
| + SkString resourceName = SkPDFResourceDict::getResourceName(
|
| + SkPDFResourceDict::kPattern_ResourceType,
|
| + objectIndex);
|
| + content->writeText("/Pattern CS/Pattern cs/");
|
| + content->writeText(resourceName.c_str());
|
| + content->writeText(" SCN/");
|
| + content->writeText(resourceName.c_str());
|
| + content->writeText(" scn\n");
|
| +}
|
|
|