Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
dl_image_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
8
9namespace flutter {
10
11sk_sp<DlImage> DlImageSkia::Make(const SkImage* image) {
12 if (!image) {
13 return nullptr;
14 }
15 return sk_make_sp<DlImageSkia>(sk_ref_sp(image));
16}
17
18sk_sp<DlImage> DlImageSkia::Make(sk_sp<SkImage> image) {
19 if (!image) {
20 return nullptr;
21 }
22 return sk_make_sp<DlImageSkia>(std::move(image));
23}
24
25DlImageSkia::DlImageSkia(sk_sp<SkImage> image) : image_(std::move(image)) {}
26
27// |DlImage|
29
30// |DlImage|
31sk_sp<SkImage> DlImageSkia::skia_image() const {
32 return image_;
33};
34
35// |DlImage|
37 return image_ ? image_->isTextureBacked() : false;
38}
39
40// |DlImage|
42 return image_ ? image_->isOpaque() : false;
43}
44
45// |DlImage|
47 // Technically if the image is null then we are thread-safe, and possibly
48 // if the image is constructed from a heap raster as well, but there
49 // should never be a leak of an instance of this class into any data that
50 // is shared with the UI thread, regardless of value.
51 // All images intended to be shared with the UI thread should be constructed
52 // via one of the DlImage subclasses designed for that purpose.
53 return false;
54}
55
56// |DlImage|
58 return image_ ? ToDlISize(image_->dimensions()) : DlISize();
59}
60
61// |DlImage|
63 auto size = sizeof(*this);
64 if (image_) {
65 const auto& info = image_->imageInfo();
66 const auto kMipmapOverhead = image_->hasMipmaps() ? 4.0 / 3.0 : 1.0;
67 const size_t image_byte_size = info.computeMinByteSize() * kMipmapOverhead;
68 size += image_byte_size;
69 }
70 return size;
71}
72
73// |DlImage|
77
78} // namespace flutter
bool isOpaque() const override
If the pixel format of this image ignores alpha, this returns true. This method might conservatively ...
~DlImageSkia() override
size_t GetApproximateByteSize() const override
DlImageSkia(sk_sp< SkImage > image)
bool isUIThreadSafe() const override
If the underlying platform image held by this object has no threading requirements for the release of...
DlISize GetSize() const override
virtual sk_sp< SkImage > skia_image() const
bool isTextureBacked() const override
Returns true if the image is backed by a GPU texture.
DlColorSpace GetColorSpace() const override
Gets the color space of the image.
static sk_sp< DlImage > Make(const SkImage *image)
FlutterVulkanImage * image
const DlISize & ToDlISize(const SkISize &size)
impeller::ISize32 DlISize
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
DlColorSpace
Definition dl_color.h:13
Definition ref_ptr.h:261