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

Side by Side Diff: include/pdf/SkPDFDevice.h

Issue 24811002: Update the SkDocument interface to allow for 1) abort won't emit pdf, 2) close can report success/f… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: move SkPDFDevice in separate files, and various fixes Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkPDFDevice_DEFINED 10 #ifndef SkPDFDevice_DEFINED
11 #define SkPDFDevice_DEFINED 11 #define SkPDFDevice_DEFINED
12 12
13 #include "SkBitmapDevice.h" 13 #include "SkBitmapDevice.h"
14 #include "SkBitmap.h"
14 #include "SkCanvas.h" 15 #include "SkCanvas.h"
15 #include "SkPaint.h" 16 #include "SkPaint.h"
16 #include "SkPath.h" 17 #include "SkPath.h"
17 #include "SkPicture.h" 18 #include "SkPicture.h"
18 #include "SkRect.h" 19 #include "SkRect.h"
19 #include "SkRefCnt.h" 20 #include "SkRefCnt.h"
20 #include "SkStream.h" 21 #include "SkStream.h"
21 #include "SkTDArray.h" 22 #include "SkTDArray.h"
22 #include "SkTemplates.h" 23 #include "SkTemplates.h"
23 24
25 class CanvasTestStep;
vandebo (ex-Chrome) 2013/10/08 23:37:06 Extra
edisonn 2013/10/09 13:25:55 removed
24 class SkPDFArray; 26 class SkPDFArray;
25 class SkPDFDevice; 27 class SkPDFDevice;
26 class SkPDFDict; 28 class SkPDFDict;
27 class SkPDFFont; 29 class SkPDFFont;
28 class SkPDFFormXObject; 30 class SkPDFFormXObject;
29 class SkPDFGlyphSetMap; 31 class SkPDFGlyphSetMap;
30 class SkPDFGraphicState; 32 class SkPDFGraphicState;
31 class SkPDFObject; 33 class SkPDFObject;
32 class SkPDFResourceDict; 34 class SkPDFResourceDict;
33 class SkPDFShader; 35 class SkPDFShader;
(...skipping 22 matching lines...) Expand all
56 * This may be useful to, for example, move the origin in and 58 * This may be useful to, for example, move the origin in and
57 * over a bit to account for a margin, scale the canvas, 59 * over a bit to account for a margin, scale the canvas,
58 * or apply a rotation. Note1: the SkPDFDevice also applies 60 * or apply a rotation. Note1: the SkPDFDevice also applies
59 * a scale+translate transform to move the origin from the 61 * a scale+translate transform to move the origin from the
60 * bottom left (PDF default) to the top left. Note2: drawDevice 62 * bottom left (PDF default) to the top left. Note2: drawDevice
61 * (used by layer restore) draws the device after this initial 63 * (used by layer restore) draws the device after this initial
62 * transform is applied, so the PDF device does an 64 * transform is applied, so the PDF device does an
63 * inverse scale+translate to accommodate the one that SkPDFDevice 65 * inverse scale+translate to accommodate the one that SkPDFDevice
64 * always does. 66 * always does.
65 */ 67 */
66 // TODO(vandebo): The sizes should be SkSize and not SkISize. 68 // Deprecated, please use SkDocument::CreatePdf() instead.
67 SK_API SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize, 69 SK_API SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize,
68 const SkMatrix& initialTransform); 70 const SkMatrix& initialTransform);
69 SK_API virtual ~SkPDFDevice(); 71 SK_API virtual ~SkPDFDevice();
70 72
71 virtual uint32_t getDeviceCapabilities() SK_OVERRIDE; 73 virtual uint32_t getDeviceCapabilities() SK_OVERRIDE;
72 74
73 virtual void clear(SkColor color) SK_OVERRIDE; 75 virtual void clear(SkColor color) SK_OVERRIDE;
74 76
75 /** These are called inside the per-device-layer loop for each draw call. 77 /** These are called inside the per-device-layer loop for each draw call.
76 When these are called, we have already applied any saveLayer operations, 78 When these are called, we have already applied any saveLayer operations,
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 const SkMatrix& matrix, const SkPaint& paint); 306 const SkMatrix& matrix, const SkPaint& paint);
305 SkPDFDict* createLinkAnnotation(const SkRect& r, const SkMatrix& matrix); 307 SkPDFDict* createLinkAnnotation(const SkRect& r, const SkMatrix& matrix);
306 void handleLinkToURL(SkData* urlData, const SkRect& r, 308 void handleLinkToURL(SkData* urlData, const SkRect& r,
307 const SkMatrix& matrix); 309 const SkMatrix& matrix);
308 void handleLinkToNamedDest(SkData* nameData, const SkRect& r, 310 void handleLinkToNamedDest(SkData* nameData, const SkRect& r,
309 const SkMatrix& matrix); 311 const SkMatrix& matrix);
310 void defineNamedDestination(SkData* nameData, const SkPoint& point, 312 void defineNamedDestination(SkData* nameData, const SkPoint& point,
311 const SkMatrix& matrix); 313 const SkMatrix& matrix);
312 314
313 typedef SkBitmapDevice INHERITED; 315 typedef SkBitmapDevice INHERITED;
316
317 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to create
318 // an SkPDFDevice
319 friend class SkDocument_PDF;
vandebo (ex-Chrome) 2013/10/08 23:37:06 nit: omit the friends until they are needed
edisonn 2013/10/09 13:25:55 Done.
320 friend class SkPDFImageShader;
314 }; 321 };
315 322
316 #endif 323 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698