diff options
author | halcanary <halcanary@google.com> | 2016-08-16 09:36:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-16 09:36:23 -0700 |
commit | 3287588a467ee579c3947fe13c6add5048b14aa9 (patch) | |
tree | ce5c0591a097af58fdcc8c3c0d068b483143f19f /include/private | |
parent | 883c8efae702462fa28e7ce4f17199bbfa1ce360 (diff) |
SkPDF: SkPDFFont class changes
SkPDFFont:
* inline some one-line methdods.
- SkPDFFont::typeface()
- SkPDFFont::fontInfo()
- SkPDFFont::firstGlyphID()
- SkPDFFont::lastGlyphID()
- SkPDFFont::getFontDescriptor()
* de-virtualize some methods:
- SkPDFFont::getType()
- SkPDFFont::multiByteGlyphs()
* Constructor takes more arguments:
fontType, multiByteGlyphs
* re-order fields (pointers before shorts)
* use sk_sp<T> more, T* less
SkAdvancedTypefaceMetrics:
* SkAdvancedTypefaceMetrics::fFont now a uint8_t
* other enumes are sized.
* SkAdvancedTypefaceMetrics::fStyle now big enough.
* remove use of SkTBitOr, replaced with fancy templates
No public API changes.
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2246903002
Review-Url: https://codereview.chromium.org/2246903002
Diffstat (limited to 'include/private')
-rw-r--r-- | include/private/SkBitmaskEnum.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/include/private/SkBitmaskEnum.h b/include/private/SkBitmaskEnum.h new file mode 100644 index 0000000000..f787d3b04d --- /dev/null +++ b/include/private/SkBitmaskEnum.h @@ -0,0 +1,34 @@ +/* + * Copyright 2016 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#ifndef SkEnumOperators_DEFINED +#define SkEnumOperators_DEFINED + +#include "SkTLogic.h" + +namespace skstd { +template <typename T> struct is_bitmask_enum : std::false_type {}; +} + +template <typename E> SK_WHEN(skstd::is_bitmask_enum<E>::value, E) operator|(E l, E r) { + using U = skstd::underlying_type_t<E>; + return static_cast<E>(static_cast<U>(l) | static_cast<U>(r)); +} + +template <typename E> SK_WHEN(skstd::is_bitmask_enum<E>::value, E&) operator|=(E& l, E r) { + return l = l | r; +} + +template <typename E> SK_WHEN(skstd::is_bitmask_enum<E>::value, E) operator&(E l, E r) { + using U = skstd::underlying_type_t<E>; + return static_cast<E>(static_cast<U>(l) & static_cast<U>(r)); +} + +template <typename E> SK_WHEN(skstd::is_bitmask_enum<E>::value, E&) operator&=(E& l, E r) { + return l = l & r; +} + +#endif // SkEnumOperators_DEFINED |