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

Unified Diff: src/core/SkPaint.cpp

Issue 1863013003: Pass effects directly to fontcache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: name the empty effects Created 4 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 | « src/core/SkGlyphCache.cpp ('k') | src/core/SkScalerContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPaint.cpp
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index c3bf1ba9ac78750ab15a7b5b204412d475a400c8..123f20365e6ef2cf96a905e46681be48f684655d 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -430,13 +430,12 @@ bool SkPaint::TooBigToUseCache(const SkMatrix& ctm, const SkMatrix& textM) {
#include "SkGlyphCache.h"
#include "SkUtils.h"
-static void DetachDescProc(SkTypeface* typeface, const SkDescriptor* desc,
- void* context) {
- *((SkGlyphCache**)context) = SkGlyphCache::DetachCache(typeface, desc);
+static void DetachDescProc(SkTypeface* typeface, const SkScalerContextEffects& effects,
+ const SkDescriptor* desc, void* context) {
+ *((SkGlyphCache**)context) = SkGlyphCache::DetachCache(typeface, effects, desc);
}
-int SkPaint::textToGlyphs(const void* textData, size_t byteLength,
- uint16_t glyphs[]) const {
+int SkPaint::textToGlyphs(const void* textData, size_t byteLength, uint16_t glyphs[]) const {
if (byteLength == 0) {
return 0;
}
@@ -938,9 +937,9 @@ static bool FontMetricsCacheProc(const SkGlyphCache* cache, void* context) {
return false; // don't detach the cache
}
-static void FontMetricsDescProc(SkTypeface* typeface, const SkDescriptor* desc,
- void* context) {
- SkGlyphCache::VisitCache(typeface, desc, FontMetricsCacheProc, context);
+static void FontMetricsDescProc(SkTypeface* typeface, const SkScalerContextEffects& effects,
+ const SkDescriptor* desc, void* context) {
+ SkGlyphCache::VisitCache(typeface, effects, desc, FontMetricsCacheProc, context);
}
SkScalar SkPaint::getFontMetrics(FontMetrics* metrics, SkScalar zoom) const {
@@ -1648,7 +1647,8 @@ static void test_desc(const SkScalerContext::Rec& rec,
#endif
/* see the note on ignoreGamma on descriptorProc */
-void SkPaint::getScalerContextDescriptor(SkAutoDescriptor* ad,
+void SkPaint::getScalerContextDescriptor(SkScalerContextEffects* effects,
+ SkAutoDescriptor* ad,
const SkSurfaceProps& surfaceProps,
uint32_t scalerContextFlags,
const SkMatrix* deviceMatrix) const {
@@ -1674,6 +1674,10 @@ void SkPaint::getScalerContextDescriptor(SkAutoDescriptor* ad,
#ifdef TEST_DESC
test_desc(rec, pe, &peBuffer, mf, &mfBuffer, ra, &raBuffer, desc, descSize);
#endif
+
+ effects->fPathEffect = pe;
+ effects->fMaskFilter = mf;
+ effects->fRasterizer = ra;
}
/*
@@ -1684,7 +1688,8 @@ void SkPaint::getScalerContextDescriptor(SkAutoDescriptor* ad,
void SkPaint::descriptorProc(const SkSurfaceProps* surfaceProps,
uint32_t scalerContextFlags,
const SkMatrix* deviceMatrix,
- void (*proc)(SkTypeface*, const SkDescriptor*, void*),
+ void (*proc)(SkTypeface*, const SkScalerContextEffects&,
+ const SkDescriptor*, void*),
void* context) const {
SkScalerContext::Rec rec;
@@ -1709,7 +1714,7 @@ void SkPaint::descriptorProc(const SkSurfaceProps* surfaceProps,
test_desc(rec, pe, &peBuffer, mf, &mfBuffer, ra, &raBuffer, desc, descSize);
#endif
- proc(fTypeface.get(), desc, context);
+ proc(fTypeface.get(), { pe, mf, ra }, desc, context);
}
SkGlyphCache* SkPaint::detachCache(const SkSurfaceProps* surfaceProps,
« no previous file with comments | « src/core/SkGlyphCache.cpp ('k') | src/core/SkScalerContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698