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

Unified Diff: experimental/PdfViewer/SkPdfBasics.h

Issue 19793011: (upload draf code for backup) pdfviewer: improve memory, son't allocate extra buffers, and put the … (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 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 | « no previous file | experimental/PdfViewer/SkPdfBasics.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/PdfViewer/SkPdfBasics.h
===================================================================
--- experimental/PdfViewer/SkPdfBasics.h (revision 10235)
+++ experimental/PdfViewer/SkPdfBasics.h (working copy)
@@ -16,11 +16,12 @@
class SkPdfResourceDictionary;
class SkNativeParsedPDF;
+class SkPdfAllocator;
// TODO(edisonn): better class design.
struct SkPdfColorOperator {
// does not own the char*
- const char* fColorSpace; // TODO(edisonn): use SkString, or even char*
+ NotOwnedString fColorSpace;
SkColor fColor;
double fOpacity; // ca or CA
// TODO(edisonn): add here other color space options.
@@ -30,7 +31,9 @@
fColor = color;
}
// TODO(edisonn): double check the default values for all fields.
- SkPdfColorOperator() : fColorSpace(NULL), fColor(SK_ColorBLACK), fOpacity(1) {}
+ SkPdfColorOperator() : fColor(SK_ColorBLACK), fOpacity(1) {
+ NotOwnedString::init(&fColorSpace);
+ }
void applyGraphicsState(SkPaint* paint) {
paint->setColor(SkColorSetA(fColor, fOpacity * 255));
@@ -117,12 +120,14 @@
std::stack<SkPdfGraphicsState> fStateStack;
SkPdfGraphicsState fGraphicsState;
SkNativeParsedPDF* fPdfDoc;
+ // TODO(edisonn): the allocator, could be freed after the page is done drawing.
+ SkPdfAllocator* fTmpPageAllocator;
SkMatrix fOriginalMatrix;
SkPdfInlineImage fInlineImage;
- PdfContext(SkNativeParsedPDF* doc) : fPdfDoc(doc) {}
-
+ PdfContext(SkNativeParsedPDF* doc);
+ ~PdfContext();
};
// TODO(edisonn): temporary code, to report how much of the PDF we actually think we rendered.
« no previous file with comments | « no previous file | experimental/PdfViewer/SkPdfBasics.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698