Flutter Engine
 
Loading...
Searching...
No Matches
pixel_formats.cc File Reference
#include "flutter/shell/platform/embedder/pixel_formats.h"
#include "flutter/shell/platform/embedder/embedder.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkColorType.h"
#include "third_party/skia/include/core/SkImageInfo.h"

Go to the source code of this file.

Functions

std::optional< SkColorType > getSkColorType (FlutterSoftwarePixelFormat pixfmt)
 
std::optional< SkColorInfo > getSkColorInfo (FlutterSoftwarePixelFormat pixfmt)
 

Function Documentation

◆ getSkColorInfo()

std::optional< SkColorInfo > getSkColorInfo ( FlutterSoftwarePixelFormat  pixfmt)

Definition at line 34 of file pixel_formats.cc.

34 {
35 auto ct = getSkColorType(pixfmt);
36 if (!ct) {
37 return std::nullopt;
38 }
39
40 auto at = SkColorTypeIsAlwaysOpaque(*ct) ? kOpaque_SkAlphaType
41 : kPremul_SkAlphaType;
42
43 return SkColorInfo(*ct, at, SkColorSpace::MakeSRGB());
44}
std::optional< SkColorType > getSkColorType(FlutterSoftwarePixelFormat pixfmt)

References getSkColorType().

Referenced by MakeSkSurfaceFromBackingStore().

◆ getSkColorType()

std::optional< SkColorType > getSkColorType ( FlutterSoftwarePixelFormat  pixfmt)

Definition at line 12 of file pixel_formats.cc.

12 {
13 switch (pixfmt) {
15 return kGray_8_SkColorType;
17 return kRGB_565_SkColorType;
19 return kARGB_4444_SkColorType;
21 return kRGBA_8888_SkColorType;
23 return kRGB_888x_SkColorType;
25 return kBGRA_8888_SkColorType;
27 return kN32_SkColorType;
28 default:
29 FML_LOG(ERROR) << "Invalid software rendering pixel format";
30 return std::nullopt;
31 }
32}
@ kFlutterSoftwarePixelFormatRGBA4444
Definition embedder.h:473
@ kFlutterSoftwarePixelFormatRGBA8888
Definition embedder.h:483
@ kFlutterSoftwarePixelFormatBGRA8888
Definition embedder.h:502
@ kFlutterSoftwarePixelFormatGray8
Definition embedder.h:454
@ kFlutterSoftwarePixelFormatNative32
Definition embedder.h:506
@ kFlutterSoftwarePixelFormatRGBX8888
Definition embedder.h:492
@ kFlutterSoftwarePixelFormatRGB565
Definition embedder.h:463
#define FML_LOG(severity)
Definition logging.h:101

References FML_LOG, kFlutterSoftwarePixelFormatBGRA8888, kFlutterSoftwarePixelFormatGray8, kFlutterSoftwarePixelFormatNative32, kFlutterSoftwarePixelFormatRGB565, kFlutterSoftwarePixelFormatRGBA4444, kFlutterSoftwarePixelFormatRGBA8888, and kFlutterSoftwarePixelFormatRGBX8888.

Referenced by getSkColorInfo().