Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
tools
DecodeUtils.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2023 Google LLC
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#include "
tools/DecodeUtils.h
"
9
10
#include "
include/core/SkBitmap.h
"
11
#include "
include/core/SkColorSpace.h
"
12
#include "
include/core/SkData.h
"
13
#include "
include/core/SkImageGenerator.h
"
14
#include "
include/core/SkImageInfo.h
"
15
#include "
src/image/SkImageGeneratorPriv.h
"
16
17
#include <memory>
18
#include <utility>
19
20
namespace
ToolUtils
{
21
22
bool
DecodeDataToBitmap
(
sk_sp<SkData>
data,
SkBitmap
* dst) {
23
std::unique_ptr<SkImageGenerator>
gen
(
SkImageGenerators::MakeFromEncoded
(std::move(data)));
24
return
gen
&& dst->tryAllocPixels(
gen
->getInfo()) &&
25
gen
->getPixels(
26
gen
->getInfo().makeColorSpace(
nullptr
), dst->getPixels(), dst->rowBytes());
27
}
28
29
}
// namespace ToolUtils
DecodeUtils.h
SkBitmap.h
SkColorSpace.h
SkData.h
SkImageGeneratorPriv.h
SkImageGenerator.h
SkImageInfo.h
SkBitmap
Definition
SkBitmap.h:59
sk_sp
Definition
SkRefCnt.h:220
SkImageGenerators::MakeFromEncoded
std::unique_ptr< SkImageGenerator > MakeFromEncoded(sk_sp< SkData > data, std::optional< SkAlphaType > at)
Definition
SkImageGenerator_FromEncoded.cpp:35
ToolUtils
Definition
DecodeUtils.cpp:20
ToolUtils::DecodeDataToBitmap
bool DecodeDataToBitmap(sk_sp< SkData > data, SkBitmap *dst)
Definition
DecodeUtils.cpp:22
gen
Definition
gen.py:1
Generated on Fri Apr 26 2024 06:18:09 for Flutter Engine by
1.9.8