Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: src/gpu/GrAtlasTextContext.h

Issue 1065293003: Start caching masks / stroke fills for textblobs (Closed) Base URL: https://skia.googlesource.com/skia.git@textblobloopergm
Patch Set: rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/gpu/GrAtlasTextContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAtlasTextContext.h
diff --git a/src/gpu/GrAtlasTextContext.h b/src/gpu/GrAtlasTextContext.h
index 7859c04e23cb5e6bf530d640e996488245d6e859..c999e1f0afb34642eea402b2f8864c6f790e4957 100644
--- a/src/gpu/GrAtlasTextContext.h
+++ b/src/gpu/GrAtlasTextContext.h
@@ -14,6 +14,7 @@
#include "GrGeometryProcessor.h"
#include "SkDescriptor.h"
#include "GrMemoryPool.h"
+#include "SkMaskFilter.h"
#include "SkTextBlob.h"
#include "SkTInternalLList.h"
@@ -84,7 +85,6 @@ private:
* glyph cache to get the path at flush time, or hold onto the path in the cache, which
* would greatly increase the memory of these cached items.
*/
-
struct Run {
Run() : fColor(GrColor_ILLEGAL), fInitialized(false), fDrawAsPaths(false) {
fVertexBounds.setLargestInverted();
@@ -132,9 +132,14 @@ private:
SkMatrix fViewMatrix;
SkScalar fX;
SkScalar fY;
- SkPaint::Style fStyle;
int fRunCount;
- uint32_t fUniqueID;
+ SkMaskFilter::BlurRec fBlurRec;
+ struct StrokeInfo {
+ SkScalar fFrameWidth;
+ SkScalar fMiterLimit;
+ SkPaint::Join fJoin;
+ };
+ StrokeInfo fStrokeInfo;
GrMemoryPool* fPool;
// all glyph / vertex offsets are into these pools.
@@ -142,12 +147,26 @@ private:
GrGlyph::PackedID* fGlyphIDs;
Run* fRuns;
- static const uint32_t& GetKey(const BitmapTextBlob& blob) {
- return blob.fUniqueID;
+ struct Key {
+ Key() {
+ memset(this, 0, sizeof(Key));
+ }
+ uint32_t fUniqueID;
+ SkPaint::Style fStyle;
+ bool fHasBlur;
+
+ bool operator==(const Key& other) const {
+ return 0 == memcmp(this, &other, sizeof(Key));
+ }
+ };
+ Key fKey;
+
+ static const Key& GetKey(const BitmapTextBlob& blob) {
+ return blob.fKey;
}
- static uint32_t Hash(const uint32_t& key) {
- return SkChecksum::Mix(key);
+ static uint32_t Hash(const Key& key) {
+ return SkChecksum::Murmur3(&key, sizeof(Key));
}
void operator delete(void* p) {
@@ -200,6 +219,7 @@ private:
inline SkGlyphCache* setupCache(Run*, const SkPaint&, const SkMatrix& viewMatrix);
static inline bool MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTransY,
const BitmapTextBlob&, const SkPaint&,
+ const SkMaskFilter::BlurRec&,
const SkMatrix& viewMatrix, SkScalar x, SkScalar y);
void regenerateTextBlob(BitmapTextBlob* bmp, const SkPaint& skPaint, const SkMatrix& viewMatrix,
const SkTextBlob* blob, SkScalar x, SkScalar y,
« no previous file with comments | « no previous file | src/gpu/GrAtlasTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698