Flutter Engine
The Flutter Engine
pixel_formats.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/shell/platform/embedder/pixel_formats.h"
6#include "flutter/shell/platform/embedder/embedder.h"
7
11
12std::optional<SkColorType> getSkColorType(FlutterSoftwarePixelFormat pixfmt) {
13 switch (pixfmt) {
27 return kN32_SkColorType;
28 default:
29 FML_LOG(ERROR) << "Invalid software rendering pixel format";
30 return std::nullopt;
31 }
32}
33
34std::optional<SkColorInfo> getSkColorInfo(FlutterSoftwarePixelFormat pixfmt) {
35 auto ct = getSkColorType(pixfmt);
36 if (!ct) {
37 return std::nullopt;
38 }
39
42
43 return SkColorInfo(*ct, at, SkColorSpace::MakeSRGB());
44}
@ kOpaque_SkAlphaType
pixel is opaque
Definition: SkAlphaType.h:28
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
Definition: SkColorType.h:23
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition: SkColorType.h:26
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
Definition: SkColorType.h:35
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
Definition: SkColorType.h:22
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
@ kRGB_888x_SkColorType
pixel with 8 bits each for red, green, blue; in 32-bit word
Definition: SkColorType.h:25
SK_API bool SkColorTypeIsAlwaysOpaque(SkColorType ct)
Definition: SkImageInfo.cpp:48
static sk_sp< SkColorSpace > MakeSRGB()
FlutterSoftwarePixelFormat
Definition: embedder.h:335
@ kFlutterSoftwarePixelFormatRGBA4444
Definition: embedder.h:347
@ kFlutterSoftwarePixelFormatRGBA8888
Definition: embedder.h:351
@ kFlutterSoftwarePixelFormatBGRA8888
Definition: embedder.h:359
@ kFlutterSoftwarePixelFormatGray8
Definition: embedder.h:339
@ kFlutterSoftwarePixelFormatNative32
Definition: embedder.h:363
@ kFlutterSoftwarePixelFormatRGBX8888
Definition: embedder.h:355
@ kFlutterSoftwarePixelFormatRGB565
Definition: embedder.h:343
#define FML_LOG(severity)
Definition: logging.h:82
std::optional< SkColorType > getSkColorType(FlutterSoftwarePixelFormat pixfmt)
std::optional< SkColorInfo > getSkColorInfo(FlutterSoftwarePixelFormat pixfmt)
#define ERROR(message)
Definition: elf_loader.cc:260