| 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 #include "SkTypes.h" | 8 #include "SkTypes.h" |
| 9 | 9 |
| 10 #ifndef UNICODE | 10 #ifndef UNICODE |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 | 106 |
| 107 static SkBitmap make_fake_bitmap(int width, int height) { | 107 static SkBitmap make_fake_bitmap(int width, int height) { |
| 108 SkBitmap bitmap; | 108 SkBitmap bitmap; |
| 109 bitmap.setInfo(SkImageInfo::MakeUnknown(width, height)); | 109 bitmap.setInfo(SkImageInfo::MakeUnknown(width, height)); |
| 110 return bitmap; | 110 return bitmap; |
| 111 } | 111 } |
| 112 | 112 |
| 113 // TODO: should inherit from SkBaseDevice instead of SkBitmapDevice... | 113 // TODO: should inherit from SkBaseDevice instead of SkBitmapDevice... |
| 114 SkXPSDevice::SkXPSDevice() | 114 SkXPSDevice::SkXPSDevice() |
| 115 : SkBitmapDevice(make_fake_bitmap(10000, 10000)) | 115 : INHERITED(make_fake_bitmap(10000, 10000), SkSurfaceProps(0, kUnknown_SkPix
elGeometry)) |
| 116 , fCurrentPage(0) { | 116 , fCurrentPage(0) { |
| 117 } | 117 } |
| 118 | 118 |
| 119 SkXPSDevice::SkXPSDevice(IXpsOMObjectFactory* xpsFactory) |
| 120 : INHERITED(make_fake_bitmap(10000, 10000), SkSurfaceProps(0, kUnknown_SkPix
elGeometry)) |
| 121 , fCurrentPage(0) { |
| 122 |
| 123 HRVM(CoCreateInstance( |
| 124 CLSID_XpsOMObjectFactory, |
| 125 NULL, |
| 126 CLSCTX_INPROC_SERVER, |
| 127 IID_PPV_ARGS(&this->fXpsFactory)), |
| 128 "Could not create factory for layer."); |
| 129 |
| 130 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas), |
| 131 "Could not create canvas for layer."); |
| 132 } |
| 133 |
| 119 SkXPSDevice::~SkXPSDevice() { | 134 SkXPSDevice::~SkXPSDevice() { |
| 120 } | 135 } |
| 121 | 136 |
| 122 SkXPSDevice::TypefaceUse::TypefaceUse() | 137 SkXPSDevice::TypefaceUse::TypefaceUse() |
| 123 : typefaceId(0xffffffff) | 138 : typefaceId(0xffffffff) |
| 124 , fontData(NULL) | 139 , fontData(NULL) |
| 125 , xpsFont(NULL) | 140 , xpsFont(NULL) |
| 126 , glyphsUsed(NULL) { | 141 , glyphsUsed(NULL) { |
| 127 } | 142 } |
| 128 | 143 |
| (...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2252 //To what stream do we write? | 2267 //To what stream do we write? |
| 2253 //SkXPSDevice* dev = new SkXPSDevice(this); | 2268 //SkXPSDevice* dev = new SkXPSDevice(this); |
| 2254 //SkSize s = SkSize::Make(width, height); | 2269 //SkSize s = SkSize::Make(width, height); |
| 2255 //dev->BeginCanvas(s, s, SkMatrix::I()); | 2270 //dev->BeginCanvas(s, s, SkMatrix::I()); |
| 2256 //return dev; | 2271 //return dev; |
| 2257 } | 2272 } |
| 2258 #endif | 2273 #endif |
| 2259 return new SkXPSDevice(this->fXpsFactory.get()); | 2274 return new SkXPSDevice(this->fXpsFactory.get()); |
| 2260 } | 2275 } |
| 2261 | 2276 |
| 2262 SkXPSDevice::SkXPSDevice(IXpsOMObjectFactory* xpsFactory) | |
| 2263 : SkBitmapDevice(make_fake_bitmap(10000, 10000)) | |
| 2264 , fCurrentPage(0) { | |
| 2265 | |
| 2266 HRVM(CoCreateInstance( | |
| 2267 CLSID_XpsOMObjectFactory, | |
| 2268 NULL, | |
| 2269 CLSCTX_INPROC_SERVER, | |
| 2270 IID_PPV_ARGS(&this->fXpsFactory)), | |
| 2271 "Could not create factory for layer."); | |
| 2272 | |
| 2273 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas), | |
| 2274 "Could not create canvas for layer."); | |
| 2275 } | |
| 2276 | |
| OLD | NEW |