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

Unified Diff: src/doc/SkDocument.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/device/xps/SkXPSDevice.cpp ('k') | src/doc/SkDocument_PDF.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/doc/SkDocument.cpp
diff --git a/src/doc/SkDocument.cpp b/src/doc/SkDocument.cpp
deleted file mode 100644
index fa25e44f8645bb0c99d89015691bd42ce993d0f1..0000000000000000000000000000000000000000
--- a/src/doc/SkDocument.cpp
+++ /dev/null
@@ -1,95 +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.
- */
-
-#include "SkDocument.h"
-#include "SkStream.h"
-
-SkDocument::SkDocument(SkWStream* stream, void (*doneProc)(SkWStream*, bool)) {
- fStream = stream; // we do not own this object.
- fDoneProc = doneProc;
- fState = kBetweenPages_State;
-}
-
-SkDocument::~SkDocument() {
- this->close();
-}
-
-SkCanvas* SkDocument::beginPage(SkScalar width, SkScalar height,
- const SkRect* content) {
- if (width <= 0 || height <= 0) {
- return nullptr;
- }
-
- SkRect outer = SkRect::MakeWH(width, height);
- SkRect inner;
- if (content) {
- inner = *content;
- if (!inner.intersect(outer)) {
- return nullptr;
- }
- } else {
- inner = outer;
- }
-
- for (;;) {
- switch (fState) {
- case kBetweenPages_State:
- fState = kInPage_State;
- return this->onBeginPage(width, height, inner);
- case kInPage_State:
- this->endPage();
- break;
- case kClosed_State:
- return nullptr;
- }
- }
- SkDEBUGFAIL("never get here");
- return nullptr;
-}
-
-void SkDocument::endPage() {
- if (kInPage_State == fState) {
- fState = kBetweenPages_State;
- this->onEndPage();
- }
-}
-
-bool SkDocument::close() {
- for (;;) {
- switch (fState) {
- case kBetweenPages_State: {
- fState = kClosed_State;
- bool success = this->onClose(fStream);
-
- if (fDoneProc) {
- fDoneProc(fStream, false);
- }
- // we don't own the stream, but we mark it nullptr since we can
- // no longer write to it.
- fStream = nullptr;
- return success;
- }
- case kInPage_State:
- this->endPage();
- break;
- case kClosed_State:
- return false;
- }
- }
-}
-
-void SkDocument::abort() {
- this->onAbort();
-
- fState = kClosed_State;
- if (fDoneProc) {
- fDoneProc(fStream, true);
- }
- // we don't own the stream, but we mark it nullptr since we can
- // no longer write to it.
- fStream = nullptr;
-}
« no previous file with comments | « src/device/xps/SkXPSDevice.cpp ('k') | src/doc/SkDocument_PDF.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698