Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkGraphics.h
1 /*
2  * Copyright 2006 The Android Open Source Project
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 #ifndef SkGraphics_DEFINED
9 #define SkGraphics_DEFINED
10 
11 #include "SkRefCnt.h"
12 
13 class SkData;
14 class SkImageGenerator;
15 class SkTraceMemoryDump;
16 
17 class SK_API SkGraphics {
18 public:
24  static void Init();
25 
26  // We're in the middle of cleaning this up.
27  static void Term() {}
28 
33  static void GetVersion(int32_t* major, int32_t* minor, int32_t* patch);
34 
40  static size_t GetFontCacheLimit();
41 
49  static size_t SetFontCacheLimit(size_t bytes);
50 
54  static size_t GetFontCacheUsed();
55 
60  static int GetFontCacheCountUsed();
61 
66  static int GetFontCacheCountLimit();
67 
73  static int SetFontCacheCountLimit(int count);
74 
75  /*
76  * Returns the maximum point size for text that may be cached.
77  *
78  * Sizes above this will be drawn directly from the font's outline.
79  * Setting this to a large value may speed up drawing larger text (repeatedly),
80  * but could cause the cache to purge other sizes more often.
81  *
82  * This value is a hint to the font engine, and the actual limit may be different due to
83  * implementation specific details.
84  */
85  static int GetFontCachePointSizeLimit();
86 
87  /*
88  * Set the maximum point size for text that may be cached, returning the previous value.
89  *
90  * Sizes above this will be drawn directly from the font's outline.
91  * Setting this to a large value may speed up drawing larger text (repeatedly),
92  * but could cause the cache to purge other sizes more often.
93  *
94  * This value is a hint to the font engine, and the actual limit may be different due to
95  * implementation specific details.
96  */
97  static int SetFontCachePointSizeLimit(int maxPointSize);
98 
104  static void PurgeFontCache();
105 
113  static size_t GetResourceCacheTotalBytesUsed();
114 
120  static size_t GetResourceCacheTotalByteLimit();
121  static size_t SetResourceCacheTotalByteLimit(size_t newLimit);
122 
127  static void PurgeResourceCache();
128 
137  static size_t GetResourceCacheSingleAllocationByteLimit();
138  static size_t SetResourceCacheSingleAllocationByteLimit(size_t newLimit);
139 
144  static void DumpMemoryStatistics(SkTraceMemoryDump* dump);
145 
152  static void PurgeAllCaches();
153 
162  static void SetFlags(const char* flags);
163 
175  static size_t GetTLSFontCacheLimit();
176 
182  static void SetTLSFontCacheLimit(size_t bytes);
183 
184  typedef std::unique_ptr<SkImageGenerator>
185  (*ImageGeneratorFromEncodedDataFactory)(sk_sp<SkData>);
186 
194  static ImageGeneratorFromEncodedDataFactory
195  SetImageGeneratorFromEncodedDataFactory(ImageGeneratorFromEncodedDataFactory);
196 };
197 
199 public:
200  SkAutoGraphics() {
202  }
203 };
204 
205 #endif
Definition: SkGraphics.h:198
Definition: SkImageGenerator.h:27
static void Init()
Call this at process initialization time if your environment does not permit static global initialize...
SkData holds an immutable data buffer.
Definition: SkData.h:22
Interface for memory tracing.
Definition: SkTraceMemoryDump.h:20
Definition: SkGraphics.h:17