forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
display_list_image_skia.cc
51 lines (40 loc) · 1.22 KB
/
display_list_image_skia.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/display_list/display_list_image_skia.h"
namespace flutter {
DlImageSkia::DlImageSkia(sk_sp<SkImage> image) : image_(std::move(image)) {}
// |DlImage|
DlImageSkia::~DlImageSkia() = default;
// |DlImage|
sk_sp<SkImage> DlImageSkia::skia_image() const {
return image_;
};
// |DlImage|
std::shared_ptr<impeller::Texture> DlImageSkia::impeller_texture() const {
return nullptr;
}
// |DlImage|
bool DlImageSkia::isOpaque() const {
return image_ ? image_->isOpaque() : false;
}
// |DlImage|
bool DlImageSkia::isTextureBacked() const {
return image_ ? image_->isTextureBacked() : false;
}
// |DlImage|
SkISize DlImageSkia::dimensions() const {
return image_ ? image_->dimensions() : SkISize::MakeEmpty();
}
// |DlImage|
size_t DlImageSkia::GetApproximateByteSize() const {
auto size = sizeof(this);
if (image_) {
const auto& info = image_->imageInfo();
const auto kMipmapOverhead = 4.0 / 3.0;
const size_t image_byte_size = info.computeMinByteSize() * kMipmapOverhead;
size += image_byte_size;
}
return size;
}
} // namespace flutter