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

Unified Diff: tools/PdfRenderer.cpp

Issue 463603002: clean up render_pdfs: (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: AnotherPatchSet Created 6 years, 4 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 | « tools/PdfRenderer.h ('k') | tools/render_pdfs_main.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/PdfRenderer.cpp
diff --git a/tools/PdfRenderer.cpp b/tools/PdfRenderer.cpp
deleted file mode 100644
index bcecf579a89ee4ea4074c92dc1e58061e0fc77fc..0000000000000000000000000000000000000000
--- a/tools/PdfRenderer.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "PdfRenderer.h"
-#include "SkCanvas.h"
-#include "SkDevice.h"
-#include "SkPDFDevice.h"
-#include "SkPDFDocument.h"
-
-namespace sk_tools {
-
-void PdfRenderer::init(SkPicture* pict, SkWStream* stream) {
- SkASSERT(NULL == fPicture);
- SkASSERT(NULL == fCanvas.get());
- if (fPicture != NULL || NULL != fCanvas.get()) {
- return;
- }
-
- SkASSERT(pict != NULL);
- if (NULL == pict) {
- return;
- }
-
- fPicture = pict;
- fCanvas.reset(this->setupCanvas(stream, pict->width(), pict->height()));
-}
-
-SkCanvas* PdfRenderer::setupCanvas(SkWStream* stream, int width, int height) {
- fPdfDoc.reset(SkDocument::CreatePDF(stream, NULL, fEncoder));
-
- SkCanvas* canvas = fPdfDoc->beginPage(SkIntToScalar(width), SkIntToScalar(height));
- canvas->ref();
-
- return canvas;
-}
-
-void PdfRenderer::end() {
- fPicture = NULL;
- fCanvas.reset(NULL);
- fPdfDoc.reset(NULL);
-}
-
-bool SimplePdfRenderer::render() {
- SkASSERT(fCanvas.get() != NULL);
- SkASSERT(fPicture != NULL);
- if (NULL == fCanvas.get() || NULL == fPicture) {
- return false;
- }
-
- fCanvas->drawPicture(fPicture);
- fCanvas->flush();
-
- return fPdfDoc->close();
-}
-
-}
« no previous file with comments | « tools/PdfRenderer.h ('k') | tools/render_pdfs_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698