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>
This commit is contained in:
Herb Derby 2018-08-09 15:02:27 -04:00 committed by Skia Commit-Bot
parent 6ed63968a3
commit c1b482cddb
15 changed files with 83 additions and 108 deletions

View File

@ -422,7 +422,7 @@ skia_gpu_sources = [
"$_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",

View File

@ -1532,7 +1532,6 @@ private:
friend class GrTextContext;
friend class GrGLPathRendering;
friend class GrPathRendering;
friend class GrTextUtils;
friend class SkAutoGlyphCacheNoGamma;
friend class SkCanonicalizePaint;
friend class SkCanvas;

View File

@ -79,12 +79,12 @@ static const SkSurfaceProps kProps(
//////////////////////////////////////////////////////////////////////////////
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 @@ public:
this->deleteOps();
}
/** GrTextUtils::Target overrides */
/** GrTextTarget overrides */
void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> op) override;

View File

@ -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 @@ GrColor generate_filtered_color(const SkPaint& paint, const GrColorSpaceInfo& co
}
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();

View File

@ -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}{}

View File

@ -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 @@ public:
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 @@ private:
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

View File

@ -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());)

View File

@ -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 @@ inline std::unique_ptr<GrAtlasTextOp> GrTextBlob::makeOp(
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 @@ static void calculate_translation(bool applyVM,
}
}
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 @@ std::unique_ptr<GrDrawOp> GrTextBlob::test_makeOp(
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,

View File

@ -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 @@ public:
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 @@ public:
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 @@ private:
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;

View File

@ -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"

View File

@ -298,8 +298,6 @@ GR_DRAW_OP_TEST_DEFINE(GrAtlasTextOp) {
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());

View File

@ -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 @@ public:
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);

View File

@ -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

View File

@ -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

View File

@ -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>