Flutter Engine
The Flutter Engine
SkColorTable.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
9
13
14sk_sp<SkColorTable> SkColorTable::Make(const uint8_t tableA[256],
15 const uint8_t tableR[256],
16 const uint8_t tableG[256],
17 const uint8_t tableB[256]) {
18 if (!tableA && !tableR && !tableG && !tableB) {
19 return nullptr; // The table is the identity
20 }
21
23 if (!table.tryAllocPixels(SkImageInfo::MakeA8(256, 4))) {
24 return nullptr;
25 }
26 uint8_t *a = table.getAddr8(0,0),
27 *r = table.getAddr8(0,1),
28 *g = table.getAddr8(0,2),
29 *b = table.getAddr8(0,3);
30 for (int i = 0; i < 256; i++) {
31 a[i] = tableA ? tableA[i] : i;
32 r[i] = tableR ? tableR[i] : i;
33 g[i] = tableG ? tableG[i] : i;
34 b[i] = tableB ? tableB[i] : i;
35 }
36 table.setImmutable();
37
39}
40
42 buffer.writeByteArray(fTable.getAddr8(0, 0), 4 * 256);
43}
44
46 uint8_t argb[4*256];
47 if (buffer.readByteArray(argb, sizeof(argb))) {
48 return SkColorTable::Make(argb+0*256, argb+1*256, argb+2*256, argb+3*256);
49 }
50 return nullptr;
51}
SI F table(const skcms_Curve *curve, F v)
uint8_t * getAddr8(int x, int y) const
Definition: SkBitmap.h:1270
void flatten(SkWriteBuffer &buffer) const
static sk_sp< SkColorTable > Make(const uint8_t table[256])
Definition: SkColorTable.h:29
static sk_sp< SkColorTable > Deserialize(SkReadBuffer &buffer)
static bool b
struct MyStruct a[10]
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
static SkImageInfo MakeA8(int width, int height)