Flutter Engine
The Flutter Engine
GrGradientBitmapCache.h
Go to the documentation of this file.
1/*
2 * Copyright 2018 Google Inc.
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
8
9#ifndef GrGradientBitmapCache_DEFINED
10#define GrGradientBitmapCache_DEFINED
11
17
18class SkColorSpace;
19
21public:
22 GrGradientBitmapCache(int maxEntries, int resolution);
24
25 // Assumes colors are compatible with the specified alphaType (e.g. if it's premul then colors
26 // are already premultiplied). Thread safe.
27 void getGradient(const SkPMColor4f* colors,
28 const SkScalar* positions,
29 int count,
30 bool colorsAreOpaque,
31 const SkGradientShader::Interpolation& interpolation,
32 const SkColorSpace* intermediateColorSpace,
33 const SkColorSpace* dstColorSpace,
35 SkAlphaType alphaType,
37
38private:
39 SkMutex fMutex;
40
41 int fEntryCount;
42 const int fMaxEntries;
43 const int fResolution;
44
45 struct Entry;
46 mutable Entry* fHead;
47 mutable Entry* fTail;
48
49 inline Entry* release(Entry*) const;
50 inline void attachToHead(Entry*) const;
51
52 bool find(const void* buffer, size_t len, SkBitmap*) const;
53 void add(const void* buffer, size_t len, const SkBitmap&);
54
55 void fillGradient(const SkPMColor4f* colors,
56 const SkScalar* positions,
57 int count,
58 bool colorsAreOpaque,
59 const SkGradientShader::Interpolation& interpolation,
60 const SkColorSpace* intermediateColorSpace,
61 const SkColorSpace* dstColorSpace,
63
64#ifdef SK_DEBUG
65 void validate() const;
66#else
67 void validate() const {}
68#endif
69
70 class AutoValidate : SkNoncopyable {
71 public:
72 AutoValidate(const GrGradientBitmapCache* bc) : fBC(bc) { bc->validate(); }
73 ~AutoValidate() { fBC->validate(); }
74 private:
75 const GrGradientBitmapCache* fBC;
76 };
77};
78
79#endif
int count
Definition: FontMgrTest.cpp:50
SkAlphaType
Definition: SkAlphaType.h:26
SkColorType
Definition: SkColorType.h:19
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
int find(T *array, int N, T item)
void getGradient(const SkPMColor4f *colors, const SkScalar *positions, int count, bool colorsAreOpaque, const SkGradientShader::Interpolation &interpolation, const SkColorSpace *intermediateColorSpace, const SkColorSpace *dstColorSpace, SkColorType colorType, SkAlphaType alphaType, SkBitmap *bitmap)
GrGradientBitmapCache(int maxEntries, int resolution)
float SkScalar
Definition: extension.cpp:12
PODArray< SkColor > colors
Definition: SkRecords.h:276
Definition: bitmap.py:1
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