blob: 6b3afb12d48b05b12a3bcbc9cb2a0e748300708d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKIA_EXT_PLATFORM_DEVICE_H_
#define SKIA_EXT_PLATFORM_DEVICE_H_
#pragma once
// This file provides an easy way to include the appropriate PlatformDevice
// header file for your platform.
#if defined(WIN32)
#include <windows.h>
#endif
#include "third_party/skia/include/core/SkPreConfig.h"
#include "third_party/skia/include/core/SkColor.h"
class SkDevice;
struct SkIRect;
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__sun)
typedef struct _cairo cairo_t;
typedef struct _cairo_rectangle cairo_rectangle_t;
#elif defined(__APPLE__)
typedef struct CGContext* CGContextRef;
typedef struct CGRect CGRect;
#endif
namespace skia {
class PlatformDevice;
#if defined(WIN32)
typedef HDC PlatformSurface;
typedef RECT PlatformRect;
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__sun)
typedef cairo_t* PlatformSurface;
typedef cairo_rectangle_t PlatformRect;
#elif defined(__APPLE__)
typedef CGContextRef PlatformSurface;
typedef CGRect PlatformRect;
#endif
// The following routines provide accessor points for the functionality
// exported by the various PlatformDevice ports. The PlatformDevice, and
// BitmapPlatformDevice classes inherit directly from SkDevice, which is no
// longer a supported usage-pattern for skia. In preparation of the removal of
// these classes, all calls to PlatformDevice::* should be routed through these
// helper functions.
// Bind a PlatformDevice instance, |platform_device| to |device|. Subsequent
// calls to the functions exported below will forward the request to the
// corresponding method on the bound PlatformDevice instance. If no
// PlatformDevice has been bound to the SkDevice passed, then the routines are
// NOPS.
SK_API void SetPlatformDevice(SkDevice* device,
PlatformDevice* platform_device);
SK_API PlatformDevice* GetPlatformDevice(SkDevice* device);
} // namespace skia
#if defined(WIN32)
#include "skia/ext/platform_device_win.h"
#elif defined(__APPLE__)
#include "skia/ext/platform_device_mac.h"
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
defined(__sun)
#include "skia/ext/platform_device_linux.h"
#endif
#endif
|