blob: afab728666019059e478bef391e1cf782c47fb02 [file] [log] [blame]
reed@android.com8a1c16f2008-12-17 15:59:43 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * Copyright 2006 The Android Open Source Project
reed@android.com8a1c16f2008-12-17 15:59:43 +00003 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00004 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
reed@android.com8a1c16f2008-12-17 15:59:43 +00006 */
7
8#ifndef SkTypes_DEFINED
9#define SkTypes_DEFINED
10
bungemanf20488b2015-07-29 11:49:40 -070011// IWYU pragma: begin_exports
bsalomonf48c62f2016-07-08 03:28:42 -070012
13// In at least two known scenarios when using GCC with libc++:
14// * GCC 4.8 targeting ARMv7 with NEON
15// * GCC 4.9 targeting ARMv8 64 bit
16// we need to typedef float float32_t (or include <arm_neon.h> which does that)
17// before #including <memory>. This makes no sense. I'm not very interested in
18// understanding why... these are old, bizarre platform configuration that we
19// should just let die.
bungeman7ad42cf2016-07-08 12:25:37 -070020// See https://llvm.org/bugs/show_bug.cgi?id=25608 .
bsalomonf48c62f2016-07-08 03:28:42 -070021#include <ciso646> // Include something innocuous to define _LIBCPP_VERISON if it's libc++.
22#if defined(__GNUC__) && __GNUC__ == 4 \
bungeman7ad42cf2016-07-08 12:25:37 -070023 && ((defined(__arm__) && (defined(__ARM_NEON__) || defined(__ARM_NEON))) || defined(__aarch64__)) \
bsalomonf48c62f2016-07-08 03:28:42 -070024 && defined(_LIBCPP_VERSION)
25 typedef float float32_t;
26 #include <memory>
27#endif
28
reed@android.com8a1c16f2008-12-17 15:59:43 +000029#include "SkPreConfig.h"
30#include "SkUserConfig.h"
31#include "SkPostConfig.h"
bungemanf20488b2015-07-29 11:49:40 -070032#include <stddef.h>
bungeman@google.comfab44db2013-10-11 18:50:45 +000033#include <stdint.h>
bungemanf20488b2015-07-29 11:49:40 -070034// IWYU pragma: end_exports
35
bungemanf20488b2015-07-29 11:49:40 -070036#include <string.h>
Mike Reedea5e6762017-03-02 20:22:35 +000037
reed@android.com8a1c16f2008-12-17 15:59:43 +000038/** \file SkTypes.h
39*/
40
reed@android.com9aa8b322010-04-13 13:22:54 +000041/** See SkGraphics::GetVersion() to retrieve these at runtime
42 */
43#define SKIA_VERSION_MAJOR 1
44#define SKIA_VERSION_MINOR 0
45#define SKIA_VERSION_PATCH 0
46
reed@android.com8a1c16f2008-12-17 15:59:43 +000047
reed@android.com8a1c16f2008-12-17 15:59:43 +000048/** Called internally if we hit an unrecoverable error.
49 The platform implementation must not return, but should either throw
50 an exception or otherwise exit.
51*/
djsollenf2b340f2016-01-29 08:51:04 -080052SK_API extern void sk_abort_no_print(void);
reed@android.com8a1c16f2008-12-17 15:59:43 +000053
reed@android.com8a1c16f2008-12-17 15:59:43 +000054#define SK_INIT_TO_AVOID_WARNING = 0
55
56#ifndef SkDebugf
georgec4ade572014-08-01 12:02:07 -070057 SK_API void SkDebugf(const char format[], ...);
reed@android.com8a1c16f2008-12-17 15:59:43 +000058#endif
59
Mike Klein37bbfe32017-09-28 09:47:45 -040060// SkASSERT, SkASSERTF and SkASSERT_RELEASE can be used as stand alone assertion expressions, e.g.
61// uint32_t foo(int x) {
62// SkASSERT(x > 4);
63// return x - 4;
64// }
65// and are also written to be compatible with constexpr functions:
66// constexpr uint32_t foo(int x) {
67// return SkASSERT(x > 4),
68// x - 4;
69// }
caryclarkd6562002016-07-27 12:02:07 -070070#define SkASSERT_RELEASE(cond) \
Mike Klein37bbfe32017-09-28 09:47:45 -040071 static_cast<void>( (cond) ? (void)0 : []{ SK_ABORT("assert(" #cond ")"); }() )
djsollenf2b340f2016-01-29 08:51:04 -080072
reed@android.com8a1c16f2008-12-17 15:59:43 +000073#ifdef SK_DEBUG
Mike Klein37bbfe32017-09-28 09:47:45 -040074 #define SkASSERT(cond) SkASSERT_RELEASE(cond)
75 #define SkASSERTF(cond, fmt, ...) static_cast<void>( (cond) ? (void)0 : [&]{ \
76 SkDebugf(fmt"\n", __VA_ARGS__); \
77 SK_ABORT("assert(" #cond ")"); \
78 }() )
bungeman1f790aa2016-07-20 09:49:10 -070079 #define SkDEBUGFAIL(message) SK_ABORT(message)
herb966e3d32015-09-18 07:00:48 -070080 #define SkDEBUGFAILF(fmt, ...) SkASSERTF(false, fmt, ##__VA_ARGS__)
csmartdaltonceeaa782016-08-10 10:07:57 -070081 #define SkDEBUGCODE(...) __VA_ARGS__
reed@android.com8a1c16f2008-12-17 15:59:43 +000082 #define SkDEBUGF(args ) SkDebugf args
83 #define SkAssertResult(cond) SkASSERT(cond)
84#else
Mike Klein37bbfe32017-09-28 09:47:45 -040085 #define SkASSERT(cond) static_cast<void>(0)
86 #define SkASSERTF(cond, fmt, ...) static_cast<void>(0)
tomhudson@google.com0c00f212011-12-28 14:59:50 +000087 #define SkDEBUGFAIL(message)
hsterne6f8ff02016-08-15 15:26:31 -070088 #define SkDEBUGFAILF(fmt, ...)
csmartdaltonceeaa782016-08-10 10:07:57 -070089 #define SkDEBUGCODE(...)
reed@android.com8a1c16f2008-12-17 15:59:43 +000090 #define SkDEBUGF(args)
reed@android.com8a1c16f2008-12-17 15:59:43 +000091
bsalomon9daa4b92016-05-09 09:14:36 -070092 // unlike SkASSERT, this guy executes its condition in the non-debug build.
bsalomon1b4c01c2016-05-09 12:35:17 -070093 // The if is present so that this can be used with functions marked SK_WARN_UNUSED_RESULT.
94 #define SkAssertResult(cond) if (cond) {} do {} while(false)
reed@android.com8a1c16f2008-12-17 15:59:43 +000095#endif
96
commit-bot@chromium.org0f10f7b2014-03-13 18:02:17 +000097#ifdef SK_IGNORE_TO_STRING
skia.committer@gmail.combc3d92a2014-03-14 03:02:26 +000098 #define SK_TO_STRING_NONVIRT()
99 #define SK_TO_STRING_VIRT()
commit-bot@chromium.org0f10f7b2014-03-13 18:02:17 +0000100 #define SK_TO_STRING_PUREVIRT()
101 #define SK_TO_STRING_OVERRIDE()
102#else
bungemand3ebb482015-08-05 13:57:49 -0700103 class SkString;
commit-bot@chromium.org0f10f7b2014-03-13 18:02:17 +0000104 // the 'toString' helper functions convert Sk* objects to human-readable
105 // form in developer mode
106 #define SK_TO_STRING_NONVIRT() void toString(SkString* str) const;
107 #define SK_TO_STRING_VIRT() virtual void toString(SkString* str) const;
108 #define SK_TO_STRING_PUREVIRT() virtual void toString(SkString* str) const = 0;
mtklein36352bf2015-03-25 18:17:31 -0700109 #define SK_TO_STRING_OVERRIDE() void toString(SkString* str) const override;
robertphillips@google.com76f9e932013-01-15 20:17:47 +0000110#endif
111
reed@google.com49a5b192012-10-25 17:31:39 +0000112/*
113 * Usage: SK_MACRO_CONCAT(a, b) to construct the symbol ab
114 *
115 * SK_MACRO_CONCAT_IMPL_PRIV just exists to make this work. Do not use directly
116 *
117 */
118#define SK_MACRO_CONCAT(X, Y) SK_MACRO_CONCAT_IMPL_PRIV(X, Y)
119#define SK_MACRO_CONCAT_IMPL_PRIV(X, Y) X ## Y
120
121/*
122 * Usage: SK_MACRO_APPEND_LINE(foo) to make foo123, where 123 is the current
123 * line number. Easy way to construct
124 * unique names for local functions or
125 * variables.
126 */
127#define SK_MACRO_APPEND_LINE(name) SK_MACRO_CONCAT(name, __LINE__)
128
commit-bot@chromium.orge61a86c2013-11-18 16:03:59 +0000129/**
130 * For some classes, it's almost always an error to instantiate one without a name, e.g.
131 * {
132 * SkAutoMutexAcquire(&mutex);
133 * <some code>
134 * }
135 * In this case, the writer meant to hold mutex while the rest of the code in the block runs,
136 * but instead the mutex is acquired and then immediately released. The correct usage is
137 * {
138 * SkAutoMutexAcquire lock(&mutex);
139 * <some code>
140 * }
141 *
142 * To prevent callers from instantiating your class without a name, use SK_REQUIRE_LOCAL_VAR
143 * like this:
144 * class classname {
145 * <your class>
146 * };
147 * #define classname(...) SK_REQUIRE_LOCAL_VAR(classname)
148 *
149 * This won't work with templates, and you must inline the class' constructors and destructors.
150 * Take a look at SkAutoFree and SkAutoMalloc in this file for examples.
151 */
152#define SK_REQUIRE_LOCAL_VAR(classname) \
bungeman99fe8222015-08-20 07:57:51 -0700153 static_assert(false, "missing name for " #classname)
commit-bot@chromium.orge61a86c2013-11-18 16:03:59 +0000154
reed@android.com8a1c16f2008-12-17 15:59:43 +0000155///////////////////////////////////////////////////////////////////////
156
reed@google.com37a31332011-01-25 14:55:42 +0000157/**
158 * Fast type for signed 8 bits. Use for parameter passing and local variables,
159 * not for storage.
160 */
161typedef int S8CPU;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000162
reed@google.com37a31332011-01-25 14:55:42 +0000163/**
164 * Fast type for unsigned 8 bits. Use for parameter passing and local
165 * variables, not for storage
166 */
167typedef unsigned U8CPU;
168
169/**
170 * Fast type for signed 16 bits. Use for parameter passing and local variables,
171 * not for storage
172 */
173typedef int S16CPU;
174
175/**
176 * Fast type for unsigned 16 bits. Use for parameter passing and local
177 * variables, not for storage
178 */
179typedef unsigned U16CPU;
180
181/**
reed@google.com37a31332011-01-25 14:55:42 +0000182 * Meant to be a small version of bool, for storage purposes. Will be 0 or 1
183 */
184typedef uint8_t SkBool8;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000185
bungeman68c14d92016-03-19 15:06:56 -0700186#include "../private/SkTFitsIn.h"
Ben Wagnerd71c6d12017-10-17 17:40:56 -0400187template <typename D, typename S> constexpr D SkTo(S s) {
188 return SkASSERT(SkTFitsIn<D>(s)),
189 static_cast<D>(s);
bungeman68c14d92016-03-19 15:06:56 -0700190}
191#define SkToS8(x) SkTo<int8_t>(x)
192#define SkToU8(x) SkTo<uint8_t>(x)
193#define SkToS16(x) SkTo<int16_t>(x)
194#define SkToU16(x) SkTo<uint16_t>(x)
195#define SkToS32(x) SkTo<int32_t>(x)
196#define SkToU32(x) SkTo<uint32_t>(x)
197#define SkToInt(x) SkTo<int>(x)
198#define SkToUInt(x) SkTo<unsigned>(x)
199#define SkToSizeT(x) SkTo<size_t>(x)
reed@android.com8a1c16f2008-12-17 15:59:43 +0000200
201/** Returns 0 or 1 based on the condition
202*/
Ben Wagner5b071782017-08-28 15:06:57 -0400203#define SkToBool(cond) ((cond) != 0)
reed@android.com8a1c16f2008-12-17 15:59:43 +0000204
205#define SK_MaxS16 32767
206#define SK_MinS16 -32767
207#define SK_MaxU16 0xFFFF
208#define SK_MinU16 0
209#define SK_MaxS32 0x7FFFFFFF
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000210#define SK_MinS32 -SK_MaxS32
reed@android.com8a1c16f2008-12-17 15:59:43 +0000211#define SK_MaxU32 0xFFFFFFFF
212#define SK_MinU32 0
caryclark952538e2016-02-26 05:01:42 -0800213#define SK_NaN32 ((int) (1U << 31))
Mike Reed72818012017-10-09 11:37:44 -0400214#define SK_MaxSizeT SIZE_MAX
Mike Reed3d5a6b52018-01-31 15:55:47 -0500215static constexpr int64_t SK_MaxS64 = 0x7FFFFFFFFFFFFFFF;
216static constexpr int64_t SK_MinS64 = -SK_MaxS64;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000217
caryclark3127c992015-12-09 12:02:30 -0800218static inline int32_t SkLeftShift(int32_t value, int32_t shift) {
219 return (int32_t) ((uint32_t) value << shift);
220}
221
222static inline int64_t SkLeftShift(int64_t value, int32_t shift) {
223 return (int64_t) ((uint64_t) value << shift);
224}
225
reed@android.comd4577752009-11-21 02:48:11 +0000226//////////////////////////////////////////////////////////////////////////////
reed@android.com8a1c16f2008-12-17 15:59:43 +0000227
mtkleinfc00a7c2015-05-07 10:58:44 -0700228/** Returns the number of entries in an array (not a pointer) */
229template <typename T, size_t N> char (&SkArrayCountHelper(T (&array)[N]))[N];
caryclark95b96d62015-08-19 10:12:59 -0700230#define SK_ARRAY_COUNT(array) (sizeof(SkArrayCountHelper(array)))
reed@android.com8a1c16f2008-12-17 15:59:43 +0000231
mtkleinb68ce742015-11-24 05:35:58 -0800232// Can be used to bracket data types that must be dense, e.g. hash keys.
233#if defined(__clang__) // This should work on GCC too, but GCC diagnostic pop didn't seem to work!
234 #define SK_BEGIN_REQUIRE_DENSE _Pragma("GCC diagnostic push") \
235 _Pragma("GCC diagnostic error \"-Wpadded\"")
236 #define SK_END_REQUIRE_DENSE _Pragma("GCC diagnostic pop")
237#else
238 #define SK_BEGIN_REQUIRE_DENSE
239 #define SK_END_REQUIRE_DENSE
240#endif
241
mtklein6a259bf2016-09-26 18:20:57 -0700242#define SkAlign2(x) (((x) + 1) >> 1 << 1)
243#define SkIsAlign2(x) (0 == ((x) & 1))
reed@android.com8a1c16f2008-12-17 15:59:43 +0000244
mtklein6a259bf2016-09-26 18:20:57 -0700245#define SkAlign4(x) (((x) + 3) >> 2 << 2)
246#define SkIsAlign4(x) (0 == ((x) & 3))
reed@google.comc6faa5a2012-06-27 15:07:11 +0000247
mtklein6a259bf2016-09-26 18:20:57 -0700248#define SkAlign8(x) (((x) + 7) >> 3 << 3)
249#define SkIsAlign8(x) (0 == ((x) & 7))
tomhudson@google.com01224d52011-11-28 18:22:01 +0000250
mtklein6a259bf2016-09-26 18:20:57 -0700251#define SkAlign16(x) (((x) + 15) >> 4 << 4)
252#define SkIsAlign16(x) (0 == ((x) & 15))
reede2b0a0a2016-03-02 13:03:46 -0800253
mtklein6a259bf2016-09-26 18:20:57 -0700254#define SkAlignPtr(x) (sizeof(void*) == 8 ? SkAlign8(x) : SkAlign4(x))
255#define SkIsAlignPtr(x) (sizeof(void*) == 8 ? SkIsAlign8(x) : SkIsAlign4(x))
mtklein0209e952014-08-28 14:10:05 -0700256
reed@android.com8a1c16f2008-12-17 15:59:43 +0000257typedef uint32_t SkFourByteTag;
258#define SkSetFourByteTag(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
259
260/** 32 bit integer to hold a unicode value
261*/
262typedef int32_t SkUnichar;
benjaminwagnerec4d4d72016-03-25 12:59:53 -0700263
halcanaryd0e95a52016-07-25 07:18:12 -0700264/** 16 bit unsigned integer to hold a glyph index
265*/
266typedef uint16_t SkGlyphID;
267
benjaminwagnerec4d4d72016-03-25 12:59:53 -0700268/** 32 bit value to hold a millisecond duration
269 * Note that SK_MSecMax is about 25 days.
270 */
reed@android.com8a1c16f2008-12-17 15:59:43 +0000271typedef uint32_t SkMSec;
272/** 1 second measured in milliseconds
273*/
274#define SK_MSec1 1000
benjaminwagnerec4d4d72016-03-25 12:59:53 -0700275/** maximum representable milliseconds; 24d 20h 31m 23.647s.
reed@android.com8a1c16f2008-12-17 15:59:43 +0000276*/
277#define SK_MSecMax 0x7FFFFFFF
278/** Returns a < b for milliseconds, correctly handling wrap-around from 0xFFFFFFFF to 0
279*/
280#define SkMSec_LT(a, b) ((int32_t)(a) - (int32_t)(b) < 0)
281/** Returns a <= b for milliseconds, correctly handling wrap-around from 0xFFFFFFFF to 0
282*/
283#define SkMSec_LE(a, b) ((int32_t)(a) - (int32_t)(b) <= 0)
284
commit-bot@chromium.org2b4e3702014-04-07 18:26:22 +0000285/** The generation IDs in Skia reserve 0 has an invalid marker.
286 */
287#define SK_InvalidGenID 0
bsalomon1c63bf62014-07-22 13:09:46 -0700288/** The unique IDs in Skia reserve 0 has an invalid marker.
289 */
290#define SK_InvalidUniqueID 0
commit-bot@chromium.org2b4e3702014-04-07 18:26:22 +0000291
reed@android.com8a1c16f2008-12-17 15:59:43 +0000292/****************************************************************************
293 The rest of these only build with C++
294*/
295#ifdef __cplusplus
296
297/** Faster than SkToBool for integral conditions. Returns 0 or 1
298*/
bsalomon7a5bcc52016-05-24 13:23:56 -0700299static inline constexpr int Sk32ToBool(uint32_t n) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000300 return (n | (0-n)) >> 31;
301}
302
bsalomon@google.comff436612013-02-27 19:07:32 +0000303/** Generic swap function. Classes with efficient swaps should specialize this function to take
304 their fast path. This function is used by SkTSort. */
Mike Kleinbde64e42016-11-14 08:39:39 -0500305template <typename T> static inline void SkTSwap(T& a, T& b) {
bungeman6f4293a2016-10-26 12:11:28 -0700306 T c(std::move(a));
307 a = std::move(b);
308 b = std::move(c);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000309}
310
reed@android.comd4577752009-11-21 02:48:11 +0000311static inline int32_t SkAbs32(int32_t value) {
mtklein09a22e92014-11-21 11:38:53 -0800312 SkASSERT(value != SK_NaN32); // The most negative int32_t can't be negated.
commit-bot@chromium.org38bad322013-07-30 13:16:29 +0000313 if (value < 0) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000314 value = -value;
commit-bot@chromium.org38bad322013-07-30 13:16:29 +0000315 }
reed@android.com8a1c16f2008-12-17 15:59:43 +0000316 return value;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000317}
318
Mike Kleinbde64e42016-11-14 08:39:39 -0500319template <typename T> static inline T SkTAbs(T value) {
reed@google.com2b57dc62013-01-08 13:23:32 +0000320 if (value < 0) {
321 value = -value;
322 }
323 return value;
324}
325
reed@android.comd4577752009-11-21 02:48:11 +0000326static inline int32_t SkMax32(int32_t a, int32_t b) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000327 if (a < b)
328 a = b;
329 return a;
330}
331
reed@android.comd4577752009-11-21 02:48:11 +0000332static inline int32_t SkMin32(int32_t a, int32_t b) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000333 if (a > b)
334 a = b;
335 return a;
336}
337
halcanarya0af7712016-05-23 09:11:58 -0700338template <typename T> constexpr const T& SkTMin(const T& a, const T& b) {
caryclark@google.com3b97af52013-04-23 11:56:44 +0000339 return (a < b) ? a : b;
340}
341
halcanarya0af7712016-05-23 09:11:58 -0700342template <typename T> constexpr const T& SkTMax(const T& a, const T& b) {
caryclark@google.com3b97af52013-04-23 11:56:44 +0000343 return (b < a) ? a : b;
344}
345
reed@android.comd4577752009-11-21 02:48:11 +0000346static inline int32_t SkSign32(int32_t a) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000347 return (a >> 31) | ((unsigned) -a >> 31);
348}
349
reed@android.comd4577752009-11-21 02:48:11 +0000350static inline int32_t SkFastMin32(int32_t value, int32_t max) {
commit-bot@chromium.org38bad322013-07-30 13:16:29 +0000351 if (value > max) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000352 value = max;
commit-bot@chromium.org38bad322013-07-30 13:16:29 +0000353 }
reed@android.com8a1c16f2008-12-17 15:59:43 +0000354 return value;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000355}
356
bungeman62ce0302015-08-28 09:09:32 -0700357/** Returns value pinned between min and max, inclusively. */
halcanarya0af7712016-05-23 09:11:58 -0700358template <typename T> static constexpr const T& SkTPin(const T& value, const T& min, const T& max) {
bungeman62ce0302015-08-28 09:09:32 -0700359 return SkTMax(SkTMin(value, max), min);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000360}
361
bsalomon5ec26ae2016-02-25 08:33:02 -0800362
363///////////////////////////////////////////////////////////////////////////////
364
365/**
366 * Indicates whether an allocation should count against a cache budget.
367 */
368enum class SkBudgeted : bool {
369 kNo = false,
370 kYes = true
371};
372
robertphillips76948d42016-05-04 12:47:41 -0700373/**
374 * Indicates whether a backing store needs to be an exact match or can be larger
375 * than is strictly necessary
376 */
377enum class SkBackingFit {
378 kApprox,
379 kExact
380};
381
reed@google.com1fcd51e2011-01-05 15:50:27 +0000382///////////////////////////////////////////////////////////////////////////////
383
vandebo@chromium.org325cb9a2011-03-30 18:36:29 +0000384/** Use to combine multiple bits in a bitmask in a type safe way.
385 */
386template <typename T>
387T SkTBitOr(T a, T b) {
388 return (T)(a | b);
389}
390
reed@google.com1fcd51e2011-01-05 15:50:27 +0000391/**
392 * Use to cast a pointer to a different type, and maintaining strict-aliasing
393 */
394template <typename Dst> Dst SkTCast(const void* ptr) {
395 union {
396 const void* src;
397 Dst dst;
398 } data;
399 data.src = ptr;
400 return data.dst;
401}
402
reed@android.com8a1c16f2008-12-17 15:59:43 +0000403//////////////////////////////////////////////////////////////////////////////
404
405/** \class SkNoncopyable
406
fmalita055f6b52015-04-09 08:49:32 -0700407SkNoncopyable is the base class for objects that do not want to
reed@android.com8a1c16f2008-12-17 15:59:43 +0000408be copied. It hides its copy-constructor and its assignment-operator.
409*/
ctguil@chromium.org7ffb1b22011-03-15 21:27:08 +0000410class SK_API SkNoncopyable {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000411public:
Chris Blume2b6be202017-04-25 17:33:13 -0700412 SkNoncopyable() = default;
reed@google.com1fcd51e2011-01-05 15:50:27 +0000413
Chris Blume2b6be202017-04-25 17:33:13 -0700414 SkNoncopyable(SkNoncopyable&&) = default;
415 SkNoncopyable& operator =(SkNoncopyable&&) = default;
416
417 SkNoncopyable(const SkNoncopyable&) = delete;
418 SkNoncopyable& operator=(const SkNoncopyable&) = delete;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000419};
420
reed@android.com8a1c16f2008-12-17 15:59:43 +0000421#endif /* C++ */
422
423#endif