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

Unified Diff: src/doc/SkDocument_XPS.cpp

Issue 1781773002: SkPDF: move all pdf sources into src/pdf (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-03-10 (Thursday) 15:59:02 EST Created 4 years, 9 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 | « src/doc/SkDocument_PDF_None.cpp ('k') | src/doc/SkDocument_XPS_None.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/doc/SkDocument_XPS.cpp
diff --git a/src/doc/SkDocument_XPS.cpp b/src/doc/SkDocument_XPS.cpp
deleted file mode 100644
index 0e241d9aaa369974b6a8133b8a166aa61c80be40..0000000000000000000000000000000000000000
--- a/src/doc/SkDocument_XPS.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkTypes.h"
-#if defined(SK_BUILD_FOR_WIN32)
-
-#include "SkDocument.h"
-#include "SkXPSDevice.h"
-#include "SkStream.h"
-
-class SkDocument_XPS : public SkDocument {
-public:
- SkDocument_XPS(SkWStream* stream,
- void (*doneProc)(SkWStream*, bool),
- SkScalar dpi)
- : SkDocument(stream, doneProc) {
- const SkScalar kPointsPerMeter = SkDoubleToScalar(360000.0 / 127.0);
- fUnitsPerMeter.set(kPointsPerMeter, kPointsPerMeter);
- SkScalar pixelsPerMeterScale = SkDoubleToScalar(dpi * 5000.0 / 127.0);
- fPixelsPerMeter.set(pixelsPerMeterScale, pixelsPerMeterScale);
- fDevice.beginPortfolio(stream);
- }
-
- virtual ~SkDocument_XPS() {
- // subclasses must call close() in their destructors
- this->close();
- }
-
-protected:
- SkCanvas* onBeginPage(SkScalar width,
- SkScalar height,
- const SkRect& trimBox) override {
- fDevice.beginSheet(fUnitsPerMeter, fPixelsPerMeter,
- SkSize::Make(width, height));
- fCanvas.reset(new SkCanvas(&fDevice));
- fCanvas->clipRect(trimBox);
- fCanvas->translate(trimBox.x(), trimBox.y());
- return fCanvas.get();
- }
-
- void onEndPage() override {
- SkASSERT(fCanvas.get());
- fCanvas->flush();
- fCanvas.reset(nullptr);
- fDevice.endSheet();
- }
-
- bool onClose(SkWStream*) override {
- SkASSERT(!fCanvas.get());
- return fDevice.endPortfolio();
- }
-
- void onAbort() override {}
-
-private:
- SkXPSDevice fDevice;
- SkAutoTUnref<SkCanvas> fCanvas;
- SkVector fUnitsPerMeter;
- SkVector fPixelsPerMeter;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
-SkDocument* SkDocument::CreateXPS(SkWStream* stream, SkScalar dpi) {
- return stream ? new SkDocument_XPS(stream, nullptr, dpi) : nullptr;
-}
-
-static void delete_wstream(SkWStream* stream, bool aborted) { delete stream; }
-
-SkDocument* SkDocument::CreateXPS(const char path[], SkScalar dpi) {
- SkAutoTDelete<SkFILEWStream> stream(new SkFILEWStream(path));
- if (!stream->isValid()) {
- return nullptr;
- }
- return new SkDocument_XPS(stream.detach(), delete_wstream, dpi);
-}
-
-#endif//defined(SK_BUILD_FOR_WIN32)
« no previous file with comments | « src/doc/SkDocument_PDF_None.cpp ('k') | src/doc/SkDocument_XPS_None.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698