summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/skia
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/skia')
-rw-r--r--chromium/third_party/skia/src/core/SkGlyphRunPainter.cpp3
-rw-r--r--chromium/third_party/skia/src/core/SkScalerContext.h10
-rw-r--r--chromium/third_party/skia/src/ports/SkFontHost_mac.cpp23
3 files changed, 28 insertions, 8 deletions
diff --git a/chromium/third_party/skia/src/core/SkGlyphRunPainter.cpp b/chromium/third_party/skia/src/core/SkGlyphRunPainter.cpp
index 9ef9c05287f..4e497abc72d 100644
--- a/chromium/third_party/skia/src/core/SkGlyphRunPainter.cpp
+++ b/chromium/third_party/skia/src/core/SkGlyphRunPainter.cpp
@@ -266,7 +266,8 @@ void SkGlyphRunListPainter::processARGBFallback(
// If the situation that the matrix is simple, and all the glyphs are small enough. Go fast!
bool useFastPath =
- viewMatrix.isScaleTranslate() && conservativeMaxGlyphDimension <= maxGlyphDimension;
+ viewMatrix.isScaleTranslate()
+ && conservativeMaxGlyphDimension <= SkStrikeCommon::kSkSideTooBigForAtlas;
auto glyphIDs = SkSpan<const SkGlyphID>{fARGBGlyphsIDs};
diff --git a/chromium/third_party/skia/src/core/SkScalerContext.h b/chromium/third_party/skia/src/core/SkScalerContext.h
index 06ccce2ebb3..36fc882df70 100644
--- a/chromium/third_party/skia/src/core/SkScalerContext.h
+++ b/chromium/third_party/skia/src/core/SkScalerContext.h
@@ -96,6 +96,7 @@ public:
}
SkScalar getContrast() const {
+ sk_ignore_unused_variable(fReservedAlign);
return SkIntToScalar(fContrast) / ((1 << 8) - 1);
}
void setContrast(SkScalar c) {
@@ -206,11 +207,6 @@ public:
return static_cast<SkMask::Format>(fMaskFormat);
}
-private:
- // TODO: get rid of these bad friends.
- friend class SkScalerContext;
- friend class SkScalerContext_DW;
-
SkColor getLuminanceColor() const {
return fLumBits;
}
@@ -219,6 +215,10 @@ private:
void setLuminanceColor(SkColor c) {
fLumBits = c;
}
+
+private:
+ // TODO: remove
+ friend class SkScalerContext;
};
SK_END_REQUIRE_DENSE
diff --git a/chromium/third_party/skia/src/ports/SkFontHost_mac.cpp b/chromium/third_party/skia/src/ports/SkFontHost_mac.cpp
index 2f3aa34ff34..86578e5d31f 100644
--- a/chromium/third_party/skia/src/ports/SkFontHost_mac.cpp
+++ b/chromium/third_party/skia/src/ports/SkFontHost_mac.cpp
@@ -2227,7 +2227,7 @@ void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const {
rec->fFlags &= ~flagsWeDontSupport;
- SmoothBehavior smoothBehavior = smooth_behavior();
+ const SmoothBehavior smoothBehavior = smooth_behavior();
// Only two levels of hinting are supported.
// kNo_Hinting means avoid CoreGraphics outline dilation (smoothing).
@@ -2288,7 +2288,26 @@ void SkTypeface_Mac::onFilterRec(SkScalerContextRec* rec) const {
rec->ignorePreBlend();
#endif
} else {
- //CoreGraphics dialates smoothed text as needed.
+#ifndef SK_IGNORE_MAC_BLENDING_MATCH_FIX
+ SkColor color = rec->getLuminanceColor();
+ if (smoothBehavior == SmoothBehavior::some) {
+ // CoreGraphics smoothed text without subpixel coverage blitting goes from a gamma of
+ // 2.0 for black foreground to a gamma of 1.0 for white foreground. Emulate this
+ // through the mask gamma by reducing the color values to 1/2.
+ color = SkColorSetRGB(SkColorGetR(color) * 1/2,
+ SkColorGetG(color) * 1/2,
+ SkColorGetB(color) * 1/2);
+ } else if (smoothBehavior == SmoothBehavior::subpixel) {
+ // CoreGraphics smoothed text with subpixel coverage blitting goes from a gamma of
+ // 2.0 for black foreground to a gamma of ~1.4? for white foreground. Emulate this
+ // through the mask gamma by reducing the color values to 3/4.
+ color = SkColorSetRGB(SkColorGetR(color) * 3/4,
+ SkColorGetG(color) * 3/4,
+ SkColorGetB(color) * 3/4);
+ }
+ rec->setLuminanceColor(color);
+#endif
+ // CoreGraphics dialates smoothed text to provide contrast.
rec->setContrast(0);
}
}