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

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: Created 7 years, 3 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
Index: include/pdf/SkPDFDevice.h
diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h
index 8ac227dbaa1bb140d26dac161967439481781023..9e02f054fcb2d28f5dc13b2aab6d8bde46d9900e 100644
--- a/include/pdf/SkPDFDevice.h
+++ b/include/pdf/SkPDFDevice.h
@@ -11,15 +11,18 @@
#define SkPDFDevice_DEFINED
#include "SkBitmapDevice.h"
+#include "SkBitmap.h"
#include "SkCanvas.h"
#include "SkPaint.h"
#include "SkPath.h"
+#include "SkPDFCallbacks.h"
#include "SkRect.h"
#include "SkRefCnt.h"
#include "SkStream.h"
#include "SkTDArray.h"
#include "SkTemplates.h"
+class CanvasTestStep;
class SkPDFArray;
class SkPDFDevice;
class SkPDFDict;
@@ -33,13 +36,18 @@ class SkPDFShader;
class SkPDFStream;
template <typename T> class SkTSet;
+namespace skiatest {
+class Reporter;
+}
+
+namespace sk_tools {
+class PdfRenderer;
+}
// Private classes.
struct ContentEntry;
struct GraphicStateEntry;
struct NamedDestination;
-typedef bool (*EncodeToDCTStream)(SkWStream* stream, const SkBitmap& bitmap, const SkIRect& rect);
-
/** \class SkPDFDevice
The drawing context for the PDF backend.
@@ -65,6 +73,7 @@ public:
* 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();
@@ -198,6 +207,8 @@ protected:
virtual bool allowImageFilter(SkImageFilter*) SK_OVERRIDE;
private:
+ SK_API SkPDFDevice(const SkSize& trimBox, const SkRect& mediaBox);
+
// TODO(vandebo): push most of SkPDFDevice's state into a core object in
// order to get the right access levels without using friend.
friend class ScopedContentEntry;
@@ -311,6 +322,22 @@ 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;
+
+ // TODO(edisonn): these are the entry points building a SkPDFDevice, which is about to get
+ // removed. Listed here for future reference when we will remove the SkPDFDevice's constructor.
+// friend class SampleWindow;
+// friend void test_pdf_link_annotations(skiatest::Reporter* reporter);
+// friend void test_named_destination_annotations(skiatest::Reporter* reporter);
+// friend void TestPdfDevice(skiatest::Reporter* reporter, CanvasTestStep* testStep);
+// friend void test_issue1083();
+// friend void TestImage(skiatest::Reporter* reporter, const SkBitmap& bitmap,
+// const char* expected, bool useDCTEncoder);
};
#endif

Powered by Google App Engine
This is Rietveld 408576698