Rename GrTextUtils::Target to GrTextTarget
Change-Id: I29e1c6e117a4cbbde6e43639228b1103966b6358
Reviewed-on: https://skia-review.googlesource.com/146641
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
diff --git a/gn/gpu.gni b/gn/gpu.gni
index f4f078b..e6533ec 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -422,7 +422,7 @@
"$_src/gpu/text/GrTextContext.cpp",
"$_src/gpu/text/GrTextContext.h",
"$_src/gpu/text/GrTextBlobVertexRegenerator.cpp",
- "$_src/gpu/text/GrTextUtils.h",
+ "$_src/gpu/text/GrTextTarget.h",
"$_src/gpu/gl/GrGLAssembleInterface.cpp",
"$_src/gpu/gl/GrGLBuffer.cpp",
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index f700a98..d043840 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -1532,7 +1532,6 @@
friend class GrTextContext;
friend class GrGLPathRendering;
friend class GrPathRendering;
- friend class GrTextUtils;
friend class SkAutoGlyphCacheNoGamma;
friend class SkCanonicalizePaint;
friend class SkCanvas;
diff --git a/src/atlastext/SkAtlasTextTarget.cpp b/src/atlastext/SkAtlasTextTarget.cpp
index 3d9cf95..883b3f1 100644
--- a/src/atlastext/SkAtlasTextTarget.cpp
+++ b/src/atlastext/SkAtlasTextTarget.cpp
@@ -79,12 +79,12 @@
//////////////////////////////////////////////////////////////////////////////
-class SkInternalAtlasTextTarget : public GrTextUtils::Target, public SkAtlasTextTarget {
+class SkInternalAtlasTextTarget : public GrTextTarget, public SkAtlasTextTarget {
public:
SkInternalAtlasTextTarget(sk_sp<SkAtlasTextContext> context,
int width, int height,
void* handle)
- : GrTextUtils::Target(width, height, kColorSpaceInfo)
+ : GrTextTarget(width, height, kColorSpaceInfo)
, SkAtlasTextTarget(std::move(context), width, height, handle)
, fGlyphDrawer(kProps, kColorSpaceInfo) {
fOpMemoryPool = fContext->internal().grContext()->contextPriv().refOpMemoryPool();
@@ -94,7 +94,7 @@
this->deleteOps();
}
- /** GrTextUtils::Target overrides */
+ /** GrTextTarget overrides */
void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> op) override;
diff --git a/src/core/SkGlyphRun.cpp b/src/core/SkGlyphRun.cpp
index 872977d..da5901e 100644
--- a/src/core/SkGlyphRun.cpp
+++ b/src/core/SkGlyphRun.cpp
@@ -19,6 +19,7 @@
#include "text/GrTextContext.h"
#endif
+#include "SkColorFilter.h"
#include "SkDevice.h"
#include "SkDistanceFieldGen.h"
#include "SkDraw.h"
@@ -862,7 +863,7 @@
}
void GrTextContext::drawGlyphRunList(
- GrContext* context, GrTextUtils::Target* target, const GrClip& clip,
+ GrContext* context, GrTextTarget* target, const GrClip& clip,
const SkMatrix& viewMatrix, const SkSurfaceProps& props, const SkGlyphRunList& glyphRunList,
const SkIRect& clipBounds) {
SkPoint origin = glyphRunList.origin();
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 8c743b8..f0d8eba 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -52,14 +52,14 @@
#include "ops/GrStencilPathOp.h"
#include "ops/GrTextureOp.h"
#include "text/GrTextContext.h"
-#include "text/GrTextUtils.h"
+#include "text/GrTextTarget.h"
-class GrRenderTargetContext::TextTarget : public GrTextUtils::Target {
+class GrRenderTargetContext::TextTarget : public GrTextTarget {
public:
TextTarget(GrRenderTargetContext* renderTargetContext)
- : Target(renderTargetContext->width(), renderTargetContext->height(),
+ : GrTextTarget(renderTargetContext->width(), renderTargetContext->height(),
renderTargetContext->colorSpaceInfo())
, fRenderTargetContext(renderTargetContext)
, fGlyphDrawer{*renderTargetContext}{}
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index 06473bb..d0cbe46 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -19,7 +19,7 @@
#include "SkCanvas.h"
#include "SkRefCnt.h"
#include "SkSurfaceProps.h"
-#include "text/GrTextUtils.h"
+#include "text/GrTextTarget.h"
class GrBackendSemaphore;
class GrCCPRAtlas;
@@ -365,7 +365,7 @@
GrRenderTargetContextPriv priv();
const GrRenderTargetContextPriv priv() const;
- GrTextUtils::Target* textTarget() { return fTextTarget.get(); }
+ GrTextTarget* textTarget() { return fTextTarget.get(); }
bool isWrapped_ForTesting() const;
@@ -444,7 +444,7 @@
GrRenderTargetOpList* getRTOpList();
GrOpList* getOpList() override;
- std::unique_ptr<GrTextUtils::Target> fTextTarget;
+ std::unique_ptr<GrTextTarget> fTextTarget;
sk_sp<GrRenderTargetProxy> fRenderTargetProxy;
// In MDB-mode the GrOpList can be closed by some other renderTargetContext that has picked
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 2b2f01d..97d9a65 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -52,7 +52,7 @@
#include "effects/GrBicubicEffect.h"
#include "effects/GrSimpleTextureEffect.h"
#include "effects/GrTextureDomain.h"
-#include "text/GrTextUtils.h"
+#include "text/GrTextTarget.h"
#define ASSERT_SINGLE_OWNER \
SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fContext->contextPriv().debugSingleOwner());)
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 6c0b061..bcec3f2 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -9,7 +9,7 @@
#include "GrBlurUtils.h"
#include "GrClip.h"
#include "GrContext.h"
-#include "GrTextUtils.h"
+#include "GrTextTarget.h"
#include "SkColorFilter.h"
#include "SkGlyphCache.h"
#include "SkMaskFilterBase.h"
@@ -223,7 +223,7 @@
const Run::SubRunInfo& info, int glyphCount, uint16_t run, uint16_t subRun,
const SkMatrix& viewMatrix, SkScalar x, SkScalar y, const SkIRect& clipRect,
const SkPaint& paint, GrColor filteredColor, const SkSurfaceProps& props,
- const GrDistanceFieldAdjustTable* distanceAdjustTable, GrTextUtils::Target* target) {
+ const GrDistanceFieldAdjustTable* distanceAdjustTable, GrTextTarget* target) {
GrMaskFormat format = info.maskFormat();
GrPaint grPaint;
@@ -273,11 +273,11 @@
}
}
-void GrTextBlob::flush(GrTextUtils::Target* target, const SkSurfaceProps& props,
- const GrDistanceFieldAdjustTable* distanceAdjustTable,
- const SkPaint& paint, GrColor filteredColor, const GrClip& clip,
- const SkMatrix& viewMatrix, const SkIRect& clipBounds,
- SkScalar x, SkScalar y) {
+void GrTextBlob::flush(GrTextTarget* target, const SkSurfaceProps& props,
+ const GrDistanceFieldAdjustTable* distanceAdjustTable,
+ const SkPaint& paint, GrColor filteredColor, const GrClip& clip,
+ const SkMatrix& viewMatrix, const SkIRect& clipBounds,
+ SkScalar x, SkScalar y) {
// GrTextBlob::makeOp only takes uint16_t values for run and subRun indices.
// Encountering something larger than this is highly unlikely, so we'll just not draw it.
@@ -365,7 +365,7 @@
int glyphCount, uint16_t run, uint16_t subRun, const SkMatrix& viewMatrix,
SkScalar x, SkScalar y, const SkPaint& paint, GrColor filteredColor,
const SkSurfaceProps& props, const GrDistanceFieldAdjustTable* distanceAdjustTable,
- GrTextUtils::Target* target) {
+ GrTextTarget* target) {
const GrTextBlob::Run::SubRunInfo& info = fRuns[run].fSubRunInfo[subRun];
SkIRect emptyRect = SkIRect::MakeEmpty();
return this->makeOp(info, glyphCount, run, subRun, viewMatrix, x, y, emptyRect,
diff --git a/src/gpu/text/GrTextBlob.h b/src/gpu/text/GrTextBlob.h
index e57c1bc..71ddf74 100644
--- a/src/gpu/text/GrTextBlob.h
+++ b/src/gpu/text/GrTextBlob.h
@@ -11,13 +11,14 @@
#include "GrColor.h"
#include "GrDrawOpAtlas.h"
#include "GrGlyphCache.h"
-#include "GrTextUtils.h"
+#include "GrTextTarget.h"
#include "SkDescriptor.h"
#include "SkMaskFilterBase.h"
#include "SkOpts.h"
#include "SkPathEffect.h"
#include "SkPoint3.h"
#include "SkRectPriv.h"
+#include "SkStrikeCache.h"
#include "SkSurfaceProps.h"
#include "SkTInternalLList.h"
@@ -198,7 +199,7 @@
bool mustRegenerate(const SkPaint&, const SkMaskFilterBase::BlurRec& blurRec,
const SkMatrix& viewMatrix, SkScalar x, SkScalar y);
- void flush(GrTextUtils::Target*, const SkSurfaceProps& props,
+ void flush(GrTextTarget*, const SkSurfaceProps& props,
const GrDistanceFieldAdjustTable* distanceAdjustTable,
const SkPaint& paint, GrColor filteredColor, const GrClip& clip,
const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x,
@@ -278,7 +279,7 @@
const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
const SkPaint& paint, GrColor filteredColor,
const SkSurfaceProps&, const GrDistanceFieldAdjustTable*,
- GrTextUtils::Target*);
+ GrTextTarget*);
private:
GrTextBlob()
@@ -514,7 +515,7 @@
const Run::SubRunInfo& info, int glyphCount, uint16_t run, uint16_t subRun,
const SkMatrix& viewMatrix, SkScalar x, SkScalar y, const SkIRect& clipRect,
const SkPaint& paint, GrColor filteredColor, const SkSurfaceProps&,
- const GrDistanceFieldAdjustTable*, GrTextUtils::Target*);
+ const GrDistanceFieldAdjustTable*, GrTextTarget*);
struct StrokeInfo {
SkScalar fFrameWidth;
diff --git a/src/gpu/text/GrTextBlobVertexRegenerator.cpp b/src/gpu/text/GrTextBlobVertexRegenerator.cpp
index 3a1f0ae..46b2218 100644
--- a/src/gpu/text/GrTextBlobVertexRegenerator.cpp
+++ b/src/gpu/text/GrTextBlobVertexRegenerator.cpp
@@ -7,7 +7,7 @@
#include "GrAtlasManager.h"
#include "GrTextBlob.h"
-#include "GrTextUtils.h"
+#include "GrTextTarget.h"
#include "SkDistanceFieldGen.h"
#include "SkGlyphCache.h"
#include "ops/GrAtlasTextOp.h"
diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp
index 9ceebf4..91387fb 100644
--- a/src/gpu/text/GrTextContext.cpp
+++ b/src/gpu/text/GrTextContext.cpp
@@ -298,8 +298,6 @@
SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
- // Because we the GrTextUtils::Paint requires an SkPaint for font info, we ignore the GrPaint
- // param.
SkPaint skPaint;
skPaint.setColor(random->nextU());
skPaint.setLCDRenderText(random->nextBool());
diff --git a/src/gpu/text/GrTextContext.h b/src/gpu/text/GrTextContext.h
index e6430d6..1c72608 100644
--- a/src/gpu/text/GrTextContext.h
+++ b/src/gpu/text/GrTextContext.h
@@ -11,7 +11,7 @@
#include "GrDistanceFieldAdjustTable.h"
#include "GrGeometryProcessor.h"
#include "GrTextBlob.h"
-#include "GrTextUtils.h"
+#include "GrTextTarget.h"
#include "SkGlyphRun.h"
#if GR_TEST_UTILS
@@ -44,7 +44,7 @@
static std::unique_ptr<GrTextContext> Make(const Options& options);
- void drawGlyphRunList(GrContext*, GrTextUtils::Target*, const GrClip&,
+ void drawGlyphRunList(GrContext*, GrTextTarget*, const GrClip&,
const SkMatrix& viewMatrix, const SkSurfaceProps&, const SkGlyphRunList&,
const SkIRect& clipBounds);
diff --git a/src/gpu/text/GrTextTarget.h b/src/gpu/text/GrTextTarget.h
new file mode 100644
index 0000000..f5a7efa
--- /dev/null
+++ b/src/gpu/text/GrTextTarget.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrTextTarget_DEFINED
+#define GrTextTarget_DEFINED
+
+#include "GrColorSpaceInfo.h"
+#include "SkPaint.h"
+
+class GrAtlasTextOp;
+class GrClip;
+class GrPaint;
+class SkGlyphRunListDrawer;
+class SkMatrix;
+struct SkIRect;
+
+class GrTextTarget {
+public:
+ virtual ~GrTextTarget() = default;
+
+ int width() const { return fWidth; }
+
+ int height() const { return fHeight; }
+
+ const GrColorSpaceInfo& colorSpaceInfo() const { return fColorSpaceInfo; }
+
+ virtual void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> op) = 0;
+
+ virtual void drawPath(const GrClip&, const SkPath&, const SkPaint&,
+ const SkMatrix& viewMatrix, const SkMatrix* pathMatrix,
+ const SkIRect& clipBounds) = 0;
+
+ virtual void makeGrPaint(GrMaskFormat, const SkPaint&, const SkMatrix& viewMatrix,
+ GrPaint*) = 0;
+
+ virtual GrContext* getContext() = 0;
+
+ virtual SkGlyphRunListDrawer* glyphDrawer() = 0;
+
+protected:
+ GrTextTarget(int width, int height, const GrColorSpaceInfo& colorSpaceInfo)
+ : fWidth(width), fHeight(height), fColorSpaceInfo(colorSpaceInfo) {}
+
+private:
+ int fWidth;
+ int fHeight;
+ const GrColorSpaceInfo& fColorSpaceInfo;
+};
+#endif // GrTextTarget_DEFINED
diff --git a/src/gpu/text/GrTextUtils.h b/src/gpu/text/GrTextUtils.h
deleted file mode 100644
index 0f662c1..0000000
--- a/src/gpu/text/GrTextUtils.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrTextUtils_DEFINED
-#define GrTextUtils_DEFINED
-
-#include "GrColor.h"
-#include "GrColorSpaceInfo.h"
-#include "SkColorFilter.h"
-#include "SkPaint.h"
-#include "SkScalar.h"
-#include "SkTextToPathIter.h"
-#include "SkTLazy.h"
-
-class GrTextBlob;
-class GrAtlasTextOp;
-class GrTextStrike;
-class GrClip;
-class GrColorSpaceXform;
-class GrContext;
-class GrGlyphCache;
-class GrPaint;
-class GrShaderCaps;
-class SkColorSpace;
-class SkGlyph;
-class SkGlyphRunListDrawer;
-class SkMatrix;
-struct SkIRect;
-struct SkPoint;
-class SkGlyphCache;
-class SkTextBlobRunIterator;
-class SkSurfaceProps;
-
-/**
- * A class to house a bunch of common text utilities. This class should *ONLY* have static
- * functions. It is not a namespace only because we wish to friend SkPaint
- */
-class GrTextUtils {
-public:
- class Target {
- public:
- virtual ~Target() = default;
-
- int width() const { return fWidth; }
-
- int height() const { return fHeight; }
-
- const GrColorSpaceInfo& colorSpaceInfo() const { return fColorSpaceInfo; }
-
- virtual void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> op) = 0;
-
- virtual void drawPath(const GrClip&, const SkPath&, const SkPaint&,
- const SkMatrix& viewMatrix, const SkMatrix* pathMatrix,
- const SkIRect& clipBounds) = 0;
-
- virtual void makeGrPaint(GrMaskFormat, const SkPaint&, const SkMatrix& viewMatrix,
- GrPaint*) = 0;
-
- virtual GrContext* getContext() = 0;
-
- virtual SkGlyphRunListDrawer* glyphDrawer() = 0;
-
- protected:
- Target(int width, int height, const GrColorSpaceInfo& colorSpaceInfo)
- : fWidth(width), fHeight(height), fColorSpaceInfo(colorSpaceInfo) {}
-
- private:
- int fWidth;
- int fHeight;
- const GrColorSpaceInfo& fColorSpaceInfo;
- };
-};
-#endif
diff --git a/tests/DrawOpAtlasTest.cpp b/tests/DrawOpAtlasTest.cpp
index c12149f..59b61f8 100644
--- a/tests/DrawOpAtlasTest.cpp
+++ b/tests/DrawOpAtlasTest.cpp
@@ -34,7 +34,7 @@
#include "ops/GrDrawOp.h"
#include "text/GrAtlasManager.h"
#include "text/GrTextContext.h"
-#include "text/GrTextUtils.h"
+#include "text/GrTextTarget.h"
#include <memory>