Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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)
static sk_sp< SkColorSpace > MakeSRGB()
FlutterSoftwarePixelFormat
Definition embedder.h:333
@ kFlutterSoftwarePixelFormatRGBA4444
Definition embedder.h:345
@ kFlutterSoftwarePixelFormatRGBA8888
Definition embedder.h:349
@ kFlutterSoftwarePixelFormatBGRA8888
Definition embedder.h:357
@ kFlutterSoftwarePixelFormatGray8
Definition embedder.h:337
@ kFlutterSoftwarePixelFormatNative32
Definition embedder.h:361
@ kFlutterSoftwarePixelFormatRGBX8888
Definition embedder.h:353
@ kFlutterSoftwarePixelFormatRGB565
Definition embedder.h:341
#define FML_LOG(severity)
Definition logging.h:82
std::optional< SkColorType > getSkColorType(FlutterSoftwarePixelFormat pixfmt)
std::optional< SkColorInfo > getSkColorInfo(FlutterSoftwarePixelFormat pixfmt)
#define ERROR(message)