Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
6
7namespace impeller {
8
10 : typeface_(std::move(typeface)) {}
11
13
15 return !!typeface_;
16}
17
18std::size_t TypefaceSkia::GetHash() const {
19 if (!IsValid()) {
20 return 0u;
21 }
22
23 return reinterpret_cast<size_t>(typeface_.get());
24}
25
26bool TypefaceSkia::IsEqual(const Typeface& other) const {
27 auto sk_other = reinterpret_cast<const TypefaceSkia*>(&other);
28 return sk_other->typeface_ == typeface_;
29}
30
32 return typeface_;
33}
34
35} // namespace impeller
TypefaceSkia(sk_sp< SkTypeface > typeface)
std::size_t GetHash() const override
const sk_sp< SkTypeface > & GetSkiaTypeface() const
bool IsEqual(const Typeface &other) const override
bool IsValid() const override
A typeface, usually obtained from a font-file, on disk describes the intrinsic properties of the font...
Definition typeface.h:20
T * get() const
Definition SkRefCnt.h:303
Definition ref_ptr.h:256