Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
dl_image.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
8
9namespace flutter {
10
11DlImage::DlImage() = default;
12
13DlImage::~DlImage() = default;
14
15int DlImage::width() const {
16 return GetSize().width;
17};
18
19int DlImage::height() const {
20 return GetSize().height;
21};
22
26
27std::optional<std::string> DlImage::get_error() const {
28 return std::nullopt;
29}
30
31bool DlImage::Equals(const DlImage* other) const {
32 if (!other) {
33 return false;
34 }
35 if (this == other) {
36 return true;
37 }
38
39 auto skia_this = asSkiaImage();
40 auto skia_other = other->asSkiaImage();
41 if (!skia_this || !skia_other) {
42 // Impeller images have pointer equality (handled by this == other)
43 return false;
44 }
45 return skia_this->skia_image() == skia_other->skia_image();
46}
47
48} // namespace flutter
Represents an image whose allocation is (usually) resident on device memory.
Definition dl_image.h:34
virtual DlISize GetSize() const =0
virtual std::optional< std::string > get_error() const
Definition dl_image.cc:27
int height() const
Definition dl_image.cc:19
DlIRect GetBounds() const
Definition dl_image.cc:23
virtual ~DlImage()
bool Equals(const DlImage *other) const
Definition dl_image.cc:31
int width() const
Definition dl_image.cc:15
virtual const DlImageSkia * asSkiaImage() const
Safe downcast to DlImageSkia.
Definition dl_image.h:58
virtual sk_sp< SkImage > skia_image() const
static constexpr TRect MakeSize(const TSize< U > &size)
Definition rect.h:150
Type height
Definition size.h:29
Type width
Definition size.h:28