move blur and path attributes to key
Blur and stroke information were kept out of line with the key.
Make them part of the key, and update operator==.
Change-Id: I2e7669aae4e9c3243c078b039ae796a7e371ef8e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315282
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index f3b924b..32df05d 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -475,25 +475,35 @@
key.fPixelGeometry = pixelGeometry;
key.fUniqueID = glyphRunList.uniqueID();
key.fStyle = blobPaint.getStyle();
+ if (key.fStyle != SkPaint::kFill_Style) {
+ key.fFrameWidth = blobPaint.getStrokeWidth();
+ key.fMiterLimit = blobPaint.getStrokeMiter();
+ key.fJoin = blobPaint.getStrokeJoin();
+ }
key.fHasBlur = SkToBool(mf);
+ if (key.fHasBlur) {
+ key.fBlurRec = blurRec;
+ }
key.fCanonicalColor = canonicalColor;
key.fScalerContextFlags = scalerContextFlags;
blob = textBlobCache->find(key);
}
const SkMatrix& drawMatrix(viewMatrix.localToDevice());
- if (blob == nullptr || !blob->canReuse(blobPaint, blurRec, drawMatrix, drawOrigin)) {
+ if (blob == nullptr || !blob->canReuse(blobPaint, drawMatrix, drawOrigin)) {
if (blob != nullptr) {
// We have to remake the blob because changes may invalidate our masks.
// TODO we could probably get away with reuse most of the time if the pointer is unique,
// but we'd have to clear the SubRun information
textBlobCache->remove(blob.get());
}
+
+ blob = GrTextBlob::Make(glyphRunList, drawMatrix);
if (canCache) {
- blob = textBlobCache->makeCachedBlob(glyphRunList, key, blurRec, drawMatrix);
- } else {
- blob = GrTextBlob::Make(glyphRunList, drawMatrix);
+ blob->addKey(key);
+ textBlobCache->add(glyphRunList, blob);
}
+
bool supportsSDFT = fContext->priv().caps()->shaderCaps()->supportsDistanceFieldText();
fGlyphPainter.processGlyphRunList(
glyphRunList, drawMatrix, fSurfaceProps, supportsSDFT, options, blob.get());