aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/PdfViewer/inc
diff options
context:
space:
mode:
Diffstat (limited to 'experimental/PdfViewer/inc')
-rw-r--r--experimental/PdfViewer/inc/SkPdfContext.h48
-rw-r--r--experimental/PdfViewer/inc/SkPdfDiffEncoder.h25
-rw-r--r--experimental/PdfViewer/inc/SkPdfRenderer.h82
-rw-r--r--experimental/PdfViewer/inc/SkPdfTokenLooper.h68
4 files changed, 0 insertions, 223 deletions
diff --git a/experimental/PdfViewer/inc/SkPdfContext.h b/experimental/PdfViewer/inc/SkPdfContext.h
deleted file mode 100644
index cd6eba2209..0000000000
--- a/experimental/PdfViewer/inc/SkPdfContext.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkPdfContext_DEFINED
-#define SkPdfContext_DEFINED
-
-#include "SkMatrix.h"
-#include "SkPdfGraphicsState.h"
-#include "SkPdfNativeTokenizer.h"
-#include "SkTDStackNester.h"
-#include "SkTypes.h"
-
-class SkCanvas;
-class SkPdfNativeDoc;
-class SkPdfNativeObject;
-
-/**
- * The context of the drawing. The document we draw from, the current stack of
- * objects, ...
- */
-class SkPdfContext : SkNoncopyable {
-public:
- // FIXME (scroggo): Add functions for accessing these.
- SkTDStackNester<SkPdfNativeObject*> fObjectStack;
- SkTDStackNester<SkPdfGraphicsState> fStateStack;
- SkPdfGraphicsState fGraphicsState;
- SkPdfNativeDoc* fPdfDoc;
- SkMatrix fOriginalMatrix;
-
- // Does not take ownership of the doc.
- explicit SkPdfContext(SkPdfNativeDoc* doc);
-
- /**
- * Parse the stream and draw its commands to the canvas.
- * FIXME (scroggo): May not be the best place for this, but leaving here
- * for now, since it uses SkPdfContext's members.
- */
- void parseStream(SkPdfNativeObject* stream, SkCanvas* canvas);
-
-private:
- // FIXME (scroggo): Is this the right place for the allocator?
- SkPdfAllocator fTmpPageAllocator;
-};
-#endif // SkPdfContext_DEFINED
diff --git a/experimental/PdfViewer/inc/SkPdfDiffEncoder.h b/experimental/PdfViewer/inc/SkPdfDiffEncoder.h
deleted file mode 100644
index 9acd82f569..0000000000
--- a/experimental/PdfViewer/inc/SkPdfDiffEncoder.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkPdfDiffEncoder_DEFINED
-#define SkPdfDiffEncoder_DEFINED
-
-struct PdfToken;
-
-namespace SkPdfDiffEncoder {
- /**
- * If PDF_TRACE_DIFF_IN_PNG is defined, the PDF commands so far are written
- * to a file with the difference created by using this token highlighted.
- * The file is named "/tmp/log_step_by_step/step-%i-%s.png", where %i is
- * the number of the command and %s is the name of the command. If
- * PDF_TRACE_DIFF_IN_PNG is not defined this function does nothing.
- * TODO(scroggo): Pass SkPdfContext and SkCanvas for info.
- */
- void WriteToFile(PdfToken*);
-};
-
-#endif // SkPdfDiffEncoder_DEFINED
diff --git a/experimental/PdfViewer/inc/SkPdfRenderer.h b/experimental/PdfViewer/inc/SkPdfRenderer.h
deleted file mode 100644
index 9882a612cf..0000000000
--- a/experimental/PdfViewer/inc/SkPdfRenderer.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-#ifndef SkPdfRenderer_DEFINED
-#define SkPdfRenderer_DEFINED
-
-#include "SkTypes.h"
-
-class SkBitmap;
-class SkCanvas;
-class SkPdfNativeDoc;
-struct SkRect;
-class SkStream;
-
-// What kind of content to render.
-// FIXME: Currently unused.
-enum SkPdfContent {
- kNoForms_SkPdfContent,
- kAll_SkPdfContent,
-};
-
-/** \class SkPdfRenderer
- *
- * The SkPdfRenderer class is used to render a PDF into canvas.
- *
- */
-class SkPdfRenderer : SkNoncopyable {
-public:
- // Create a new renderer from a stream.
- // TODO(edisonn): replace it with a SkSmartStream which would know to to efficiently
- // deal with a HTTP stream.
- // FIXME: Untested.
- // Does not affect ownership of SkStream.
- static SkPdfRenderer* CreateFromStream(SkStream*);
- // Create a new renderer from a file.
- static SkPdfRenderer* CreateFromFile(const char* filename);
-
- ~SkPdfRenderer();
-
- // Render a specific page into the canvas, in a specific rectangle.
- bool renderPage(int page, SkCanvas* canvas, const SkRect& dst) const;
-
- // Returns the number of pages in the loaded pdf.
- int pages() const;
-
- // Returns the MediaBox of a page. Can be used by client to crate a canvas.
- SkRect MediaBox(int page) const;
-
- // TODO(edisonn): for testing only, probably it should be removed, unless some client wants to
- // let users know how much memory the PDF needs.
- size_t bytesUsed() const;
-
-private:
- // Takes ownership of SkPdfNativeDoc.
- SkPdfRenderer(SkPdfNativeDoc*);
- SkPdfNativeDoc* fPdfDoc;
-};
-
-// For testing only, reports stats about rendering, like how many operations failed, or are NYI, ...
-void reportPdfRenderStats();
-
-// Renders a page of a pdf in a bitmap.
-// Does not affect ownership of stream.
-bool SkPDFNativeRenderToBitmap(SkStream* stream,
- SkBitmap* output,
- int page = 0,
- SkPdfContent content = kAll_SkPdfContent,
- double dpi = 72.0);
-
-// TODO(edisonn): add options to render forms, checkboxes, ...
-// TODO(edisonn): Add API for Forms viewing and editing
-// e.g. SkBitmap getPage(int page);
-// int formsCount();
-// SkForm getForm(int formID); // SkForm(SkRect, .. other data)
-// TODO (edisonn): Add intend when loading pdf, for example: for viewing, for parsing content, ...
-
-#endif // SkPdfRenderer_DEFINED
diff --git a/experimental/PdfViewer/inc/SkPdfTokenLooper.h b/experimental/PdfViewer/inc/SkPdfTokenLooper.h
deleted file mode 100644
index f3897cc78f..0000000000
--- a/experimental/PdfViewer/inc/SkPdfTokenLooper.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkPdfTokenLooper_DEFINED
-#define SkPdfTokenLooper_DEFINED
-
-#include "SkPdfNativeTokenizer.h"
-// For SkPdfResult
-#include "SkPdfUtils.h"
-
-class SkCanvas;
-class SkPdfContext;
-
-/**
- * An object which reads tokens from a tokenizer and draws it to an SkCanvas.
- * FIXME (scroggo): Can this be an interface? See http://goo.gl/AXQtkH
- */
-class SkPdfTokenLooper {
-public:
- /**
- * Create a looper with no parent.
- * @param tokenizer SkPdfNativeTokenizer for reading tokens.
- * @param pdfContext Context for drawing state.
- * @param canvas Target SkCanvas for drawing.
- */
- SkPdfTokenLooper(SkPdfNativeTokenizer* tokenizer,
- SkPdfContext* pdfContext,
- SkCanvas* canvas)
- : fParent(NULL)
- , fTokenizer(tokenizer)
- , fPdfContext(pdfContext)
- , fCanvas(canvas) {}
-
- /**
- * Create a looper as a child of parent. It will share the
- * SkPdfContext, SkPdfTokenizer, and SkCanvas with its parent.
- */
- explicit SkPdfTokenLooper(SkPdfTokenLooper* parent)
- : fParent(parent)
- , fTokenizer(parent->fTokenizer)
- , fPdfContext(parent->fPdfContext)
- , fCanvas(parent->fCanvas) {}
-
- virtual ~SkPdfTokenLooper() {}
-
- /**
- * Consume a token, and draw to fCanvas as directed.
- */
- virtual SkPdfResult consumeToken(PdfToken& token) = 0;
-
- /**
- * Consume all the tokens this looper can handle.
- */
- virtual void loop() = 0;
-
-protected:
- // All are unowned pointers.
- SkPdfTokenLooper* fParent;
- SkPdfNativeTokenizer* fTokenizer;
- SkPdfContext* fPdfContext;
- SkCanvas* fCanvas;
-};
-
-#endif // SkPdfTokenLooper_DEFINED