Move SkPdfContext into its own files.

Otherwise, the class is unchanged.

Review URL: https://codereview.chromium.org/77763007

git-svn-id: http://skia.googlecode.com/svn/trunk@12330 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
scroggo@google.com 2013-11-20 22:33:39 +00:00
parent b1de123336
commit d906702f78
6 changed files with 52 additions and 32 deletions

View File

@ -12,7 +12,7 @@
#ifndef SkPdfFont_DEFINED
#define SkPdfFont_DEFINED
#include "SkPdfGraphicsState.h"
#include "SkPdfContext.h"
#include "SkPdfHeaders_autogen.h"
#include "SkPdfMapper_autogen.h"
#include "SkPdfUtils.h"

View File

@ -8,16 +8,6 @@
#include "SkPdfGraphicsState.h"
#include "SkDashPathEffect.h"
#include "SkPdfNativeTokenizer.h"
SkPdfContext::SkPdfContext(SkPdfNativeDoc* doc)
: fPdfDoc(doc)
, fTmpPageAllocator(new SkPdfAllocator()) {
}
SkPdfContext::~SkPdfContext() {
delete fTmpPageAllocator;
}
void SkPdfGraphicsState::applyGraphicsState(SkPaint* paint, bool stroking) {
if (stroking) {

View File

@ -12,12 +12,8 @@
#include "SkPaint.h"
#include "SkPdfConfig.h"
#include "SkPdfUtils.h"
#include "SkTDStackNester.h"
class SkPdfAllocator;
class SkPdfFont;
class SkPdfDoc;
class SkPdfNativeDoc;
class SkPdfNativeObject;
class SkPdfResourceDictionary;
class SkPdfSoftMaskDictionary;
@ -80,7 +76,7 @@ public:
}
};
/** \class SkTDStackNester
/**
* Operates on stroking or non-stroking properties.
*/
struct SkPdfGraphicsState {
@ -355,20 +351,4 @@ smoothness number (PDF 1.3) The precision with which col
void applyGraphicsState(SkPaint* paint, bool stroking);
};
/** \class SkPdfContext
* The context of the drawing. The document we draw from, the current stack of objects, ...
*/
class SkPdfContext {
public:
SkTDStackNester<SkPdfNativeObject*> fObjectStack;
SkTDStackNester<SkPdfGraphicsState> fStateStack;
SkPdfGraphicsState fGraphicsState;
SkPdfNativeDoc* fPdfDoc;
SkPdfAllocator* fTmpPageAllocator;
SkMatrix fOriginalMatrix;
SkPdfContext(SkPdfNativeDoc* doc);
~SkPdfContext();
};
#endif // SkPdfGraphicsState_DEFINED

View File

@ -0,0 +1,30 @@
/*
* 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 "SkMatrix.h"
#include "SkTDStackNester.h"
#include "SkPdfGraphicsState.h"
class SkPdfAllocator;
class SkPdfNativeDoc;
class SkPdfNativeObject;
/** \class SkPdfContext
* The context of the drawing. The document we draw from, the current stack of objects, ...
*/
class SkPdfContext {
public:
SkTDStackNester<SkPdfNativeObject*> fObjectStack;
SkTDStackNester<SkPdfGraphicsState> fStateStack;
SkPdfGraphicsState fGraphicsState;
SkPdfNativeDoc* fPdfDoc;
SkPdfAllocator* fTmpPageAllocator;
SkMatrix fOriginalMatrix;
SkPdfContext(SkPdfNativeDoc* doc);
~SkPdfContext();
};

View File

@ -0,0 +1,18 @@
/*
* 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 "SkPdfContext.h"
#include "SkPdfNativeTokenizer.h"
SkPdfContext::SkPdfContext(SkPdfNativeDoc* doc)
: fPdfDoc(doc)
, fTmpPageAllocator(new SkPdfAllocator()) {
}
SkPdfContext::~SkPdfContext() {
delete fTmpPageAllocator;
}

View File

@ -11,8 +11,10 @@
'sources': [
# FIXME: Include directory is named "inc" (instead of "include") in
# order to not be considered the public API.
'../experimental/PdfViewer/inc/SkPdfContext.h',
'../experimental/PdfViewer/inc/SkPdfRenderer.h',
'../experimental/PdfViewer/src/SkPdfContext.cpp',
'../experimental/PdfViewer/src/SkPdfRenderer.cpp',
'../experimental/PdfViewer/src/SkTDStackNester.h',