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 #ifndef SKIA_EXT_PLATFORM_DEVICE_H_ | 5 #ifndef SKIA_EXT_PLATFORM_DEVICE_H_ |
6 #define SKIA_EXT_PLATFORM_DEVICE_H_ | 6 #define SKIA_EXT_PLATFORM_DEVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // This file provides an easy way to include the appropriate PlatformDevice | 9 // This file provides an easy way to include the appropriate PlatformDevice |
10 // header file for your platform. | 10 // header file for your platform. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // BitmapPlatformDevice classes inherit directly from SkDevice, which is no | 48 // BitmapPlatformDevice classes inherit directly from SkDevice, which is no |
49 // longer a supported usage-pattern for skia. In preparation of the removal of | 49 // longer a supported usage-pattern for skia. In preparation of the removal of |
50 // these classes, all calls to PlatformDevice::* should be routed through these | 50 // these classes, all calls to PlatformDevice::* should be routed through these |
51 // helper functions. | 51 // helper functions. |
52 | 52 |
53 // Bind a PlatformDevice instance, |platform_device| to |device|. Subsequent | 53 // Bind a PlatformDevice instance, |platform_device| to |device|. Subsequent |
54 // calls to the functions exported below will forward the request to the | 54 // calls to the functions exported below will forward the request to the |
55 // corresponding method on the bound PlatformDevice instance. If no | 55 // corresponding method on the bound PlatformDevice instance. If no |
56 // PlatformDevice has been bound to the SkDevice passed, then the routines are | 56 // PlatformDevice has been bound to the SkDevice passed, then the routines are |
57 // NOPS. | 57 // NOPS. |
| 58 // Pass |transfer_ownership| as true ensure that |platform_device| has the same |
| 59 // lifetime as |device|. |
58 SK_API void SetPlatformDevice(SkDevice* device, | 60 SK_API void SetPlatformDevice(SkDevice* device, |
59 PlatformDevice* platform_device); | 61 PlatformDevice* platform_device, |
| 62 bool transfer_ownership); |
60 SK_API PlatformDevice* GetPlatformDevice(SkDevice* device); | 63 SK_API PlatformDevice* GetPlatformDevice(SkDevice* device); |
61 | 64 |
62 } // namespace skia | 65 } // namespace skia |
63 | 66 |
64 #if defined(WIN32) | 67 #if defined(WIN32) |
65 #include "skia/ext/platform_device_win.h" | 68 #include "skia/ext/platform_device_win.h" |
66 #elif defined(__APPLE__) | 69 #elif defined(__APPLE__) |
67 #include "skia/ext/platform_device_mac.h" | 70 #include "skia/ext/platform_device_mac.h" |
68 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ | 71 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ |
69 defined(__sun) | 72 defined(__sun) |
70 #include "skia/ext/platform_device_linux.h" | 73 #include "skia/ext/platform_device_linux.h" |
71 #endif | 74 #endif |
72 | 75 |
73 #endif | 76 #endif |
OLD | NEW |