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

Side by Side Diff: include/core/SkDocument.h

Issue 1505763003: SkDocument::setDCTEncoder() for old versions of webkit (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove compile flag; unit test Created 5 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/doc/SkDocument_PDF.cpp » ('j') | tests/PDFDocumentTest.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkDocument_DEFINED 8 #ifndef SkDocument_DEFINED
9 #define SkDocument_DEFINED 9 #define SkDocument_DEFINED
10 10
11 #include "SkBitmap.h" 11 #include "SkBitmap.h"
12 #include "SkPicture.h" 12 #include "SkPicture.h"
13 #include "SkRect.h" 13 #include "SkRect.h"
14 #include "SkRefCnt.h" 14 #include "SkRefCnt.h"
15 #include "SkString.h" 15 #include "SkString.h"
16 #include "SkTime.h" 16 #include "SkTime.h"
17 17
18 class SkCanvas; 18 class SkCanvas;
19 class SkData;
20 class SkPixmap;
19 class SkWStream; 21 class SkWStream;
20 22
21 /** SK_ScalarDefaultDPI is 72 DPI. 23 /** SK_ScalarDefaultDPI is 72 DPI.
22 */ 24 */
23 #define SK_ScalarDefaultRasterDPI 72.0f 25 #define SK_ScalarDefaultRasterDPI 72.0f
24 26
25 /** 27 /**
26 * High-level API for creating a document-based canvas. To use.. 28 * High-level API for creating a document-based canvas. To use..
27 * 29 *
28 * 1. Create a document, specifying a stream to store the output. 30 * 1. Create a document, specifying a stream to store the output.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 * } 128 * }
127 */ 129 */
128 struct Attribute { 130 struct Attribute {
129 SkString fKey, fValue; 131 SkString fKey, fValue;
130 Attribute(const SkString& k, const SkString& v) : fKey(k), fValue(v) {} 132 Attribute(const SkString& k, const SkString& v) : fKey(k), fValue(v) {}
131 }; 133 };
132 virtual void setMetadata(const SkTArray<SkDocument::Attribute>&, 134 virtual void setMetadata(const SkTArray<SkDocument::Attribute>&,
133 const SkTime::DateTime* /* creationDate */, 135 const SkTime::DateTime* /* creationDate */,
134 const SkTime::DateTime* /* modifiedDate */) {} 136 const SkTime::DateTime* /* modifiedDate */) {}
135 137
138 /**
139 * For PDF documents, if a DCTEncoder (discrete cosine transform)
140 * is set, use it to encode SkImages and SkBitmaps as [JFIF]JPEGs.
141 * This feature is deprecated and is only supplied for backwards
142 * compatability.
143 *
144 * The prefered method to create PDFs with JPEG images is to use
145 * SkImage::NewFromEncoded() and not setDCTEncoder(). Chromium
146 * uses NewFromEncoded.
147 *
148 * If the encoder is unset, or if it returns NULL, fall back on
149 * encoding images with Deflate.
150 */
151 virtual void setDCTEncoder(SkData* (*)(const SkPixmap&)) {}
152
136 protected: 153 protected:
137 SkDocument(SkWStream*, void (*)(SkWStream*, bool aborted)); 154 SkDocument(SkWStream*, void (*)(SkWStream*, bool aborted));
138 155
139 // note: subclasses must call close() in their destructor, as the base class 156 // note: subclasses must call close() in their destructor, as the base class
140 // cannot do this for them. 157 // cannot do this for them.
141 virtual ~SkDocument(); 158 virtual ~SkDocument();
142 159
143 virtual SkCanvas* onBeginPage(SkScalar width, SkScalar height, 160 virtual SkCanvas* onBeginPage(SkScalar width, SkScalar height,
144 const SkRect& content) = 0; 161 const SkRect& content) = 0;
145 virtual void onEndPage() = 0; 162 virtual void onEndPage() = 0;
(...skipping 12 matching lines...) Expand all
158 175
159 private: 176 private:
160 SkWStream* fStream; 177 SkWStream* fStream;
161 void (*fDoneProc)(SkWStream*, bool aborted); 178 void (*fDoneProc)(SkWStream*, bool aborted);
162 State fState; 179 State fState;
163 180
164 typedef SkRefCnt INHERITED; 181 typedef SkRefCnt INHERITED;
165 }; 182 };
166 183
167 #endif 184 #endif
OLDNEW
« no previous file with comments | « no previous file | src/doc/SkDocument_PDF.cpp » ('j') | tests/PDFDocumentTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698