Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
FuzzColorspace.cpp File Reference
#include "fuzz/Fuzz.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkData.h"
#include "modules/skcms/skcms.h"

Go to the source code of this file.

Functions

void FuzzColorspace (const uint8_t *data, size_t size)
 

Function Documentation

◆ FuzzColorspace()

void FuzzColorspace ( const uint8_t *  data,
size_t  size 
)

Definition at line 13 of file FuzzColorspace.cpp.

13 {
15 if (!space) {
16 return;
17 }
18 // Call some arbitrary methods on the colorspace, using a throw-away
19 // variable to prevent the compiler from optimizing things away.
20 int i = 0;
21 if (space->gammaCloseToSRGB()) {
22 i += 1;
23 }
24 if (space->gammaIsLinear()) {
25 i += 1;
26 }
27 if (space->isSRGB()) {
28 i += 1;
29 }
31 space->toProfile(&profile);
32 sk_sp<SkColorSpace> space2 = space->makeLinearGamma()->makeSRGBGamma()->makeColorSpin();
33 sk_sp<SkData> data1 = space->serialize();
34 if (SkColorSpace::Equals(space.get(), space2.get()) && i > 5) {
35 SkDebugf("Should never happen %d", (int)data1->size());
36 space2->writeToMemory(nullptr);
37 }
38}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static bool Equals(const SkColorSpace *, const SkColorSpace *)
static sk_sp< SkColorSpace > Deserialize(const void *data, size_t length)
T * get() const
Definition SkRefCnt.h:303