aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-05-24 14:39:01 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-24 20:41:08 +0000
commit26cbe5130aa9839b5429b9507363ce2474091808 (patch)
tree5d10df1e2a768bf31af6ccbd2fd636f44f7c98b6 /src
parent4a0ad501e4919e06bcf7a7ef4adec8f28818946b (diff)
Rename GrAtlasTextContext -> GrTextContext
Change-Id: I309b39425afc9b45095241eeb299096bc426afed Reviewed-on: https://skia-review.googlesource.com/130029 Reviewed-by: Herb Derby <herb@google.com> Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/atlastext/SkAtlasTextTarget.cpp4
-rw-r--r--src/atlastext/SkInternalAtlasTextContext.cpp2
-rw-r--r--src/core/SkRemoteGlyphCache.cpp14
-rw-r--r--src/gpu/GrContext.cpp12
-rw-r--r--src/gpu/GrDrawingManager.cpp16
-rw-r--r--src/gpu/GrDrawingManager.h10
-rw-r--r--src/gpu/GrRenderTargetContext.cpp8
-rw-r--r--src/gpu/ops/GrAtlasTextOp.cpp2
-rw-r--r--src/gpu/ops/GrAtlasTextOp.h2
-rw-r--r--src/gpu/text/GrAtlasTextBlob.h4
-rw-r--r--src/gpu/text/GrDistanceFieldAdjustTable.h2
-rw-r--r--src/gpu/text/GrTextBlobCache.h2
-rw-r--r--src/gpu/text/GrTextContext.cpp (renamed from src/gpu/text/GrAtlasTextContext.cpp)263
-rw-r--r--src/gpu/text/GrTextContext.h (renamed from src/gpu/text/GrAtlasTextContext.h)8
14 files changed, 174 insertions, 175 deletions
diff --git a/src/atlastext/SkAtlasTextTarget.cpp b/src/atlastext/SkAtlasTextTarget.cpp
index 39f0c1b1d6..5d46669d9c 100644
--- a/src/atlastext/SkAtlasTextTarget.cpp
+++ b/src/atlastext/SkAtlasTextTarget.cpp
@@ -15,7 +15,7 @@
#include "SkGr.h"
#include "SkInternalAtlasTextContext.h"
#include "ops/GrAtlasTextOp.h"
-#include "text/GrAtlasTextContext.h"
+#include "text/GrTextContext.h"
static constexpr int kMaxBatchLookBack = 10;
@@ -135,7 +135,7 @@ void SkInternalAtlasTextTarget::drawText(const SkGlyphID glyphs[], const SkPoint
SkSurfaceProps props(SkSurfaceProps::kUseDistanceFieldFonts_Flag, kUnknown_SkPixelGeometry);
auto* grContext = this->context()->internal().grContext();
auto bounds = SkIRect::MakeWH(fWidth, fHeight);
- auto atlasTextContext = grContext->contextPriv().drawingManager()->getAtlasTextContext();
+ auto atlasTextContext = grContext->contextPriv().drawingManager()->getTextContext();
size_t byteLength = sizeof(SkGlyphID) * glyphCnt;
const SkScalar* pos = &positions->fX;
atlasTextContext->drawPosText(grContext, this, GrNoClip(), paint, this->ctm(), props,
diff --git a/src/atlastext/SkInternalAtlasTextContext.cpp b/src/atlastext/SkInternalAtlasTextContext.cpp
index 8abe2e8f9e..2c9cddcc77 100644
--- a/src/atlastext/SkInternalAtlasTextContext.cpp
+++ b/src/atlastext/SkInternalAtlasTextContext.cpp
@@ -77,7 +77,7 @@ void SkInternalAtlasTextContext::recordDraw(const void* srcVertexData, int glyph
memcpy(vertexData, srcVertexData, vertexDataSize);
for (int i = 0; i < 4 * glyphCnt; ++i) {
auto* vertex = reinterpret_cast<SkAtlasTextRenderer::SDFVertex*>(vertexData) + i;
- // GrAtlasTextContext encodes a texture index into the lower bit of each texture coord.
+ // GrTextContext encodes a texture index into the lower bit of each texture coord.
// This isn't expected by SkAtlasTextRenderer subclasses.
vertex->fTextureCoordX /= 2;
vertex->fTextureCoordY /= 2;
diff --git a/src/core/SkRemoteGlyphCache.cpp b/src/core/SkRemoteGlyphCache.cpp
index 216a2a9dab..a987e5bdde 100644
--- a/src/core/SkRemoteGlyphCache.cpp
+++ b/src/core/SkRemoteGlyphCache.cpp
@@ -23,7 +23,7 @@
#if SK_SUPPORT_GPU
#include "GrDrawOpAtlas.h"
-#include "text/GrAtlasTextContext.h"
+#include "text/GrTextContext.h"
#endif
static SkDescriptor* auto_descriptor_from_desc(const SkDescriptor* source_desc,
@@ -280,24 +280,24 @@ void SkTextBlobCacheDiffCanvas::processGlyphRun(
runMatrix.preTranslate(it.offset().x(), it.offset().y());
#if SK_SUPPORT_GPU
- GrAtlasTextContext::Options options;
+ GrTextContext::Options options;
options.fMinDistanceFieldFontSize = fSettings.fMinDistanceFieldFontSize;
options.fMaxDistanceFieldFontSize = fSettings.fMaxDistanceFieldFontSize;
- GrAtlasTextContext::SanitizeOptions(&options);
- if (GrAtlasTextContext::CanDrawAsDistanceFields(runPaint, runMatrix, fSurfaceProps,
+ GrTextContext::SanitizeOptions(&options);
+ if (GrTextContext::CanDrawAsDistanceFields(runPaint, runMatrix, fSurfaceProps,
fSettings.fContextSupportsDistanceFieldText,
options)) {
SkScalar textRatio;
SkPaint dfPaint(runPaint);
SkScalerContextFlags flags;
- GrAtlasTextContext::InitDistanceFieldPaint(nullptr, &dfPaint, runMatrix, options,
+ GrTextContext::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.
+ // TODO: Add distance field text support, and FallbackTextHelper logic from GrTextContext.
if (SkDraw::ShouldDrawTextAsPaths(runPaint, runMatrix)) {
this->processGlyphRunForPaths(it, runPaint);
return;
@@ -387,7 +387,7 @@ void SkTextBlobCacheDiffCanvas::processGlyphRunForPaths(const SkTextBlobRunItera
const SkPaint& runPaint) {
TRACE_EVENT0("skia", "SkTextBlobCacheDiffCanvas::processGlyphRunForPaths");
- // The code below borrowed from GrAtlasTextContext::DrawBmpPosTextAsPaths.
+ // The code below borrowed from GrTextContext::DrawBmpPosTextAsPaths.
SkPaint pathPaint(runPaint);
pathPaint.setupForAsPaths();
pathPaint.setStyle(SkPaint::kFill_Style);
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 7195405833..572f58972b 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -116,20 +116,20 @@ bool GrContext::initCommon(const GrContextOptions& options) {
prcOptions.fGpuPathRenderers &= ~GpuPathRenderers::kCoverageCounting;
}
- GrAtlasTextContext::Options atlasTextContextOptions;
- atlasTextContextOptions.fMaxDistanceFieldFontSize = options.fGlyphsAsPathsFontSize;
- atlasTextContextOptions.fMinDistanceFieldFontSize = options.fMinDistanceFieldFontSize;
- atlasTextContextOptions.fDistanceFieldVerticesAlwaysHaveW = false;
+ GrTextContext::Options textContextOptions;
+ textContextOptions.fMaxDistanceFieldFontSize = options.fGlyphsAsPathsFontSize;
+ textContextOptions.fMinDistanceFieldFontSize = options.fMinDistanceFieldFontSize;
+ textContextOptions.fDistanceFieldVerticesAlwaysHaveW = false;
#if SK_SUPPORT_ATLAS_TEXT
if (GrContextOptions::Enable::kYes == options.fDistanceFieldGlyphVerticesAlwaysHaveW) {
- atlasTextContextOptions.fDistanceFieldVerticesAlwaysHaveW = true;
+ textContextOptions.fDistanceFieldVerticesAlwaysHaveW = true;
}
#endif
bool explicitlyAllocatingResources = fResourceProvider
? fResourceProvider->explicitlyAllocateGPUResources()
: false;
- fDrawingManager.reset(new GrDrawingManager(this, prcOptions, atlasTextContextOptions,
+ fDrawingManager.reset(new GrDrawingManager(this, prcOptions, textContextOptions,
&fSingleOwner, explicitlyAllocatingResources,
options.fSortRenderTargets));
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index de414ae545..4391117248 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -26,7 +26,7 @@
#include "SkSurface_Gpu.h"
#include "SkTTopoSort.h"
#include "GrTracing.h"
-#include "text/GrAtlasTextContext.h"
+#include "text/GrTextContext.h"
// Turn on/off the sorting of opLists at flush time
#ifndef SK_DISABLE_RENDER_TARGET_SORTING
@@ -35,16 +35,16 @@
GrDrawingManager::GrDrawingManager(GrContext* context,
const GrPathRendererChain::Options& optionsForPathRendererChain,
- const GrAtlasTextContext::Options& optionsForAtlasTextContext,
+ const GrTextContext::Options& optionsForTextContext,
GrSingleOwner* singleOwner,
bool explicitlyAllocating,
GrContextOptions::Enable sortRenderTargets)
: fContext(context)
, fOptionsForPathRendererChain(optionsForPathRendererChain)
- , fOptionsForAtlasTextContext(optionsForAtlasTextContext)
+ , fOptionsForTextContext(optionsForTextContext)
, fSingleOwner(singleOwner)
, fAbandoned(false)
- , fAtlasTextContext(nullptr)
+ , fTextContext(nullptr)
, fPathRendererChain(nullptr)
, fSoftwarePathRenderer(nullptr)
, fFlushing(false) {
@@ -438,12 +438,12 @@ sk_sp<GrTextureOpList> GrDrawingManager::newTextureOpList(GrTextureProxy* textur
return opList;
}
-GrAtlasTextContext* GrDrawingManager::getAtlasTextContext() {
- if (!fAtlasTextContext) {
- fAtlasTextContext = GrAtlasTextContext::Make(fOptionsForAtlasTextContext);
+GrTextContext* GrDrawingManager::getTextContext() {
+ if (!fTextContext) {
+ fTextContext = GrTextContext::Make(fOptionsForTextContext);
}
- return fAtlasTextContext.get();
+ return fTextContext.get();
}
/*
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index 1ec4d8f266..5978e487b1 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -13,7 +13,7 @@
#include "GrRenderTargetOpList.h"
#include "GrResourceCache.h"
#include "SkTArray.h"
-#include "text/GrAtlasTextContext.h"
+#include "text/GrTextContext.h"
class GrContext;
class GrCoverageCountingPathRenderer;
@@ -52,7 +52,7 @@ public:
GrContext* getContext() { return fContext; }
- GrAtlasTextContext* getAtlasTextContext();
+ GrTextContext* getTextContext();
GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args,
bool allowSW,
@@ -86,7 +86,7 @@ public:
private:
GrDrawingManager(GrContext*, const GrPathRendererChain::Options&,
- const GrAtlasTextContext::Options&, GrSingleOwner*,
+ const GrTextContext::Options&, GrSingleOwner*,
bool explicitlyAllocating, GrContextOptions::Enable sortRenderTargets);
void abandon();
@@ -115,7 +115,7 @@ private:
GrContext* fContext;
GrPathRendererChain::Options fOptionsForPathRendererChain;
- GrAtlasTextContext::Options fOptionsForAtlasTextContext;
+ GrTextContext::Options fOptionsForTextContext;
// In debug builds we guard against improper thread handling
GrSingleOwner* fSingleOwner;
@@ -127,7 +127,7 @@ private:
// These are the new opLists generated by the onFlush CBs
SkSTArray<8, sk_sp<GrOpList>> fOnFlushCBOpLists;
- std::unique_ptr<GrAtlasTextContext> fAtlasTextContext;
+ std::unique_ptr<GrTextContext> fTextContext;
GrPathRendererChain* fPathRendererChain;
GrSoftwarePathRenderer* fSoftwarePathRenderer;
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 1f9e4da3f2..f4db697e41 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -48,7 +48,7 @@
#include "ops/GrShadowRRectOp.h"
#include "ops/GrStencilPathOp.h"
#include "ops/GrTextureOp.h"
-#include "text/GrAtlasTextContext.h"
+#include "text/GrTextContext.h"
#include "text/GrTextUtils.h"
class GrRenderTargetContext::TextTarget : public GrTextUtils::Target {
@@ -226,7 +226,7 @@ void GrRenderTargetContext::drawText(const GrClip& clip, const SkPaint& skPaint,
SkDEBUGCODE(this->validate();)
GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "drawText", fContext);
- GrAtlasTextContext* atlasTextContext = this->drawingManager()->getAtlasTextContext();
+ GrTextContext* atlasTextContext = this->drawingManager()->getTextContext();
atlasTextContext->drawText(fContext, fTextTarget.get(), clip, skPaint, viewMatrix,
fSurfaceProps, text, byteLength, x, y, clipBounds);
}
@@ -241,7 +241,7 @@ void GrRenderTargetContext::drawPosText(const GrClip& clip, const SkPaint& paint
SkDEBUGCODE(this->validate();)
GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "drawPosText", fContext);
- GrAtlasTextContext* atlasTextContext = this->drawingManager()->getAtlasTextContext();
+ GrTextContext* atlasTextContext = this->drawingManager()->getTextContext();
atlasTextContext->drawPosText(fContext, fTextTarget.get(), clip, paint, viewMatrix,
fSurfaceProps, text, byteLength, pos, scalarsPerPosition, offset,
clipBounds);
@@ -256,7 +256,7 @@ void GrRenderTargetContext::drawTextBlob(const GrClip& clip, const SkPaint& pain
SkDEBUGCODE(this->validate();)
GR_CREATE_TRACE_MARKER_CONTEXT("GrRenderTargetContext", "drawTextBlob", fContext);
- GrAtlasTextContext* atlasTextContext = this->drawingManager()->getAtlasTextContext();
+ GrTextContext* atlasTextContext = this->drawingManager()->getTextContext();
atlasTextContext->drawTextBlob(fContext, fTextTarget.get(), clip, paint, viewMatrix,
fSurfaceProps, blob, x, y, filter, clipBounds);
}
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index bb6675a2ec..2ec6f60686 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -449,7 +449,7 @@ bool GrAtlasTextOp::onCombineIfPossible(GrOp* t, const GrCaps& caps) {
}
// TODO trying to figure out why lcd is so whack
-// (see comments in GrAtlasTextContext::ComputeCanonicalColor)
+// (see comments in GrTextContext::ComputeCanonicalColor)
sk_sp<GrGeometryProcessor> GrAtlasTextOp::setupDfProcessor(const sk_sp<GrTextureProxy>* proxies,
unsigned int numActiveProxies) const {
bool isLCD = this->isLCD();
diff --git a/src/gpu/ops/GrAtlasTextOp.h b/src/gpu/ops/GrAtlasTextOp.h
index dd24c1aa59..836d305668 100644
--- a/src/gpu/ops/GrAtlasTextOp.h
+++ b/src/gpu/ops/GrAtlasTextOp.h
@@ -9,7 +9,7 @@
#define GrAtlasTextOp_DEFINED
#include "ops/GrMeshDrawOp.h"
-#include "text/GrAtlasTextContext.h"
+#include "text/GrTextContext.h"
#include "text/GrDistanceFieldAdjustTable.h"
#include "text/GrGlyphCache.h"
diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h
index d7e1b6def6..302a66d9d4 100644
--- a/src/gpu/text/GrAtlasTextBlob.h
+++ b/src/gpu/text/GrAtlasTextBlob.h
@@ -31,7 +31,7 @@ class SkDrawFilter;
class SkTextBlob;
class SkTextBlobRunIterator;
-// With this flag enabled, the GrAtlasTextContext will, as a sanity check, regenerate every blob
+// With this flag enabled, the GrTextContext will, as a sanity check, regenerate every blob
// that comes in to verify the integrity of its cache
#define CACHE_SANITY_CHECK 0
@@ -322,7 +322,7 @@ private:
* many SubRuns as it has glyphs, ie if a run alternates between color emoji and A8. In
* practice, the vast majority of runs have only a single subrun.
*
- * Finally, for runs where the entire thing is too large for the GrAtlasTextContext to
+ * Finally, for runs where the entire thing is too large for the GrTextContext to
* handle, we have a bit to mark the run as flushable via rendering as paths or as scaled
* glyphs. It would be a bit expensive to figure out ahead of time whether or not a run
* can flush in this manner, so we always allocate vertices for the run, regardless of
diff --git a/src/gpu/text/GrDistanceFieldAdjustTable.h b/src/gpu/text/GrDistanceFieldAdjustTable.h
index 0f5c6f29ab..fca9a8cb8e 100644
--- a/src/gpu/text/GrDistanceFieldAdjustTable.h
+++ b/src/gpu/text/GrDistanceFieldAdjustTable.h
@@ -12,7 +12,7 @@
#include "SkScalar.h"
// Distance field text needs this table to compute a value for use in the fragment shader.
-// Because the GrAtlasTextContext can go out of scope before the final flush, this needs to be
+// Because the GrTextContext can go out of scope before the final flush, this needs to be
// refcnted and malloced
struct GrDistanceFieldAdjustTable : public SkNVRefCnt<GrDistanceFieldAdjustTable> {
GrDistanceFieldAdjustTable() { this->buildDistanceAdjustTables(); }
diff --git a/src/gpu/text/GrTextBlobCache.h b/src/gpu/text/GrTextBlobCache.h
index 4931667c61..c6b5c70614 100644
--- a/src/gpu/text/GrTextBlobCache.h
+++ b/src/gpu/text/GrTextBlobCache.h
@@ -8,7 +8,7 @@
#ifndef GrTextBlobCache_DEFINED
#define GrTextBlobCache_DEFINED
-#include "GrAtlasTextContext.h"
+#include "GrTextContext.h"
#include "SkMessageBus.h"
#include "SkRefCnt.h"
#include "SkTArray.h"
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrTextContext.cpp
index 6d62d80b6d..dfc6898929 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrTextContext.cpp
@@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "GrAtlasTextContext.h"
+#include "GrTextContext.h"
#include "GrCaps.h"
#include "GrContext.h"
#include "GrContextPriv.h"
@@ -40,16 +40,16 @@ static const int kDefaultMaxDistanceFieldFontSize = 384;
static const int kDefaultMaxDistanceFieldFontSize = 2 * kLargeDFFontSize;
#endif
-GrAtlasTextContext::GrAtlasTextContext(const Options& options)
+GrTextContext::GrTextContext(const Options& options)
: fDistanceAdjustTable(new GrDistanceFieldAdjustTable), fOptions(options) {
SanitizeOptions(&fOptions);
}
-std::unique_ptr<GrAtlasTextContext> GrAtlasTextContext::Make(const Options& options) {
- return std::unique_ptr<GrAtlasTextContext>(new GrAtlasTextContext(options));
+std::unique_ptr<GrTextContext> GrTextContext::Make(const Options& options) {
+ return std::unique_ptr<GrTextContext>(new GrTextContext(options));
}
-SkColor GrAtlasTextContext::ComputeCanonicalColor(const SkPaint& paint, bool lcd) {
+SkColor GrTextContext::ComputeCanonicalColor(const SkPaint& paint, bool lcd) {
SkColor canonicalColor = paint.computeLuminanceColor();
if (lcd) {
// This is the correct computation, but there are tons of cases where LCD can be overridden.
@@ -70,7 +70,7 @@ SkColor GrAtlasTextContext::ComputeCanonicalColor(const SkPaint& paint, bool lcd
return canonicalColor;
}
-SkScalerContextFlags GrAtlasTextContext::ComputeScalerContextFlags(
+SkScalerContextFlags GrTextContext::ComputeScalerContextFlags(
const GrColorSpaceInfo& colorSpaceInfo) {
// If we're doing gamma-correct rendering, then we can disable the gamma hacks.
// Otherwise, leave them on. In either case, we still want the contrast boost:
@@ -84,7 +84,7 @@ SkScalerContextFlags GrAtlasTextContext::ComputeScalerContextFlags(
// TODO if this function ever shows up in profiling, then we can compute this value when the
// textblob is being built and cache it. However, for the time being textblobs mostly only have 1
// run so this is not a big deal to compute here.
-bool GrAtlasTextContext::HasLCD(const SkTextBlob* blob) {
+bool GrTextContext::HasLCD(const SkTextBlob* blob) {
SkTextBlobRunIterator it(blob);
for (; !it.done(); it.next()) {
if (it.isLCD()) {
@@ -94,11 +94,11 @@ bool GrAtlasTextContext::HasLCD(const SkTextBlob* blob) {
return false;
}
-void GrAtlasTextContext::drawTextBlob(GrContext* context, GrTextUtils::Target* target,
- const GrClip& clip, const SkPaint& skPaint,
- const SkMatrix& viewMatrix, const SkSurfaceProps& props,
- const SkTextBlob* blob, SkScalar x, SkScalar y,
- SkDrawFilter* drawFilter, const SkIRect& clipBounds) {
+void GrTextContext::drawTextBlob(GrContext* context, GrTextUtils::Target* target,
+ const GrClip& clip, const SkPaint& skPaint,
+ const SkMatrix& viewMatrix, const SkSurfaceProps& props,
+ const SkTextBlob* blob, SkScalar x, SkScalar y,
+ SkDrawFilter* drawFilter, const SkIRect& clipBounds) {
// If we have been abandoned, then don't draw
if (context->contextPriv().abandoned()) {
return;
@@ -181,15 +181,15 @@ void GrAtlasTextContext::drawTextBlob(GrContext* context, GrTextUtils::Target* t
clip, viewMatrix, clipBounds, x, y);
}
-void GrAtlasTextContext::regenerateTextBlob(GrAtlasTextBlob* cacheBlob,
- GrGlyphCache* glyphCache,
- const GrShaderCaps& shaderCaps,
- const GrTextUtils::Paint& paint,
- SkScalerContextFlags scalerContextFlags,
- const SkMatrix& viewMatrix,
- const SkSurfaceProps& props, const SkTextBlob* blob,
- SkScalar x, SkScalar y,
- SkDrawFilter* drawFilter) const {
+void GrTextContext::regenerateTextBlob(GrAtlasTextBlob* cacheBlob,
+ GrGlyphCache* glyphCache,
+ const GrShaderCaps& shaderCaps,
+ const GrTextUtils::Paint& paint,
+ SkScalerContextFlags scalerContextFlags,
+ const SkMatrix& viewMatrix,
+ const SkSurfaceProps& props, const SkTextBlob* blob,
+ SkScalar x, SkScalar y,
+ SkDrawFilter* drawFilter) const {
cacheBlob->initReusableBlob(paint.luminanceColor(), viewMatrix, x, y);
// Regenerate textblob
@@ -252,15 +252,15 @@ void GrAtlasTextContext::regenerateTextBlob(GrAtlasTextBlob* cacheBlob,
}
inline sk_sp<GrAtlasTextBlob>
-GrAtlasTextContext::makeDrawTextBlob(GrTextBlobCache* blobCache,
- GrGlyphCache* glyphCache,
- const GrShaderCaps& shaderCaps,
- const GrTextUtils::Paint& paint,
- SkScalerContextFlags scalerContextFlags,
- const SkMatrix& viewMatrix,
- const SkSurfaceProps& props,
- const char text[], size_t byteLength,
- SkScalar x, SkScalar y) const {
+GrTextContext::makeDrawTextBlob(GrTextBlobCache* blobCache,
+ GrGlyphCache* glyphCache,
+ const GrShaderCaps& shaderCaps,
+ const GrTextUtils::Paint& paint,
+ SkScalerContextFlags scalerContextFlags,
+ const SkMatrix& viewMatrix,
+ const SkSurfaceProps& props,
+ const char text[], size_t byteLength,
+ SkScalar x, SkScalar y) const {
int glyphCount = paint.skPaint().countText(text, byteLength);
if (!glyphCount) {
return nullptr;
@@ -281,16 +281,16 @@ GrAtlasTextContext::makeDrawTextBlob(GrTextBlobCache* blobCache,
}
inline sk_sp<GrAtlasTextBlob>
-GrAtlasTextContext::makeDrawPosTextBlob(GrTextBlobCache* blobCache,
- GrGlyphCache* glyphCache,
- const GrShaderCaps& shaderCaps,
- const GrTextUtils::Paint& paint,
- SkScalerContextFlags scalerContextFlags,
- const SkMatrix& viewMatrix,
- const SkSurfaceProps& props,
- const char text[], size_t byteLength,
- const SkScalar pos[], int scalarsPerPosition, const
- SkPoint& offset) const {
+GrTextContext::makeDrawPosTextBlob(GrTextBlobCache* blobCache,
+ GrGlyphCache* glyphCache,
+ const GrShaderCaps& shaderCaps,
+ const GrTextUtils::Paint& paint,
+ SkScalerContextFlags scalerContextFlags,
+ const SkMatrix& viewMatrix,
+ const SkSurfaceProps& props,
+ const char text[], size_t byteLength,
+ const SkScalar pos[], int scalarsPerPosition, const
+ SkPoint& offset) const {
int glyphCount = paint.skPaint().countText(text, byteLength);
if (!glyphCount) {
return nullptr;
@@ -311,11 +311,11 @@ GrAtlasTextContext::makeDrawPosTextBlob(GrTextBlobCache* blobCache,
return blob;
}
-void GrAtlasTextContext::drawText(GrContext* context, GrTextUtils::Target* target,
- const GrClip& clip, const SkPaint& skPaint,
- const SkMatrix& viewMatrix, const SkSurfaceProps& props,
- const char text[], size_t byteLength, SkScalar x, SkScalar y,
- const SkIRect& regionClipBounds) {
+void GrTextContext::drawText(GrContext* context, GrTextUtils::Target* target,
+ const GrClip& clip, const SkPaint& skPaint,
+ const SkMatrix& viewMatrix, const SkSurfaceProps& props,
+ const char text[], size_t byteLength, SkScalar x, SkScalar y,
+ const SkIRect& regionClipBounds) {
if (context->contextPriv().abandoned()) {
return;
}
@@ -334,12 +334,12 @@ void GrAtlasTextContext::drawText(GrContext* context, GrTextUtils::Target* targe
}
}
-void GrAtlasTextContext::drawPosText(GrContext* context, GrTextUtils::Target* target,
- const GrClip& clip, const SkPaint& skPaint,
- const SkMatrix& viewMatrix, const SkSurfaceProps& props,
- const char text[], size_t byteLength, const SkScalar pos[],
- int scalarsPerPosition, const SkPoint& offset,
- const SkIRect& regionClipBounds) {
+void GrTextContext::drawPosText(GrContext* context, GrTextUtils::Target* target,
+ const GrClip& clip, const SkPaint& skPaint,
+ const SkMatrix& viewMatrix, const SkSurfaceProps& props,
+ const char text[], size_t byteLength, const SkScalar pos[],
+ int scalarsPerPosition, const SkPoint& offset,
+ const SkIRect& regionClipBounds) {
GrTextUtils::Paint paint(&skPaint, &target->colorSpaceInfo());
if (context->contextPriv().abandoned()) {
return;
@@ -358,12 +358,12 @@ void GrAtlasTextContext::drawPosText(GrContext* context, GrTextUtils::Target* ta
}
}
-void GrAtlasTextContext::DrawBmpText(GrAtlasTextBlob* blob, int runIndex,
- GrGlyphCache* glyphCache, const SkSurfaceProps& props,
- const GrTextUtils::Paint& paint,
- SkScalerContextFlags scalerContextFlags,
- const SkMatrix& viewMatrix, const char text[],
- size_t byteLength, SkScalar x, SkScalar y) {
+void GrTextContext::DrawBmpText(GrAtlasTextBlob* blob, int runIndex,
+ GrGlyphCache* glyphCache, const SkSurfaceProps& props,
+ const GrTextUtils::Paint& paint,
+ SkScalerContextFlags scalerContextFlags,
+ const SkMatrix& viewMatrix, const char text[],
+ size_t byteLength, SkScalar x, SkScalar y) {
SkASSERT(byteLength == 0 || text != nullptr);
// nothing to draw
@@ -394,13 +394,13 @@ void GrAtlasTextContext::DrawBmpText(GrAtlasTextBlob* blob, int runIndex,
});
}
-void GrAtlasTextContext::DrawBmpPosText(GrAtlasTextBlob* blob, int runIndex,
- GrGlyphCache* glyphCache, const SkSurfaceProps& props,
- const GrTextUtils::Paint& paint,
- SkScalerContextFlags scalerContextFlags,
- const SkMatrix& viewMatrix,
- const char text[], size_t byteLength, const SkScalar pos[],
- int scalarsPerPosition, const SkPoint& offset) {
+void GrTextContext::DrawBmpPosText(GrAtlasTextBlob* blob, int runIndex,
+ GrGlyphCache* glyphCache, const SkSurfaceProps& props,
+ const GrTextUtils::Paint& paint,
+ SkScalerContextFlags scalerContextFlags,
+ const SkMatrix& viewMatrix,
+ const char text[], size_t byteLength, const SkScalar pos[],
+ int scalarsPerPosition, const SkPoint& offset) {
SkASSERT(byteLength == 0 || text != nullptr);
SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition);
@@ -432,13 +432,13 @@ void GrAtlasTextContext::DrawBmpPosText(GrAtlasTextBlob* blob, int runIndex,
});
}
-void GrAtlasTextContext::DrawBmpTextAsPaths(GrAtlasTextBlob* blob, int runIndex,
- GrGlyphCache* glyphCache,
- const SkSurfaceProps& props,
- const GrTextUtils::Paint& origPaint,
- SkScalerContextFlags scalerContextFlags,
- const SkMatrix& viewMatrix, const char text[],
- size_t byteLength, SkScalar x, SkScalar y) {
+void GrTextContext::DrawBmpTextAsPaths(GrAtlasTextBlob* blob, int runIndex,
+ GrGlyphCache* glyphCache,
+ const SkSurfaceProps& props,
+ const GrTextUtils::Paint& origPaint,
+ SkScalerContextFlags scalerContextFlags,
+ const SkMatrix& viewMatrix, const char text[],
+ size_t byteLength, SkScalar x, SkScalar y) {
// nothing to draw
if (text == nullptr || byteLength == 0) {
return;
@@ -469,15 +469,15 @@ void GrAtlasTextContext::DrawBmpTextAsPaths(GrAtlasTextBlob* blob, int runIndex,
fallbackTextHelper.drawText(blob, runIndex, glyphCache, props, origPaint, scalerContextFlags);
}
-void GrAtlasTextContext::DrawBmpPosTextAsPaths(GrAtlasTextBlob* blob, int runIndex,
- GrGlyphCache* glyphCache,
- const SkSurfaceProps& props,
- const GrTextUtils::Paint& origPaint,
- SkScalerContextFlags scalerContextFlags,
- const SkMatrix& viewMatrix,
- const char text[], size_t byteLength,
- const SkScalar pos[], int scalarsPerPosition,
- const SkPoint& offset) {
+void GrTextContext::DrawBmpPosTextAsPaths(GrAtlasTextBlob* blob, int runIndex,
+ GrGlyphCache* glyphCache,
+ const SkSurfaceProps& props,
+ const GrTextUtils::Paint& origPaint,
+ SkScalerContextFlags scalerContextFlags,
+ const SkMatrix& viewMatrix,
+ const char text[], size_t byteLength,
+ const SkScalar pos[], int scalarsPerPosition,
+ const SkPoint& offset) {
SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition);
// nothing to draw
@@ -524,12 +524,12 @@ void GrAtlasTextContext::DrawBmpPosTextAsPaths(GrAtlasTextBlob* blob, int runInd
fallbackTextHelper.drawText(blob, runIndex, glyphCache, props, origPaint, scalerContextFlags);
}
-void GrAtlasTextContext::BmpAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
- GrGlyphCache* grGlyphCache,
- sk_sp<GrTextStrike>* strike,
- const SkGlyph& skGlyph, SkScalar sx, SkScalar sy,
- GrColor color, SkGlyphCache* skGlyphCache,
- SkScalar textRatio, bool needsTransform) {
+void GrTextContext::BmpAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
+ GrGlyphCache* grGlyphCache,
+ sk_sp<GrTextStrike>* strike,
+ const SkGlyph& skGlyph, SkScalar sx, SkScalar sy,
+ GrColor color, SkGlyphCache* skGlyphCache,
+ SkScalar textRatio, bool needsTransform) {
if (!*strike) {
*strike = grGlyphCache->getStrike(skGlyphCache);
}
@@ -562,7 +562,7 @@ void GrAtlasTextContext::BmpAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
textRatio, !needsTransform);
}
-void GrAtlasTextContext::SanitizeOptions(Options* options) {
+void GrTextContext::SanitizeOptions(Options* options) {
if (options->fMaxDistanceFieldFontSize < 0.f) {
options->fMaxDistanceFieldFontSize = kDefaultMaxDistanceFieldFontSize;
}
@@ -571,10 +571,10 @@ void GrAtlasTextContext::SanitizeOptions(Options* options) {
}
}
-bool GrAtlasTextContext::CanDrawAsDistanceFields(const SkPaint& skPaint, const SkMatrix& viewMatrix,
- const SkSurfaceProps& props,
- bool contextSupportsDistanceFieldText,
- const Options& options) {
+bool GrTextContext::CanDrawAsDistanceFields(const SkPaint& skPaint, const SkMatrix& viewMatrix,
+ const SkSurfaceProps& props,
+ bool contextSupportsDistanceFieldText,
+ const Options& options) {
if (!viewMatrix.hasPerspective()) {
SkScalar maxScale = viewMatrix.getMaxScale();
SkScalar scaledTextSize = maxScale * skPaint.getTextSize();
@@ -608,12 +608,12 @@ bool GrAtlasTextContext::CanDrawAsDistanceFields(const SkPaint& skPaint, const S
return true;
}
-void GrAtlasTextContext::InitDistanceFieldPaint(GrAtlasTextBlob* blob,
- SkPaint* skPaint,
- const SkMatrix& viewMatrix,
- const Options& options,
- SkScalar* textRatio,
- SkScalerContextFlags* flags) {
+void GrTextContext::InitDistanceFieldPaint(GrAtlasTextBlob* blob,
+ SkPaint* skPaint,
+ const SkMatrix& viewMatrix,
+ const Options& options,
+ SkScalar* textRatio,
+ SkScalerContextFlags* flags) {
SkScalar textSize = skPaint->getTextSize();
SkScalar scaledTextSize = textSize;
@@ -678,12 +678,12 @@ void GrAtlasTextContext::InitDistanceFieldPaint(GrAtlasTextBlob* blob,
*flags = SkScalerContextFlags::kNone;
}
-void GrAtlasTextContext::drawDFText(GrAtlasTextBlob* blob, int runIndex,
- GrGlyphCache* glyphCache, const SkSurfaceProps& props,
- const GrTextUtils::Paint& paint,
- SkScalerContextFlags scalerContextFlags,
- const SkMatrix& viewMatrix, const char text[],
- size_t byteLength, SkScalar x, SkScalar y) const {
+void GrTextContext::drawDFText(GrAtlasTextBlob* blob, int runIndex,
+ GrGlyphCache* glyphCache, const SkSurfaceProps& props,
+ const GrTextUtils::Paint& paint,
+ SkScalerContextFlags scalerContextFlags,
+ const SkMatrix& viewMatrix, const char text[],
+ size_t byteLength, SkScalar x, SkScalar y) const {
SkASSERT(byteLength == 0 || text != nullptr);
// nothing to draw
@@ -746,13 +746,13 @@ void GrAtlasTextContext::drawDFText(GrAtlasTextBlob* blob, int runIndex,
viewMatrix, text, byteLength, positions.begin(), 2, offset);
}
-void GrAtlasTextContext::drawDFPosText(GrAtlasTextBlob* blob, int runIndex,
- GrGlyphCache* glyphCache, const SkSurfaceProps& props,
- const GrTextUtils::Paint& paint,
- SkScalerContextFlags scalerContextFlags,
- const SkMatrix& viewMatrix, const char text[],
- size_t byteLength, const SkScalar pos[],
- int scalarsPerPosition, const SkPoint& offset) const {
+void GrTextContext::drawDFPosText(GrAtlasTextBlob* blob, int runIndex,
+ GrGlyphCache* glyphCache, const SkSurfaceProps& props,
+ const GrTextUtils::Paint& paint,
+ SkScalerContextFlags scalerContextFlags,
+ const SkMatrix& viewMatrix, const char text[],
+ size_t byteLength, const SkScalar pos[],
+ int scalarsPerPosition, const SkPoint& offset) const {
SkASSERT(byteLength == 0 || text != nullptr);
SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition);
@@ -810,11 +810,11 @@ void GrAtlasTextContext::drawDFPosText(GrAtlasTextBlob* blob, int runIndex,
}
// TODO: merge with BmpAppendGlyph
-void GrAtlasTextContext::DfAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
- GrGlyphCache* grGlyphCache, sk_sp<GrTextStrike>* strike,
- const SkGlyph& skGlyph, SkScalar sx, SkScalar sy,
- GrColor color, SkGlyphCache* skGlyphCache,
- SkScalar textRatio) {
+void GrTextContext::DfAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
+ GrGlyphCache* grGlyphCache, sk_sp<GrTextStrike>* strike,
+ const SkGlyph& skGlyph, SkScalar sx, SkScalar sy,
+ GrColor color, SkGlyphCache* skGlyphCache,
+ SkScalar textRatio) {
if (!*strike) {
*strike = grGlyphCache->getStrike(skGlyphCache);
}
@@ -845,7 +845,7 @@ void GrAtlasTextContext::DfAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
///////////////////////////////////////////////////////////////////////////////////////////////////
-void GrAtlasTextContext::FallbackTextHelper::appendText(const SkGlyph& glyph, int count,
+void GrTextContext::FallbackTextHelper::appendText(const SkGlyph& glyph, int count,
const char* text, SkPoint glyphPos) {
SkScalar maxDim = SkTMax(glyph.fWidth, glyph.fHeight)*fTextRatio;
if (!fUseTransformedFallback) {
@@ -868,11 +868,11 @@ void GrAtlasTextContext::FallbackTextHelper::appendText(const SkGlyph& glyph, in
*fFallbackPos.append() = glyphPos;
}
-void GrAtlasTextContext::FallbackTextHelper::drawText(GrAtlasTextBlob* blob, int runIndex,
- GrGlyphCache* glyphCache,
- const SkSurfaceProps& props,
- const GrTextUtils::Paint& paint,
- SkScalerContextFlags scalerContextFlags) {
+void GrTextContext::FallbackTextHelper::drawText(GrAtlasTextBlob* blob, int runIndex,
+ GrGlyphCache* glyphCache,
+ const SkSurfaceProps& props,
+ const GrTextUtils::Paint& paint,
+ SkScalerContextFlags scalerContextFlags) {
if (fFallbackTxt.count()) {
blob->initOverride(runIndex);
blob->setHasBitmap();
@@ -906,7 +906,7 @@ void GrAtlasTextContext::FallbackTextHelper::drawText(GrAtlasTextBlob* blob, int
glyphPos->fX = SkScalarFloorToScalar(glyphPos->fX);
glyphPos->fY = SkScalarFloorToScalar(glyphPos->fY);
}
- GrAtlasTextContext::BmpAppendGlyph(blob, runIndex, glyphCache, &currStrike, glyph,
+ GrTextContext::BmpAppendGlyph(blob, runIndex, glyphCache, &currStrike, glyph,
glyphPos->fX, glyphPos->fY, textColor,
cache.get(), textRatio, fUseTransformedFallback);
glyphPos++;
@@ -920,13 +920,12 @@ void GrAtlasTextContext::FallbackTextHelper::drawText(GrAtlasTextBlob* blob, int
#include "GrRenderTargetContext.h"
-std::unique_ptr<GrDrawOp> GrAtlasTextContext::createOp_TestingOnly(
- GrContext* context,
- GrAtlasTextContext* textContext,
- GrRenderTargetContext* rtc,
- const SkPaint& skPaint,
- const SkMatrix& viewMatrix,
- const char* text, int x, int y) {
+std::unique_ptr<GrDrawOp> GrTextContext::createOp_TestingOnly(GrContext* context,
+ GrTextContext* textContext,
+ GrRenderTargetContext* rtc,
+ const SkPaint& skPaint,
+ const SkMatrix& viewMatrix,
+ const char* text, int x, int y) {
auto glyphCache = context->contextPriv().getGlyphCache();
static SkSurfaceProps surfaceProps(SkSurfaceProps::kLegacyFontHost_InitType);
@@ -940,7 +939,7 @@ std::unique_ptr<GrDrawOp> GrAtlasTextContext::createOp_TestingOnly(
sk_sp<GrAtlasTextBlob> blob(textContext->makeDrawTextBlob(
context->contextPriv().getTextBlobCache(), glyphCache,
*context->contextPriv().caps()->shaderCaps(), utilsPaint,
- GrAtlasTextContext::kTextBlobOpScalerContextFlags, viewMatrix, surfaceProps, text,
+ GrTextContext::kTextBlobOpScalerContextFlags, viewMatrix, surfaceProps, text,
static_cast<size_t>(textLen), SkIntToScalar(x), SkIntToScalar(y)));
return blob->test_makeOp(textLen, 0, 0, viewMatrix, x, y, utilsPaint, surfaceProps,
@@ -949,12 +948,12 @@ std::unique_ptr<GrDrawOp> GrAtlasTextContext::createOp_TestingOnly(
GR_DRAW_OP_TEST_DEFINE(GrAtlasTextOp) {
static uint32_t gContextID = SK_InvalidGenID;
- static std::unique_ptr<GrAtlasTextContext> gTextContext;
+ static std::unique_ptr<GrTextContext> gTextContext;
static SkSurfaceProps gSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType);
if (context->uniqueID() != gContextID) {
gContextID = context->uniqueID();
- gTextContext = GrAtlasTextContext::Make(GrAtlasTextContext::Options());
+ gTextContext = GrTextContext::Make(GrTextContext::Options());
}
// Setup dummy SkPaint / GrPaint / GrRenderTargetContext
diff --git a/src/gpu/text/GrAtlasTextContext.h b/src/gpu/text/GrTextContext.h
index aa6557caf3..b5bb22f3d5 100644
--- a/src/gpu/text/GrAtlasTextContext.h
+++ b/src/gpu/text/GrTextContext.h
@@ -25,7 +25,7 @@ class SkGlyph;
/*
* Renders text using some kind of an atlas, ie BitmapText or DistanceField text
*/
-class GrAtlasTextContext {
+class GrTextContext {
public:
struct Options {
/**
@@ -42,7 +42,7 @@ public:
bool fDistanceFieldVerticesAlwaysHaveW = false;
};
- static std::unique_ptr<GrAtlasTextContext> Make(const Options& options);
+ static std::unique_ptr<GrTextContext> Make(const Options& options);
void drawText(GrContext*, GrTextUtils::Target*, const GrClip&, const SkPaint&,
const SkMatrix& viewMatrix, const SkSurfaceProps&, const char text[],
@@ -55,7 +55,7 @@ public:
const SkMatrix& viewMatrix, const SkSurfaceProps&, const SkTextBlob*,
SkScalar x, SkScalar y, SkDrawFilter*, const SkIRect& clipBounds);
- std::unique_ptr<GrDrawOp> createOp_TestingOnly(GrContext*, GrAtlasTextContext*,
+ std::unique_ptr<GrDrawOp> createOp_TestingOnly(GrContext*, GrTextContext*,
GrRenderTargetContext*, const SkPaint&,
const SkMatrix& viewMatrix, const char* text,
int x, int y);
@@ -73,7 +73,7 @@ public:
SkScalerContextFlags* flags);
private:
- GrAtlasTextContext(const Options& options);
+ GrTextContext(const Options& options);
class FallbackTextHelper {
public: