Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef SKIA_EXT_VECTOR_PLATFORM_DEVICE_SKIA_H_ | 5 #ifndef SKIA_EXT_RECORDING_PLATFORM_DEVICE_SKIA_H_ |
| 6 #define SKIA_EXT_VECTOR_PLATFORM_DEVICE_SKIA_H_ | 6 #define SKIA_EXT_RECORDING_PLATFORM_DEVICE_SKIA_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | |
| 11 #include "skia/ext/platform_device.h" | 10 #include "skia/ext/platform_device.h" |
| 12 #include "third_party/skia/include/core/SkRefCnt.h" | 11 #include "third_party/skia/include/core/SkRefCnt.h" |
| 13 #include "third_party/skia/include/core/SkTScopedPtr.h" | |
| 14 #include "third_party/skia/include/pdf/SkPDFDevice.h" | |
| 15 | 12 |
| 16 class SkMatrix; | 13 class SkPicture; |
| 17 | 14 |
| 18 namespace skia { | 15 namespace skia { |
| 19 | 16 |
| 20 class BitmapPlatformDevice; | 17 class BitmapPlatformDevice; |
| 21 | 18 |
| 22 class VectorPlatformDeviceSkia : public SkPDFDevice, public PlatformDevice { | 19 class RecordingPlatformDeviceSkia : public SkDevice, |
| 20 public PlatformDevice { | |
| 23 public: | 21 public: |
| 24 SK_API VectorPlatformDeviceSkia(const SkISize& pageSize, | 22 RecordingPlatformDeviceSkia( |
| 25 const SkISize& contentSize, | 23 const SkBitmap& bitmap, SkPicture* picture); |
| 26 const SkMatrix& initialTransform); | 24 virtual ~RecordingPlatformDeviceSkia(); |
| 27 virtual ~VectorPlatformDeviceSkia(); | |
| 28 | 25 |
| 29 // PlatformDevice methods. | 26 // Overridden from PlatformDevice: |
| 30 virtual bool SupportsPlatformPaint() OVERRIDE; | 27 virtual bool SupportsPlatformPaint() OVERRIDE; |
| 31 | 28 virtual bool SupportsDirectPlatformPaint() OVERRIDE; |
| 32 virtual PlatformSurface BeginPlatformPaint() OVERRIDE; | 29 virtual PlatformSurface BeginPlatformPaint() OVERRIDE; |
| 33 virtual void EndPlatformPaint() OVERRIDE; | 30 virtual void EndPlatformPaint() OVERRIDE; |
| 34 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
| 35 virtual void DrawToNativeContext(HDC dc, | 32 virtual void DrawToNativeContext(HDC dc, |
| 36 int x, | 33 int x, |
| 37 int y, | 34 int y, |
| 38 const RECT* src_rect) OVERRIDE; | 35 const RECT* src_rect) OVERRIDE; |
| 39 #elif defined(OS_MACOSX) | 36 #elif defined(OS_MACOSX) |
| 40 virtual void DrawToNativeContext(CGContext* context, | 37 virtual void DrawToNativeContext(CGContext* context, |
| 41 int x, | 38 int x, |
| 42 int y, | 39 int y, |
| 43 const CGRect* src_rect) OVERRIDE; | 40 const CGRect* src_rect) OVERRIDE; |
| 44 virtual CGContextRef GetBitmapContext() OVERRIDE; | 41 virtual CGContextRef GetBitmapContext() OVERRIDE; |
| 45 #elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_OPENBSD) | 42 #elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_OPENBSD) |
| 46 virtual void DrawToNativeContext(PlatformSurface surface, | 43 virtual void DrawToNativeContext(PlatformSurface surface, |
| 47 int x, | 44 int x, |
| 48 int y, | 45 int y, |
| 49 const PlatformRect* src_rect) OVERRIDE; | 46 const PlatformRect* src_rect) OVERRIDE; |
| 50 #endif | 47 #endif |
| 51 | 48 |
| 52 private: | 49 private: |
|
reed1
2012/09/20 13:42:28
No SkRefPtr please.
reveman
2012/09/20 17:01:26
will fix.
| |
| 53 SkRefPtr<BitmapPlatformDevice> raster_surface_; | 50 SkRefPtr<SkCanvas> raster_canvas_; |
| 51 SkMatrix raster_matrix_; | |
| 52 SkPicture* picture_; | |
| 54 | 53 |
| 55 DISALLOW_COPY_AND_ASSIGN(VectorPlatformDeviceSkia); | 54 DISALLOW_COPY_AND_ASSIGN(RecordingPlatformDeviceSkia); |
| 56 }; | 55 }; |
| 57 | 56 |
| 57 SK_API SkDevice* CreateRecordingPlatformDeviceSkia( | |
| 58 SkPicture* picture, int width, int height); | |
| 59 | |
| 58 } // namespace skia | 60 } // namespace skia |
| 59 | 61 |
| 60 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_SKIA_H_ | 62 #endif // SKIA_EXT_RECORDING_PLATFORM_DEVICE_SKIA_H_ |
| OLD | NEW |