OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "skia/ext/vector_platform_device_skia.h" | 5 #include "skia/ext/vector_platform_device_skia.h" |
6 | 6 |
7 #include "skia/ext/bitmap_platform_device.h" | 7 #include "skia/ext/bitmap_platform_device.h" |
8 #include "third_party/skia/include/core/SkClipStack.h" | 8 #include "third_party/skia/include/core/SkClipStack.h" |
9 #include "third_party/skia/include/core/SkDraw.h" | 9 #include "third_party/skia/include/core/SkDraw.h" |
10 #include "third_party/skia/include/core/SkRect.h" | 10 #include "third_party/skia/include/core/SkRect.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 SkDevice* device, | 179 SkDevice* device, |
180 int x, | 180 int x, |
181 int y, | 181 int y, |
182 const SkPaint& paint) { | 182 const SkPaint& paint) { |
183 SkDevice* real_device = device; | 183 SkDevice* real_device = device; |
184 if ((device->getDeviceCapabilities() & kVector_Capability)) { | 184 if ((device->getDeviceCapabilities() & kVector_Capability)) { |
185 // Assume that a vectorial device means a VectorPlatformDeviceSkia, we need | 185 // Assume that a vectorial device means a VectorPlatformDeviceSkia, we need |
186 // to unwrap the embedded SkPDFDevice. | 186 // to unwrap the embedded SkPDFDevice. |
187 VectorPlatformDeviceSkia* vector_device = | 187 VectorPlatformDeviceSkia* vector_device = |
188 static_cast<VectorPlatformDeviceSkia*>(device); | 188 static_cast<VectorPlatformDeviceSkia*>(device); |
| 189 vector_device->pdf_device_->setOrigin(vector_device->getOrigin().fX, |
| 190 vector_device->getOrigin().fY); |
189 real_device = vector_device->pdf_device_.get(); | 191 real_device = vector_device->pdf_device_.get(); |
190 } | 192 } |
191 pdf_device_->drawDevice(draw, real_device, x, y, paint); | 193 pdf_device_->drawDevice(draw, real_device, x, y, paint); |
192 } | 194 } |
193 | 195 |
194 #if defined(OS_WIN) | 196 #if defined(OS_WIN) |
195 void VectorPlatformDeviceSkia::DrawToNativeContext(HDC dc, | 197 void VectorPlatformDeviceSkia::DrawToNativeContext(HDC dc, |
196 int x, | 198 int x, |
197 int y, | 199 int y, |
198 const RECT* src_rect) { | 200 const RECT* src_rect) { |
(...skipping 15 matching lines...) Expand all Loading... |
214 SkDevice* VectorPlatformDeviceSkia::onCreateCompatibleDevice( | 216 SkDevice* VectorPlatformDeviceSkia::onCreateCompatibleDevice( |
215 SkBitmap::Config config, int width, int height, bool isOpaque, | 217 SkBitmap::Config config, int width, int height, bool isOpaque, |
216 Usage /*usage*/) { | 218 Usage /*usage*/) { |
217 SkAutoTUnref<SkDevice> dev(pdf_device_->createCompatibleDevice(config, width, | 219 SkAutoTUnref<SkDevice> dev(pdf_device_->createCompatibleDevice(config, width, |
218 height, | 220 height, |
219 isOpaque)); | 221 isOpaque)); |
220 return new VectorPlatformDeviceSkia(static_cast<SkPDFDevice*>(dev.get())); | 222 return new VectorPlatformDeviceSkia(static_cast<SkPDFDevice*>(dev.get())); |
221 } | 223 } |
222 | 224 |
223 } // namespace skia | 225 } // namespace skia |
OLD | NEW |