| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2011 Google Inc. | 2  * Copyright 2011 Google Inc. | 
| 3  * | 3  * | 
| 4  * Use of this source code is governed by a BSD-style license that can be | 4  * Use of this source code is governed by a BSD-style license that can be | 
| 5  * found in the LICENSE file. | 5  * found in the LICENSE file. | 
| 6  */ | 6  */ | 
| 7 | 7 | 
| 8 | 8 | 
| 9 #include "SkData.h" | 9 #include "SkData.h" | 
| 10 #include "SkGeometry.h" | 10 #include "SkGeometry.h" | 
| 11 #include "SkPaint.h" | 11 #include "SkPaint.h" | 
| 12 #include "SkPath.h" | 12 #include "SkPath.h" | 
| 13 #include "SkPDFResourceDict.h" | 13 #include "SkPDFResourceDict.h" | 
| 14 #include "SkPDFUtils.h" | 14 #include "SkPDFUtils.h" | 
| 15 #include "SkStream.h" | 15 #include "SkStream.h" | 
| 16 #include "SkString.h" | 16 #include "SkString.h" | 
| 17 #include "SkPDFTypes.h" | 17 #include "SkPDFTypes.h" | 
| 18 | 18 | 
| 19 #include <cmath> | 19 #include <cmath> | 
| 20 | 20 | 
| 21 sk_sp<SkPDFArray> SkPDFUtils::RectToArray(const SkRect& rect) { | 21 //static | 
| 22     auto result = sk_make_sp<SkPDFArray>(); | 22 SkPDFArray* SkPDFUtils::RectToArray(const SkRect& rect) { | 
|  | 23     SkPDFArray* result = new SkPDFArray(); | 
| 23     result->reserve(4); | 24     result->reserve(4); | 
| 24     result->appendScalar(rect.fLeft); | 25     result->appendScalar(rect.fLeft); | 
| 25     result->appendScalar(rect.fTop); | 26     result->appendScalar(rect.fTop); | 
| 26     result->appendScalar(rect.fRight); | 27     result->appendScalar(rect.fRight); | 
| 27     result->appendScalar(rect.fBottom); | 28     result->appendScalar(rect.fBottom); | 
| 28     return result; | 29     return result; | 
| 29 } | 30 } | 
| 30 | 31 | 
| 31 sk_sp<SkPDFArray> SkPDFUtils::MatrixToArray(const SkMatrix& matrix) { | 32 // static | 
|  | 33 SkPDFArray* SkPDFUtils::MatrixToArray(const SkMatrix& matrix) { | 
| 32     SkScalar values[6]; | 34     SkScalar values[6]; | 
| 33     if (!matrix.asAffine(values)) { | 35     if (!matrix.asAffine(values)) { | 
| 34         SkMatrix::SetAffineIdentity(values); | 36         SkMatrix::SetAffineIdentity(values); | 
| 35     } | 37     } | 
| 36 | 38 | 
| 37     auto result = sk_make_sp<SkPDFArray>(); | 39     SkPDFArray* result = new SkPDFArray; | 
| 38     result->reserve(6); | 40     result->reserve(6); | 
| 39     for (size_t i = 0; i < SK_ARRAY_COUNT(values); i++) { | 41     for (size_t i = 0; i < SK_ARRAY_COUNT(values); i++) { | 
| 40         result->appendScalar(values[i]); | 42         result->appendScalar(values[i]); | 
| 41     } | 43     } | 
| 42     return result; | 44     return result; | 
| 43 } | 45 } | 
| 44 | 46 | 
| 45 // static | 47 // static | 
| 46 void SkPDFUtils::AppendTransform(const SkMatrix& matrix, SkWStream* content) { | 48 void SkPDFUtils::AppendTransform(const SkMatrix& matrix, SkWStream* content) { | 
| 47     SkScalar values[6]; | 49     SkScalar values[6]; | 
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 406         for (size_t i = 0; i < len; i++) { | 408         for (size_t i = 0; i < len; i++) { | 
| 407             uint8_t c = static_cast<uint8_t>(cin[i]); | 409             uint8_t c = static_cast<uint8_t>(cin[i]); | 
| 408             static const char gHex[] = "0123456789ABCDEF"; | 410             static const char gHex[] = "0123456789ABCDEF"; | 
| 409             *str++ = gHex[(c >> 4) & 0xF]; | 411             *str++ = gHex[(c >> 4) & 0xF]; | 
| 410             *str++ = gHex[(c     ) & 0xF]; | 412             *str++ = gHex[(c     ) & 0xF]; | 
| 411         } | 413         } | 
| 412         *str++ = '>'; | 414         *str++ = '>'; | 
| 413     } | 415     } | 
| 414     return result; | 416     return result; | 
| 415 } | 417 } | 
| OLD | NEW | 
|---|