aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkRemoteGlyphCache.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@google.com>2018-05-23 00:15:37 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-23 00:17:16 +0000
commit7257e22e43a56a5f4f772b687034580061cd011f (patch)
treec7f8b54f2d35b3be50309f559ac886a0ec9ddb7a /src/core/SkRemoteGlyphCache.cpp
parentfc6cf92e4b21c92ead769fae557534056eac6d83 (diff)
Revert "fonts: Add support for distance field text to font remoting."
This reverts commit 35e0a1a6908492c754156d1abb785da3a9ce2a6b. Reason for revert: looks like we're leaking paths? https://chromium-swarm.appspot.com/task?id=3da25e2f0cadb210&refresh=10 Original change's description: > fonts: Add support for distance field text to font remoting. > > R=​jvanverth@google.com, herb@google.com > > Bug: skia:7913 > Change-Id: Id3f5b3e75005be9a7234df774268359b406c99a8 > Reviewed-on: https://skia-review.googlesource.com/128970 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Reviewed-by: Jim Van Verth <jvanverth@google.com> > Commit-Queue: Khusal Sagar <khushalsagar@chromium.org> TBR=jvanverth@google.com,bsalomon@google.com,bungeman@google.com,herb@google.com,khushalsagar@chromium.org Change-Id: I37c54c8748db9b20e1f48016d8298808a1999fdb No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:7913 Reviewed-on: https://skia-review.googlesource.com/129681 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'src/core/SkRemoteGlyphCache.cpp')
-rw-r--r--src/core/SkRemoteGlyphCache.cpp69
1 files changed, 13 insertions, 56 deletions
diff --git a/src/core/SkRemoteGlyphCache.cpp b/src/core/SkRemoteGlyphCache.cpp
index d5e96fce88..c7f1f4497b 100644
--- a/src/core/SkRemoteGlyphCache.cpp
+++ b/src/core/SkRemoteGlyphCache.cpp
@@ -23,7 +23,6 @@
#if SK_SUPPORT_GPU
#include "GrDrawOpAtlas.h"
-#include "text/GrAtlasTextContext.h"
#endif
static SkDescriptor* auto_descriptor_from_desc(const SkDescriptor* source_desc,
@@ -189,18 +188,14 @@ public:
};
// -- SkTextBlobCacheDiffCanvas -------------------------------------------------------------------
-SkTextBlobCacheDiffCanvas::Settings::Settings() = default;
-SkTextBlobCacheDiffCanvas::Settings::~Settings() = default;
-
SkTextBlobCacheDiffCanvas::SkTextBlobCacheDiffCanvas(int width, int height,
const SkMatrix& deviceMatrix,
const SkSurfaceProps& props,
- SkStrikeServer* strikeSever, Settings settings)
+ SkStrikeServer* strikeSever)
: SkNoDrawCanvas{sk_make_sp<TrackLayerDevice>(SkIRect::MakeWH(width, height), props)}
, fDeviceMatrix{deviceMatrix}
, fSurfaceProps{props}
- , fStrikeServer{strikeSever}
- , fSettings{settings} {
+ , fStrikeServer{strikeSever} {
SkASSERT(fStrikeServer);
}
@@ -279,23 +274,6 @@ void SkTextBlobCacheDiffCanvas::processGlyphRun(
runMatrix.preTranslate(position.x(), position.y());
runMatrix.preTranslate(it.offset().x(), it.offset().y());
-#if SK_SUPPORT_GPU
- GrAtlasTextContext::Options options;
- options.fMinDistanceFieldFontSize = fSettings.fMinDistanceFieldFontSize;
- options.fMaxDistanceFieldFontSize = fSettings.fMaxDistanceFieldFontSize;
- GrAtlasTextContext::SanitizeOptions(&options);
- if (GrAtlasTextContext::CanDrawAsDistanceFields(runPaint, runMatrix, fSurfaceProps,
- fSettings.fContextSupportsDistanceFieldText,
- options)) {
- SkScalar textRatio;
- SkPaint dfPaint(runPaint);
- SkScalerContextFlags flags;
- GrAtlasTextContext::InitDistanceFieldPaint(nullptr, &dfPaint, runMatrix, options,
- &textRatio, &flags);
- this->processGlyphRunForDFT(it, dfPaint, flags);
- }
-#endif
-
// If the matrix has perspective, we fall back to using distance field text or paths.
// TODO: Add distance field text support, and FallbackTextHelper logic from GrAtlasTextContext.
if (SkDraw::ShouldDrawTextAsPaths(runPaint, runMatrix)) {
@@ -356,11 +334,9 @@ void SkTextBlobCacheDiffCanvas::processGlyphRun(
SkScalerContextRec deviceSpecificRec;
SkScalerContextEffects effects;
- auto* glyphCacheState =
- static_cast<SkStrikeServer*>(fStrikeServer)
- ->getOrCreateCache(runPaint, &fSurfaceProps, &runMatrix,
- SkScalerContextFlags::kFakeGammaAndBoostContrast,
- &deviceSpecificRec, &effects);
+ auto* glyphCacheState = static_cast<SkStrikeServer*>(fStrikeServer)
+ ->getOrCreateCache(runPaint, &fSurfaceProps, &runMatrix,
+ &deviceSpecificRec, &effects);
SkASSERT(glyphCacheState);
const bool asPath = false;
@@ -395,33 +371,11 @@ void SkTextBlobCacheDiffCanvas::processGlyphRunForPaths(const SkTextBlobRunItera
SkScalerContextRec deviceSpecificRec;
SkScalerContextEffects effects;
- auto* glyphCacheState =
- static_cast<SkStrikeServer*>(fStrikeServer)
- ->getOrCreateCache(pathPaint, &fSurfaceProps, nullptr,
- SkScalerContextFlags::kFakeGammaAndBoostContrast,
- &deviceSpecificRec, &effects);
-
- const bool asPath = true;
- const SkIPoint subPixelPos{0, 0};
- const uint16_t* glyphs = it.glyphs();
- for (uint32_t index = 0; index < it.glyphCount(); index++) {
- glyphCacheState->addGlyph(runPaint.getTypeface(),
- effects,
- SkPackedGlyphID(glyphs[index], subPixelPos.x(), subPixelPos.y()),
- asPath);
- }
-}
-
-void SkTextBlobCacheDiffCanvas::processGlyphRunForDFT(const SkTextBlobRunIterator& it,
- const SkPaint& runPaint,
- SkScalerContextFlags flags) {
- SkScalerContextRec deviceSpecificRec;
- SkScalerContextEffects effects;
auto* glyphCacheState = static_cast<SkStrikeServer*>(fStrikeServer)
- ->getOrCreateCache(runPaint, &fSurfaceProps, nullptr, flags,
+ ->getOrCreateCache(pathPaint, &fSurfaceProps, nullptr,
&deviceSpecificRec, &effects);
- const bool asPath = false;
+ const bool asPath = true;
const SkIPoint subPixelPos{0, 0};
const uint16_t* glyphs = it.glyphs();
for (uint32_t index = 0; index < it.glyphCount(); index++) {
@@ -497,12 +451,15 @@ SkStrikeServer::SkGlyphCacheState* SkStrikeServer::getOrCreateCache(
const SkPaint& paint,
const SkSurfaceProps* props,
const SkMatrix* matrix,
- SkScalerContextFlags flags,
SkScalerContextRec* deviceRec,
SkScalerContextEffects* effects) {
SkScalerContextRec keyRec;
- SkScalerContext::MakeRecAndEffects(paint, props, matrix, flags, deviceRec, effects, true);
- SkScalerContext::MakeRecAndEffects(paint, props, matrix, flags, &keyRec, effects, false);
+ SkScalerContext::MakeRecAndEffects(paint, props, matrix,
+ SkScalerContextFlags::kFakeGammaAndBoostContrast, deviceRec,
+ effects, true);
+ SkScalerContext::MakeRecAndEffects(paint, props, matrix,
+ SkScalerContextFlags::kFakeGammaAndBoostContrast, &keyRec,
+ effects, false);
TRACE_EVENT1("skia", "RecForDesc", "rec", TRACE_STR_COPY(keyRec.dump().c_str()));
// TODO: possible perf improvement - don't recompute the device desc on cache hit.