Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
12#include "include/core/SkData.h"
16
17#include <memory>
18#include <utility>
19
20namespace ToolUtils {
21
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
std::unique_ptr< SkImageGenerator > MakeFromEncoded(sk_sp< SkData > data, std::optional< SkAlphaType > at)
bool DecodeDataToBitmap(sk_sp< SkData > data, SkBitmap *dst)
Definition gen.py:1