Skip to content

Instantly share code, notes, and snippets.

@jeremyroman
Created September 24, 2014 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremyroman/0d6860047cd584185c9d to your computer and use it in GitHub Desktop.
Save jeremyroman/0d6860047cd584185c9d to your computer and use it in GitHub Desktop.
text blob counting patch
diff --git a/Source/core/rendering/TextPainter.cpp b/Source/core/rendering/TextPainter.cpp
index 3901813..4133ea0 100644
--- a/Source/core/rendering/TextPainter.cpp
+++ b/Source/core/rendering/TextPainter.cpp
@@ -178,6 +178,8 @@ static bool graphicsContextAllowsTextBlobs(GraphicsContext* context)
return !context->strokeGradient() && !context->strokePattern() && !context->fillGradient() && !context->fillPattern();
}
+static unsigned long g_totalBlobsPainted = 0;
+
template <TextPainter::PaintInternalStep step>
void TextPainter::paintInternalRun(TextRunPaintInfo& textRunPaintInfo, int from, int to, TextBlobPtr* cachedTextBlob)
{
@@ -195,12 +197,16 @@ void TextPainter::paintInternalRun(TextRunPaintInfo& textRunPaintInfo, int from,
TextBlobPtr& textBlob = cachedTextBlob ? *cachedTextBlob : localTextBlob;
bool canUseTextBlobs = RuntimeEnabledFeatures::textBlobEnabled() && graphicsContextAllowsTextBlobs(m_graphicsContext);
- if (canUseTextBlobs && !textBlob)
+ const char* label = "c ";
+ if (canUseTextBlobs && !textBlob) {
textBlob = m_font.buildTextBlob(textRunPaintInfo, m_textOrigin, m_graphicsContext->couldUseLCDRenderedText());
+ label = cachedTextBlob ? " * " : " X";
+ }
- if (canUseTextBlobs && textBlob)
+ if (canUseTextBlobs && textBlob) {
+ fprintf(stderr, "%19lu %3s TextBlob@%p\n", ++g_totalBlobsPainted, label, textBlob.get());
m_font.drawTextBlob(m_graphicsContext, textBlob.get(), m_textOrigin.data());
- else
+ } else
m_graphicsContext->drawText(m_font, textRunPaintInfo, m_textOrigin);
}
diff --git a/Source/platform/RuntimeEnabledFeatures.in b/Source/platform/RuntimeEnabledFeatures.in
index b75abe6..2d8e313 100644
--- a/Source/platform/RuntimeEnabledFeatures.in
+++ b/Source/platform/RuntimeEnabledFeatures.in
@@ -136,7 +136,7 @@ Touch status=stable
// Temporary setting to allow easy rollback of change to hover media feature.
HoverMediaQueryKeywords status=stable
-TextBlob
+TextBlob status=stable
TouchIconLoading
ThreadedParserDataReceiver status=experimental
UserSelectAll status=experimental
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment