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

Unified Diff: include/pdf/SkPDFDevice.h

Issue 24811002: Update the SkDocument interface to allow for 1) abort won't emit pdf, 2) close can report success/f… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fixes after code review Created 7 years, 2 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 | « include/core/SkDraw.h ('k') | src/doc/SkDocument.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/pdf/SkPDFDevice.h
diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h
index 30ec2dc63078967c2e157ac2d02673f95d29179e..38895b40d9df66740d74803b7b828e8ac86aaf9b 100644
--- a/include/pdf/SkPDFDevice.h
+++ b/include/pdf/SkPDFDevice.h
@@ -11,6 +11,7 @@
#define SkPDFDevice_DEFINED
#include "SkBitmapDevice.h"
+#include "SkBitmap.h"
#include "SkCanvas.h"
#include "SkPaint.h"
#include "SkPath.h"
@@ -21,6 +22,7 @@
#include "SkTDArray.h"
#include "SkTemplates.h"
+class CanvasTestStep;
class SkPDFArray;
class SkPDFDevice;
class SkPDFDict;
@@ -63,7 +65,7 @@ public:
* inverse scale+translate to accommodate the one that SkPDFDevice
* always does.
*/
- // TODO(vandebo): The sizes should be SkSize and not SkISize.
+ // Deprecated, please use SkDocument::CreatePdf() instead.
SK_API SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize,
const SkMatrix& initialTransform);
SK_API virtual ~SkPDFDevice();
@@ -311,6 +313,51 @@ private:
const SkMatrix& matrix);
typedef SkBitmapDevice INHERITED;
+
+ // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to create
+ // an SkPDFDevice
+ friend class SkDocument_PDF;
+ friend class SkPDFImageShader;
+};
+
+class SkPDFDeviceFlattener : public SkPDFDevice {
reed1 2013/10/07 19:39:42 If there is no need to make this public, I think i
edisonn 2013/10/08 17:55:31 Done.
+private:
+ typedef SkPDFDevice INHERITED;
+
+ SK_API SkPDFDeviceFlattener(const SkSize& trimBox, const SkRect& mediaBox);
+
+public:
+ SK_API virtual ~SkPDFDeviceFlattener();
+
+ virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE;
+ virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode,
+ size_t count, const SkPoint[],
+ const SkPaint& paint) SK_OVERRIDE;
+ virtual void drawRect(const SkDraw&, const SkRect& r, const SkPaint& paint);
+ virtual void drawPath(const SkDraw&, const SkPath& origpath,
+ const SkPaint& paint, const SkMatrix* prePathMatrix,
+ bool pathIsMutable) SK_OVERRIDE;
+ virtual void drawText(const SkDraw&, const void* text, size_t len,
+ SkScalar x, SkScalar y, const SkPaint&) SK_OVERRIDE;
+ virtual void drawPosText(const SkDraw&, const void* text, size_t len,
+ const SkScalar pos[], SkScalar constY,
+ int scalarsPerPos, const SkPaint&) SK_OVERRIDE;
+ virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len,
+ const SkPath& path, const SkMatrix* matrix,
+ const SkPaint& paint) SK_OVERRIDE;
+ virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode,
+ int vertexCount, const SkPoint verts[],
+ const SkPoint texs[], const SkColor colors[],
+ SkXfermode* xmode, const uint16_t indices[],
+ int indexCount, const SkPaint& paint) SK_OVERRIDE;
+ virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
+ const SkPaint&) SK_OVERRIDE;
+private:
+
+ bool mustFlatten(const SkDraw& d) const;
+ bool mustPathText(const SkDraw& d, const SkPaint& paint);
+
+ friend class SkDocument_PDF;
};
#endif
« no previous file with comments | « include/core/SkDraw.h ('k') | src/doc/SkDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698