| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkPDFUtils_DEFINED | 10 #ifndef SkPDFUtils_DEFINED |
| 11 #define SkPDFUtils_DEFINED | 11 #define SkPDFUtils_DEFINED |
| 12 | 12 |
| 13 #include "SkPaint.h" | 13 #include "SkPaint.h" |
| 14 #include "SkPath.h" | 14 #include "SkPath.h" |
| 15 | 15 |
| 16 class SkMatrix; | 16 class SkMatrix; |
| 17 class SkPath; | 17 class SkPath; |
| 18 class SkPDFArray; | 18 class SkPDFArray; |
| 19 struct SkRect; | 19 struct SkRect; |
| 20 class SkWStream; | 20 class SkWStream; |
| 21 | 21 |
| 22 #if 0 | 22 #if 0 |
| 23 #define PRINT_NOT_IMPL(str) fprintf(stderr, str) | 23 #define PRINT_NOT_IMPL(str) fprintf(stderr, str) |
| 24 #else | 24 #else |
| 25 #define PRINT_NOT_IMPL(str) | 25 #define PRINT_NOT_IMPL(str) |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 #define NOT_IMPLEMENTED(condition, assert) \ | 28 #define NOT_IMPLEMENTED(condition, assert) \ |
| 29 do { \ | 29 do { \ |
| 30 if (condition) { \ | 30 if ((bool)(condition)) { \ |
| 31 PRINT_NOT_IMPL("NOT_IMPLEMENTED: " #condition "\n"); \ | 31 PRINT_NOT_IMPL("NOT_IMPLEMENTED: " #condition "\n"); \ |
| 32 SkDEBUGCODE(SkASSERT(!assert);) \ | 32 SkDEBUGCODE(SkASSERT(!assert);) \ |
| 33 } \ | 33 } \ |
| 34 } while (0) | 34 } while (0) |
| 35 | 35 |
| 36 class SkPDFUtils { | 36 class SkPDFUtils { |
| 37 public: | 37 public: |
| 38 static SkPDFArray* RectToArray(const SkRect& rect); | 38 static SkPDFArray* RectToArray(const SkRect& rect); |
| 39 static SkPDFArray* MatrixToArray(const SkMatrix& matrix); | 39 static SkPDFArray* MatrixToArray(const SkMatrix& matrix); |
| 40 static void AppendTransform(const SkMatrix& matrix, SkWStream* content); | 40 static void AppendTransform(const SkMatrix& matrix, SkWStream* content); |
| 41 | 41 |
| 42 static void MoveTo(SkScalar x, SkScalar y, SkWStream* content); | 42 static void MoveTo(SkScalar x, SkScalar y, SkWStream* content); |
| 43 static void AppendLine(SkScalar x, SkScalar y, SkWStream* content); | 43 static void AppendLine(SkScalar x, SkScalar y, SkWStream* content); |
| 44 static void AppendCubic(SkScalar ctl1X, SkScalar ctl1Y, | 44 static void AppendCubic(SkScalar ctl1X, SkScalar ctl1Y, |
| 45 SkScalar ctl2X, SkScalar ctl2Y, | 45 SkScalar ctl2X, SkScalar ctl2Y, |
| 46 SkScalar dstX, SkScalar dstY, SkWStream* content); | 46 SkScalar dstX, SkScalar dstY, SkWStream* content); |
| 47 static void AppendRectangle(const SkRect& rect, SkWStream* content); | 47 static void AppendRectangle(const SkRect& rect, SkWStream* content); |
| 48 static void EmitPath(const SkPath& path, SkPaint::Style paintStyle, | 48 static void EmitPath(const SkPath& path, SkPaint::Style paintStyle, |
| 49 SkWStream* content); | 49 SkWStream* content); |
| 50 static void ClosePath(SkWStream* content); | 50 static void ClosePath(SkWStream* content); |
| 51 static void PaintPath(SkPaint::Style style, SkPath::FillType fill, | 51 static void PaintPath(SkPaint::Style style, SkPath::FillType fill, |
| 52 SkWStream* content); | 52 SkWStream* content); |
| 53 static void StrokePath(SkWStream* content); | 53 static void StrokePath(SkWStream* content); |
| 54 static void DrawFormXObject(int objectIndex, SkWStream* content); | 54 static void DrawFormXObject(int objectIndex, SkWStream* content); |
| 55 static void ApplyGraphicState(int objectIndex, SkWStream* content); | 55 static void ApplyGraphicState(int objectIndex, SkWStream* content); |
| 56 static void ApplyPattern(int objectIndex, SkWStream* content); | 56 static void ApplyPattern(int objectIndex, SkWStream* content); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 #endif | 59 #endif |
| OLD | NEW |