| Flutter Impeller |

typeface_skia.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "impeller/typographer/backends/skia/typeface_skia.h"
6
7 namespace impeller {
8
9 TypefaceSkia::TypefaceSkia(sk_sp<SkTypeface> typeface)
10 : typeface_(std::move(typeface)) {}
11
12 TypefaceSkia::~TypefaceSkia() = default;
13
14 bool TypefaceSkia::IsValid() const {
15 return !!typeface_;
16 }
17
18 std::size_t TypefaceSkia::GetHash() const {
19 if (!IsValid()) {
20 return 0u;
21 }
22
23 return reinterpret_cast<size_t>(typeface_.get());
24 }
25
26 bool TypefaceSkia::IsEqual(const Typeface& other) const {
27 auto sk_other = reinterpret_cast<const TypefaceSkia*>(&other);
28 return sk_other->typeface_ == typeface_;
29 }
30
31 const sk_sp<SkTypeface>& TypefaceSkia::GetSkiaTypeface() const {
32 return typeface_;
33 }
34
35 } // namespace impeller
impeller::TypefaceSkia::IsEqual
bool IsEqual(const Typeface &other) const override
Definition: typeface_skia.cc:26
impeller::TypefaceSkia::GetHash
std::size_t GetHash() const override
Definition: typeface_skia.cc:18
impeller::TypefaceSkia::TypefaceSkia
TypefaceSkia(sk_sp< SkTypeface > typeface)
Definition: typeface_skia.cc:9
impeller::TypefaceSkia
Definition: typeface_skia.h:15
impeller::TypefaceSkia::GetSkiaTypeface
const sk_sp< SkTypeface > & GetSkiaTypeface() const
Definition: typeface_skia.cc:31
impeller::Typeface
A typeface, usually obtained from a font-file, on disk describes the intrinsic properties of the font...
Definition: typeface.h:19
typeface_skia.h
std
Definition: comparable.h:98
impeller::TypefaceSkia::~TypefaceSkia
~TypefaceSkia() override
impeller::TypefaceSkia::IsValid
bool IsValid() const override
Definition: typeface_skia.cc:14
impeller
Definition: aiks_context.cc:10