Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 SkXPSDevice_DEFINED | 8 #ifndef SkXPSDevice_DEFINED |
| 9 #define SkXPSDevice_DEFINED | 9 #define SkXPSDevice_DEFINED |
| 10 | 10 |
| 11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
| 12 #include <ObjBase.h> | 12 #include <ObjBase.h> |
| 13 #include <XpsObjectModel.h> | 13 #include <XpsObjectModel.h> |
| 14 | 14 |
| 15 #include "SkAutoCoInitialize.h" | 15 #include "SkAutoCoInitialize.h" |
| 16 #include "SkBitmapDevice.h" | 16 #include "SkBitmapDevice.h" |
| 17 #include "SkBitSet.h" | 17 #include "SkBitSet.h" |
| 18 #include "SkCanvas.h" | 18 #include "SkCanvas.h" |
| 19 #include "SkColor.h" | 19 #include "SkColor.h" |
| 20 #include "SkPaint.h" | 20 #include "SkPaint.h" |
| 21 #include "SkPath.h" | 21 #include "SkPath.h" |
| 22 #include "SkPoint.h" | 22 #include "SkPoint.h" |
| 23 #include "SkShader.h" | 23 #include "SkShader.h" |
| 24 #include "SkSize.h" | 24 #include "SkSize.h" |
| 25 #include "SkTArray.h" | 25 #include "SkTArray.h" |
| 26 #include "SkTScopedComPtr.h" | 26 #include "SkTScopedComPtr.h" |
| 27 #include "SkTypeface.h" | 27 #include "SkTypeface.h" |
| 28 | 28 |
| 29 //#define SK_XPS_USE_DETERMINISTIC_IDS | |
| 30 | |
| 29 /** \class SkXPSDevice | 31 /** \class SkXPSDevice |
| 30 | 32 |
| 31 The drawing context for the XPS backend. | 33 The drawing context for the XPS backend. |
| 32 */ | 34 */ |
| 33 class SkXPSDevice : public SkBitmapDevice { | 35 class SkXPSDevice : public SkBitmapDevice { |
| 34 public: | 36 public: |
| 35 SK_API SkXPSDevice(); | 37 SK_API SkXPSDevice(); |
| 36 SK_API virtual ~SkXPSDevice(); | 38 SK_API virtual ~SkXPSDevice(); |
| 37 | 39 |
| 38 virtual bool beginPortfolio(SkWStream* outputStream); | 40 virtual bool beginPortfolio(SkWStream* outputStream); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 SkTScopedComPtr<IXpsOMPackageWriter> fPackageWriter; | 167 SkTScopedComPtr<IXpsOMPackageWriter> fPackageWriter; |
| 166 | 168 |
| 167 unsigned int fCurrentPage; | 169 unsigned int fCurrentPage; |
| 168 SkTScopedComPtr<IXpsOMCanvas> fCurrentXpsCanvas; | 170 SkTScopedComPtr<IXpsOMCanvas> fCurrentXpsCanvas; |
| 169 SkSize fCurrentCanvasSize; | 171 SkSize fCurrentCanvasSize; |
| 170 SkVector fCurrentUnitsPerMeter; | 172 SkVector fCurrentUnitsPerMeter; |
| 171 SkVector fCurrentPixelsPerMeter; | 173 SkVector fCurrentPixelsPerMeter; |
| 172 | 174 |
| 173 SkTArray<TypefaceUse, true> fTypefaces; | 175 SkTArray<TypefaceUse, true> fTypefaces; |
| 174 | 176 |
| 177 /** Creates a GUID based id and places it into buffer. | |
| 178 buffer should have space for at least GUID_ID_LEN wide characters. | |
| 179 The string will always be wchar null terminated. | |
| 180 XXXXXXXXsXXXXsXXXXsXXXXsXXXXXXXXXXXX0 | |
| 181 The string may begin with a digit, | |
| 182 and so may not be suitable as a bare resource key. | |
| 183 */ | |
| 184 HRESULT createId(wchar_t* buffer, size_t bufferSize, wchar_t sep = '-'); | |
| 185 #ifdef SK_XPS_USE_DETERMINISTIC_IDS | |
| 186 decltype(GUID::Data1) fNextId = 0; | |
|
mtklein
2014/08/22 18:23:34
Would prefer DWORD, whatever explicitly.
| |
| 187 #endif | |
| 188 | |
| 175 HRESULT initXpsDocumentWriter(IXpsOMImageResource* image); | 189 HRESULT initXpsDocumentWriter(IXpsOMImageResource* image); |
| 176 | 190 |
| 177 HRESULT createXpsPage( | 191 HRESULT createXpsPage( |
| 178 const XPS_SIZE& pageSize, | 192 const XPS_SIZE& pageSize, |
| 179 IXpsOMPage** page); | 193 IXpsOMPage** page); |
| 180 | 194 |
| 181 HRESULT createXpsThumbnail( | 195 HRESULT createXpsThumbnail( |
| 182 IXpsOMPage* page, const unsigned int pageNumber, | 196 IXpsOMPage* page, const unsigned int pageNumber, |
| 183 IXpsOMImageResource** image); | 197 IXpsOMImageResource** image); |
| 184 | 198 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; | 322 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; |
| 309 | 323 |
| 310 // Disable the default copy and assign implementation. | 324 // Disable the default copy and assign implementation. |
| 311 SkXPSDevice(const SkXPSDevice&); | 325 SkXPSDevice(const SkXPSDevice&); |
| 312 void operator=(const SkXPSDevice&); | 326 void operator=(const SkXPSDevice&); |
| 313 | 327 |
| 314 typedef SkBitmapDevice INHERITED; | 328 typedef SkBitmapDevice INHERITED; |
| 315 }; | 329 }; |
| 316 | 330 |
| 317 #endif | 331 #endif |
| OLD | NEW |