Flutter Engine
The Flutter Engine
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
5#include "flutter/display_list/image/dl_image_skia.h"
6
7namespace flutter {
8
10
11// |DlImage|
13
14// |DlImage|
16 return image_;
17};
18
19// |DlImage|
20std::shared_ptr<impeller::Texture> DlImageSkia::impeller_texture() const {
21 return nullptr;
22}
23
24// |DlImage|
26 return image_ ? image_->isOpaque() : false;
27}
28
29// |DlImage|
31 return image_ ? image_->isTextureBacked() : false;
32}
33
34// |DlImage|
36 // Technically if the image is null then we are thread-safe, and possibly
37 // if the image is constructed from a heap raster as well, but there
38 // should never be a leak of an instance of this class into any data that
39 // is shared with the UI thread, regardless of value.
40 // All images intended to be shared with the UI thread should be constructed
41 // via one of the DlImage subclasses designed for that purpose.
42 return false;
43}
44
45// |DlImage|
47 return image_ ? image_->dimensions() : SkISize::MakeEmpty();
48}
49
50// |DlImage|
52 auto size = sizeof(*this);
53 if (image_) {
54 const auto& info = image_->imageInfo();
55 const auto kMipmapOverhead = image_->hasMipmaps() ? 4.0 / 3.0 : 1.0;
56 const size_t image_byte_size = info.computeMinByteSize() * kMipmapOverhead;
57 size += image_byte_size;
58 }
59 return size;
60}
61
62} // namespace flutter
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
const SkImageInfo & imageInfo() const
Definition: SkImage.h:279
SkISize dimensions() const
Definition: SkImage.h:297
bool isOpaque() const
Definition: SkImage.h:375
virtual bool isTextureBacked() const =0
bool hasMipmaps() const
Definition: SkImage.cpp:292
bool isOpaque() const override
If the pixel format of this image ignores alpha, this returns true. This method might conservatively ...
~DlImageSkia() override
sk_sp< SkImage > skia_image() const override
If this display list image is meant to be used by the Skia backend, an SkImage instance....
size_t GetApproximateByteSize() const override
DlImageSkia(sk_sp< SkImage > image)
Definition: dl_image_skia.cc:9
SkISize dimensions() const override
bool isUIThreadSafe() const override
If the underlying platform image held by this object has no threading requirements for the release of...
bool isTextureBacked() const override
std::shared_ptr< impeller::Texture > impeller_texture() const override
If this display list image is meant to be used by the Impeller backend, an Impeller texture instance....
sk_sp< const SkImage > image
Definition: SkRecords.h:269
it will be possible to load the file into Perfetto s trace viewer 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
Definition: switches.h:259
Definition: ref_ptr.h:256
Definition: SkSize.h:16
static constexpr SkISize MakeEmpty()
Definition: SkSize.h:22