Rename SkGlyphRunListDrawer to SkGlyphRunListPainter

Change-Id: I43aa72e67b87f03e234cf5d451ef7259611222da
Reviewed-on: https://skia-review.googlesource.com/148398
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
Herb Derby 2018-08-21 16:55:04 -04:00 committed by Skia Commit-Bot
parent ee8295c050
commit 65956874e0
11 changed files with 50 additions and 50 deletions

View File

@ -32,7 +32,7 @@ class SkData;
class SkDescriptor;
class SkDrawLooper;
class SkGlyph;
class SkGlyphRunListDrawer;
class SkGlyphRunListPainter;
struct SkRect;
class SkGlyphCache;
class SkImageFilter;
@ -1536,7 +1536,7 @@ private:
friend class SkCanonicalizePaint;
friend class SkCanvas;
friend class SkDraw;
friend class SkGlyphRunListDrawer;
friend class SkGlyphRunListPainter;
friend class SkPaintPriv;
friend class SkPDFDevice;
friend class SkScalerContext; // for computeLuminanceColor()

View File

@ -86,7 +86,7 @@ public:
void* handle)
: GrTextTarget(width, height, kColorSpaceInfo)
, SkAtlasTextTarget(std::move(context), width, height, handle)
, fGlyphDrawer(kProps, kColorSpaceInfo) {
, fGlyphPainter(kProps, kColorSpaceInfo) {
fOpMemoryPool = fContext->internal().grContext()->contextPriv().refOpMemoryPool();
}
@ -112,8 +112,8 @@ public:
return this->context()->internal().grContext();
}
SkGlyphRunListDrawer* glyphDrawer() override {
return &fGlyphDrawer;
SkGlyphRunListPainter* glyphPainter() override {
return &fGlyphPainter;
}
/** SkAtlasTextTarget overrides */
@ -130,7 +130,7 @@ private:
using SkAtlasTextTarget::fHeight;
SkTArray<std::unique_ptr<GrAtlasTextOp>, true> fOps;
sk_sp<GrOpMemoryPool> fOpMemoryPool;
SkGlyphRunListDrawer fGlyphDrawer;
SkGlyphRunListPainter fGlyphPainter;
};
//////////////////////////////////////////////////////////////////////////////

View File

@ -245,7 +245,7 @@ SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap)
: INHERITED(bitmap.info(), SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType))
, fBitmap(bitmap)
, fRCStack(bitmap.width(), bitmap.height())
, fGlyphDraw(this->surfaceProps(), bitmap.colorType(), scaler_context_flags(bitmap))
, fGlyphPainter(this->surfaceProps(), bitmap.colorType(), scaler_context_flags(bitmap))
{
SkASSERT(valid_for_bitmap_device(bitmap.info(), nullptr));
}
@ -260,7 +260,7 @@ SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkSurfaceProps& sur
, fBitmap(bitmap)
, fRasterHandle(hndl)
, fRCStack(bitmap.width(), bitmap.height())
, fGlyphDraw(this->surfaceProps(), bitmap.colorType(), scaler_context_flags(bitmap))
, fGlyphPainter(this->surfaceProps(), bitmap.colorType(), scaler_context_flags(bitmap))
{
SkASSERT(valid_for_bitmap_device(bitmap.info(), nullptr));
@ -589,7 +589,7 @@ void SkBitmapDevice::drawGlyphRunList(const SkGlyphRunList& glyphRunList) {
this->drawTextBlob(blob, origin.x(), origin.y(), paint);
}
#else
LOOP_TILER( drawGlyphRunList(glyphRunList, &fGlyphDraw), nullptr )
LOOP_TILER( drawGlyphRunList(glyphRunList, &fGlyphPainter), nullptr )
#endif
}

View File

@ -169,7 +169,7 @@ private:
void* fRasterHandle = nullptr;
SkRasterClipStack fRCStack;
std::unique_ptr<SkBitmap> fCoverage; // if non-null, will have the same dimensions as fBitmap
SkGlyphRunListDrawer fGlyphDraw;
SkGlyphRunListPainter fGlyphPainter;
typedef SkBaseDevice INHERITED;

View File

@ -1568,7 +1568,7 @@ void SkDraw::blitARGB32Mask(const SkMask& mask, const SkPaint& paint) const {
this->drawSprite(bm, mask.fBounds.x(), mask.fBounds.y(), paint);
}
SkGlyphRunListDrawer::PerMask SkDraw::drawOneMaskCreator(
SkGlyphRunListPainter::PerMask SkDraw::drawOneMaskCreator(
const SkPaint& paint, SkArenaAlloc* alloc) const {
SkBlitter* blitter = SkBlitter::Choose(fDst, *fMatrix, paint, alloc, false);
if (fCoverage != nullptr) {
@ -1623,7 +1623,7 @@ SkGlyphRunListDrawer::PerMask SkDraw::drawOneMaskCreator(
}
void SkDraw::drawGlyphRunList(
const SkGlyphRunList& glyphRunList, SkGlyphRunListDrawer* glyphDraw) const {
const SkGlyphRunList& glyphRunList, SkGlyphRunListPainter* glyphPainter) const {
SkDEBUGCODE(this->validate();)
@ -1651,7 +1651,7 @@ void SkDraw::drawGlyphRunList(
return this->drawOneMaskCreator(paint, alloc);
};
glyphDraw->drawForBitmapDevice(glyphRunList, *fMatrix, perMaskBuilder, perPathBuilder);
glyphPainter->drawForBitmapDevice(glyphRunList, *fMatrix, perMaskBuilder, perPathBuilder);
}
#if defined _WIN32

View File

@ -68,7 +68,7 @@ public:
const SkScalar pos[], int scalarsPerPosition,
const SkPoint& offset, const SkPaint&, const SkSurfaceProps*) const;
void drawGlyphRunList(const SkGlyphRunList& glyphRunList,
SkGlyphRunListDrawer* glyphDraw) const;
SkGlyphRunListPainter* glyphPainter) const;
void drawVertices(SkVertices::VertexMode mode, int vertexCount,
const SkPoint vertices[], const SkPoint textures[],
const SkColor colors[], const SkVertices::BoneIndices boneIndices[],
@ -130,7 +130,7 @@ public:
static SkScalar ComputeResScaleForStroking(const SkMatrix& );
private:
void blitARGB32Mask(const SkMask& mask, const SkPaint& paint) const;
SkGlyphRunListDrawer::PerMask drawOneMaskCreator(
SkGlyphRunListPainter::PerMask drawOneMaskCreator(
const SkPaint& paint, SkArenaAlloc* alloc) const;
void drawBitmapAsMask(const SkBitmap&, const SkPaint&) const;

View File

@ -110,8 +110,8 @@ void SkGlyphRun::filloutGlyphsAndPositions(SkGlyphID* glyphIDs, SkPoint* positio
memcpy(positions, fPositions.data(), fPositions.size_bytes());
}
// -- SkGlyphRunListDrawer -------------------------------------------------------------------------
SkGlyphRunListDrawer::SkGlyphRunListDrawer(
// -- SkGlyphRunListPainter ------------------------------------------------------------------------
SkGlyphRunListPainter::SkGlyphRunListPainter(
const SkSurfaceProps& props, SkColorType colorType, SkScalerContextFlags flags)
: fDeviceProps{props}
, fBitmapFallbackProps{SkSurfaceProps{props.flags(), kUnknown_SkPixelGeometry}}
@ -133,12 +133,12 @@ static SkScalerContextFlags compute_scaler_context_flags(
}
}
SkGlyphRunListDrawer::SkGlyphRunListDrawer(
SkGlyphRunListPainter::SkGlyphRunListPainter(
const SkSurfaceProps& props, const GrColorSpaceInfo& csi)
: SkGlyphRunListDrawer(props, kUnknown_SkColorType, compute_scaler_context_flags(csi)) {}
: SkGlyphRunListPainter(props, kUnknown_SkColorType, compute_scaler_context_flags(csi)) {}
SkGlyphRunListDrawer::SkGlyphRunListDrawer(const GrRenderTargetContext& rtc)
: SkGlyphRunListDrawer{rtc.surfaceProps(), rtc.colorSpaceInfo()} {}
SkGlyphRunListPainter::SkGlyphRunListPainter(const GrRenderTargetContext& rtc)
: SkGlyphRunListPainter{rtc.surfaceProps(), rtc.colorSpaceInfo()} {}
// TODO: all this logic should move to the glyph cache.
static const SkGlyph& lookup_glyph_by_subpixel(
@ -160,7 +160,7 @@ static const SkGlyph& lookup_glyph_by_subpixel(
// forEachMappedDrawableGlyph handles positioning for mask type glyph handling for both sub-pixel
// and full pixel positioning.
template <typename EachGlyph>
void SkGlyphRunListDrawer::forEachMappedDrawableGlyph(
void SkGlyphRunListPainter::forEachMappedDrawableGlyph(
const SkGlyphRun& glyphRun, SkPoint origin, const SkMatrix& deviceMatrix,
SkGlyphCache* cache, EachGlyph eachGlyph) {
bool isSubpixel = cache->isSubpixel();
@ -211,7 +211,7 @@ void SkGlyphRunListDrawer::forEachMappedDrawableGlyph(
#endif
bool SkGlyphRunListDrawer::ShouldDrawAsPath(const SkPaint& paint, const SkMatrix& matrix) {
bool SkGlyphRunListPainter::ShouldDrawAsPath(const SkPaint& paint, const SkMatrix& matrix) {
// hairline glyphs are fast enough so we don't need to cache them
if (SkPaint::kStroke_Style == paint.getStyle() && 0 == paint.getStrokeWidth()) {
return true;
@ -227,7 +227,7 @@ bool SkGlyphRunListDrawer::ShouldDrawAsPath(const SkPaint& paint, const SkMatrix
return SkPaint::TooBigToUseCache(matrix, textM, 1024);
}
bool SkGlyphRunListDrawer::ensureBitmapBuffers(size_t runSize) {
bool SkGlyphRunListPainter::ensureBitmapBuffers(size_t runSize) {
if (runSize > fMaxRunSize) {
fPositions.reset(runSize);
fMaxRunSize = runSize;
@ -236,7 +236,7 @@ bool SkGlyphRunListDrawer::ensureBitmapBuffers(size_t runSize) {
return true;
}
void SkGlyphRunListDrawer::drawUsingPaths(
void SkGlyphRunListPainter::drawUsingPaths(
const SkGlyphRun& glyphRun, SkPoint origin, SkGlyphCache* cache, PerPath perPath) const {
auto eachGlyph =
@ -292,7 +292,7 @@ static bool prepare_mask(
return true;
}
void SkGlyphRunListDrawer::drawGlyphRunAsSubpixelMask(
void SkGlyphRunListPainter::drawGlyphRunAsSubpixelMask(
SkGlyphCache* cache, const SkGlyphRun& glyphRun,
SkPoint origin, const SkMatrix& deviceMatrix,
PerMask perMask) {
@ -330,7 +330,7 @@ void SkGlyphRunListDrawer::drawGlyphRunAsSubpixelMask(
}
}
void SkGlyphRunListDrawer::drawGlyphRunAsFullpixelMask(
void SkGlyphRunListPainter::drawGlyphRunAsFullpixelMask(
SkGlyphCache* cache, const SkGlyphRun& glyphRun,
SkPoint origin, const SkMatrix& deviceMatrix,
PerMask perMask) {
@ -358,7 +358,7 @@ void SkGlyphRunListDrawer::drawGlyphRunAsFullpixelMask(
}
void SkGlyphRunListDrawer::drawForBitmapDevice(
void SkGlyphRunListPainter::drawForBitmapDevice(
const SkGlyphRunList& glyphRunList, const SkMatrix& deviceMatrix,
PerMaskCreator perMaskCreator, PerPathCreator perPathCreator) {
@ -395,7 +395,7 @@ void SkGlyphRunListDrawer::drawForBitmapDevice(
}
}
void SkGlyphRunListDrawer::drawUsingMasks(
void SkGlyphRunListPainter::drawUsingMasks(
SkGlyphCache* cache, const SkGlyphRun& glyphRun,
SkPoint origin, const SkMatrix& deviceMatrix, PerMask perMask) {
if (cache->isSubpixel()) {
@ -849,7 +849,7 @@ static SkRect rect_to_draw(
}
template <typename PerGlyphT, typename PerPathT>
void SkGlyphRunListDrawer::drawGlyphRunAsBMPWithPathFallback(
void SkGlyphRunListPainter::drawGlyphRunAsBMPWithPathFallback(
SkGlyphCache* cache, const SkGlyphRun& glyphRun,
SkPoint origin, const SkMatrix& deviceMatrix,
PerGlyphT perGlyph, PerPathT perPath) {
@ -881,7 +881,7 @@ void SkGlyphRunListDrawer::drawGlyphRunAsBMPWithPathFallback(
}
template <typename PerSDFT, typename PerPathT, typename PerFallbackT>
void SkGlyphRunListDrawer::drawGlyphRunAsSDFWithFallback(
void SkGlyphRunListPainter::drawGlyphRunAsSDFWithFallback(
SkGlyphCache* cache, const SkGlyphRun& glyphRun,
SkPoint origin, SkScalar textRatio,
PerSDFT perSDF, PerPathT perPath, PerFallbackT perFallback) {
@ -984,7 +984,7 @@ void GrTextContext::drawGlyphRunList(
this->regenerateGlyphRunList(cacheBlob.get(), glyphCache,
*context->contextPriv().caps()->shaderCaps(), listPaint,
filteredColor, scalerContextFlags, viewMatrix, props,
glyphRunList, target->glyphDrawer());
glyphRunList, target->glyphPainter());
} else {
textBlobCache->makeMRU(cacheBlob.get());
@ -996,7 +996,7 @@ void GrTextContext::drawGlyphRunList(
this->regenerateGlyphRunList(
sanityBlob.get(), glyphCache, *context->contextPriv().caps()->shaderCaps(),
listPaint, filteredColor, scalerContextFlags, viewMatrix, props, glyphRunList,
target->glyphDrawer());
target->glyphPainter());
GrTextBlob::AssertEqual(*sanityBlob, *cacheBlob);
}
}
@ -1009,7 +1009,7 @@ void GrTextContext::drawGlyphRunList(
this->regenerateGlyphRunList(cacheBlob.get(), glyphCache,
*context->contextPriv().caps()->shaderCaps(), listPaint,
filteredColor, scalerContextFlags, viewMatrix, props,
glyphRunList, target->glyphDrawer());
glyphRunList, target->glyphPainter());
}
cacheBlob->flush(target, props, fDistanceAdjustTable.get(), listPaint, filteredColor,
@ -1055,7 +1055,7 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
const SkMatrix& viewMatrix,
const SkSurfaceProps& props,
const SkGlyphRunList& glyphRunList,
SkGlyphRunListDrawer* glyphDrawer) {
SkGlyphRunListPainter* glyphPainter) {
SkPoint origin = glyphRunList.origin();
cacheBlob->initReusableBlob(
glyphRunList.paint().computeLuminanceColor(), viewMatrix, origin.x(), origin.y());
@ -1119,7 +1119,7 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
fallbackTextHelper.appendGlyph(glyph, glyph.getGlyphID(), position);
};
glyphDrawer->drawGlyphRunAsSDFWithFallback(
glyphPainter->drawGlyphRunAsSDFWithFallback(
cache.get(), glyphRun, origin, textRatio, perSDF, perPath, perFallback);
}
@ -1158,7 +1158,7 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
}
};
glyphDrawer->drawUsingPaths(glyphRun, origin, cache.get(), drawOnePath);
glyphPainter->drawUsingPaths(glyphRun, origin, cache.get(), drawOnePath);
fallbackTextHelper.drawGlyphs(
cacheBlob, runIndex, glyphCache, props,
@ -1191,7 +1191,7 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
runIndex, *path, sx, sy, SK_Scalar1, true);
};
glyphDrawer->drawGlyphRunAsBMPWithPathFallback(
glyphPainter->drawGlyphRunAsBMPWithPathFallback(
cache.get(), glyphRun, origin, viewMatrix, perGlyph, perPath);
}
runIndex += 1;
@ -1233,7 +1233,7 @@ std::unique_ptr<GrDrawOp> GrTextContext::createOp_TestingOnly(GrContext* context
textContext->regenerateGlyphRunList(
blob.get(), glyphCache, *context->contextPriv().caps()->shaderCaps(), skPaint,
filteredColor, scalerContextFlags, viewMatrix, surfaceProps,
glyphRunList, rtc->textTarget()->glyphDrawer());
glyphRunList, rtc->textTarget()->glyphPainter());
}
return blob->test_makeOp(textLen, 0, 0, viewMatrix, x, y, skPaint, filteredColor, surfaceProps,

View File

@ -106,15 +106,15 @@ private:
SkPaint fRunPaint;
};
class SkGlyphRunListDrawer {
class SkGlyphRunListPainter {
public:
// Constructor for SkBitmpapDevice.
SkGlyphRunListDrawer(
SkGlyphRunListPainter(
const SkSurfaceProps& props, SkColorType colorType, SkScalerContextFlags flags);
#if SK_SUPPORT_GPU
SkGlyphRunListDrawer(const SkSurfaceProps&, const GrColorSpaceInfo&);
explicit SkGlyphRunListDrawer(const GrRenderTargetContext& renderTargetContext);
SkGlyphRunListPainter(const SkSurfaceProps&, const GrColorSpaceInfo&);
explicit SkGlyphRunListPainter(const GrRenderTargetContext& renderTargetContext);
#endif
using PerMask = std::function<void(const SkMask&, const SkGlyph&, SkPoint)>;

View File

@ -62,7 +62,7 @@ public:
: GrTextTarget(renderTargetContext->width(), renderTargetContext->height(),
renderTargetContext->colorSpaceInfo())
, fRenderTargetContext(renderTargetContext)
, fGlyphDrawer{*renderTargetContext}{}
, fGlyphPainter{*renderTargetContext}{}
void addDrawOp(const GrClip& clip, std::unique_ptr<GrAtlasTextOp> op) override {
fRenderTargetContext->addDrawOp(clip, std::move(op));
@ -92,13 +92,13 @@ public:
return fRenderTargetContext->fContext;
}
SkGlyphRunListDrawer* glyphDrawer() override {
return &fGlyphDrawer;
SkGlyphRunListPainter* glyphPainter() override {
return &fGlyphPainter;
}
private:
GrRenderTargetContext* fRenderTargetContext;
SkGlyphRunListDrawer fGlyphDrawer;
SkGlyphRunListPainter fGlyphPainter;
};

View File

@ -122,7 +122,7 @@ private:
const SkMatrix& viewMatrix,
const SkSurfaceProps&,
const SkGlyphRunList& glyphRunList,
SkGlyphRunListDrawer* glyphDrawer);
SkGlyphRunListPainter* glyphPainter);
static void AppendGlyph(GrTextBlob*, int runIndex, GrGlyphCache*,
sk_sp<GrTextStrike>*, const SkGlyph&, GrGlyph::MaskStyle maskStyle,

View File

@ -14,7 +14,7 @@
class GrAtlasTextOp;
class GrClip;
class GrPaint;
class SkGlyphRunListDrawer;
class SkGlyphRunListPainter;
class SkMatrix;
struct SkIRect;
@ -38,7 +38,7 @@ public:
virtual GrContext* getContext() = 0;
virtual SkGlyphRunListDrawer* glyphDrawer() = 0;
virtual SkGlyphRunListPainter* glyphPainter() = 0;
protected:
GrTextTarget(int width, int height, const GrColorSpaceInfo& colorSpaceInfo)