1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/pdf/SkPDFDeviceFlattener.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 1.4 +/* 1.5 + * Copyright 2013 Google Inc. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license that can be 1.8 + * found in the LICENSE file. 1.9 + */ 1.10 + 1.11 +#ifndef SkPDFDeviceFlattener_DEFINED 1.12 +#define SkPDFDeviceFlattener_DEFINED 1.13 + 1.14 +#include "SkPDFDevice.h" 1.15 + 1.16 + 1.17 +/** \class SkPDFDeviceFlattener 1.18 + 1.19 + The PDF Device Flattener is used to flatten features without native support in PDF. 1.20 + For now, the only one implemented is Perspective. 1.21 + 1.22 + TODO(edisonn): Rename the class once we know all the things it will do. 1.23 +*/ 1.24 +class SkPDFDeviceFlattener : public SkPDFDevice { 1.25 +private: 1.26 + typedef SkPDFDevice INHERITED; 1.27 + 1.28 + SK_API SkPDFDeviceFlattener(const SkSize& pageSize, const SkRect* trimBox = NULL); 1.29 + 1.30 +public: 1.31 + SK_API virtual ~SkPDFDeviceFlattener(); 1.32 + 1.33 + virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, 1.34 + size_t count, const SkPoint[], 1.35 + const SkPaint& paint) SK_OVERRIDE; 1.36 + virtual void drawRect(const SkDraw&, const SkRect& r, const SkPaint& paint); 1.37 + virtual void drawPath(const SkDraw&, const SkPath& origpath, 1.38 + const SkPaint& paint, const SkMatrix* prePathMatrix, 1.39 + bool pathIsMutable) SK_OVERRIDE; 1.40 + virtual void drawText(const SkDraw&, const void* text, size_t len, 1.41 + SkScalar x, SkScalar y, const SkPaint&) SK_OVERRIDE; 1.42 + virtual void drawPosText(const SkDraw&, const void* text, size_t len, 1.43 + const SkScalar pos[], SkScalar constY, 1.44 + int scalarsPerPos, const SkPaint&) SK_OVERRIDE; 1.45 + virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len, 1.46 + const SkPath& path, const SkMatrix* matrix, 1.47 + const SkPaint& paint) SK_OVERRIDE; 1.48 +private: 1.49 + 1.50 + bool mustFlatten(const SkDraw& d) const; 1.51 + bool mustPathText(const SkDraw& d, const SkPaint& paint); 1.52 + 1.53 + friend class SkDocument_PDF; 1.54 +}; 1.55 + 1.56 +#endif // SkPDFDeviceFlattener_DEFINED