From dbd3593e0b0cfb04f23b9d7bce623e6e32364b3f Mon Sep 17 00:00:00 2001 From: joshualitt Date: Thu, 2 Apr 2015 09:19:04 -0700 Subject: [PATCH] Rename GrBitmapTextContextB to GrAtlasTextContext BUG=skia: Review URL: https://codereview.chromium.org/1050173002 --- include/core/SkPaint.h | 2 +- include/core/SkTextBlob.h | 2 +- src/gpu/GrAtlasTextContext.cpp | 128 +++++++++++++++---------------- src/gpu/GrAtlasTextContext.h | 8 +- src/gpu/GrContext.cpp | 2 +- src/gpu/GrDistanceFieldTextContext.cpp | 2 +- src/gpu/GrStencilAndCoverTextContext.cpp | 2 +- src/gpu/SkGpuDevice.h | 2 +- 8 files changed, 74 insertions(+), 74 deletions(-) diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index 2038e6f..991a727 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -1123,7 +1123,7 @@ private: friend class SkGraphics; // So Term() can be called. friend class SkPDFDevice; friend class GrBitmapTextContext; - friend class GrBitmapTextContextB; + friend class GrAtlasTextContext; friend class GrDistanceFieldTextContext; friend class GrStencilAndCoverTextContext; friend class GrPathRendering; diff --git a/include/core/SkTextBlob.h b/include/core/SkTextBlob.h index 4ec9c5f..950ad8d 100644 --- a/include/core/SkTextBlob.h +++ b/include/core/SkTextBlob.h @@ -91,7 +91,7 @@ private: static unsigned ScalarsPerGlyph(GlyphPositioning pos); - friend class GrBitmapTextContextB; + friend class GrAtlasTextContext; friend class GrTextContext; friend class SkBaseDevice; friend class SkTextBlobBuilder; diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp index 5efb5b9..f1af012 100644 --- a/src/gpu/GrAtlasTextContext.cpp +++ b/src/gpu/GrAtlasTextContext.cpp @@ -64,45 +64,45 @@ static size_t get_vertex_stride(GrMaskFormat maskFormat) { // handle textblobs where the whole run is larger than the cache size // TODO implement micro speedy hash map for fast refing of glyphs -GrBitmapTextContextB::GrBitmapTextContextB(GrContext* context, - SkGpuDevice* gpuDevice, - const SkDeviceProperties& properties) +GrAtlasTextContext::GrAtlasTextContext(GrContext* context, + SkGpuDevice* gpuDevice, + const SkDeviceProperties& properties) : INHERITED(context, gpuDevice, properties) { fCurrStrike = NULL; } -void GrBitmapTextContextB::ClearCacheEntry(uint32_t key, BitmapTextBlob** blob) { +void GrAtlasTextContext::ClearCacheEntry(uint32_t key, BitmapTextBlob** blob) { (*blob)->unref(); } -GrBitmapTextContextB::~GrBitmapTextContextB() { - fCache.foreach(&GrBitmapTextContextB::ClearCacheEntry); +GrAtlasTextContext::~GrAtlasTextContext() { + fCache.foreach(&GrAtlasTextContext::ClearCacheEntry); } -GrBitmapTextContextB* GrBitmapTextContextB::Create(GrContext* context, - SkGpuDevice* gpuDevice, - const SkDeviceProperties& props) { - return SkNEW_ARGS(GrBitmapTextContextB, (context, gpuDevice, props)); +GrAtlasTextContext* GrAtlasTextContext::Create(GrContext* context, + SkGpuDevice* gpuDevice, + const SkDeviceProperties& props) { + return SkNEW_ARGS(GrAtlasTextContext, (context, gpuDevice, props)); } -bool GrBitmapTextContextB::canDraw(const GrRenderTarget*, - const GrClip&, - const GrPaint&, - const SkPaint& skPaint, - const SkMatrix& viewMatrix) { +bool GrAtlasTextContext::canDraw(const GrRenderTarget*, + const GrClip&, + const GrPaint&, + const SkPaint& skPaint, + const SkMatrix& viewMatrix) { return !SkDraw::ShouldDrawTextAsPaths(skPaint, viewMatrix); } -inline void GrBitmapTextContextB::init(GrRenderTarget* rt, const GrClip& clip, - const GrPaint& paint, const SkPaint& skPaint, - const SkIRect& regionClipBounds) { +inline void GrAtlasTextContext::init(GrRenderTarget* rt, const GrClip& clip, + const GrPaint& paint, const SkPaint& skPaint, + const SkIRect& regionClipBounds) { INHERITED::init(rt, clip, paint, skPaint, regionClipBounds); fCurrStrike = NULL; } -bool GrBitmapTextContextB::MustRegenerateBlob(const BitmapTextBlob& blob, const SkPaint& paint, - const SkMatrix& viewMatrix, SkScalar x, SkScalar y) { +bool GrAtlasTextContext::MustRegenerateBlob(const BitmapTextBlob& blob, const SkPaint& paint, + const SkMatrix& viewMatrix, SkScalar x, SkScalar y) { // We always regenerate blobs with patheffects or mask filters we could cache these // TODO find some way to cache the maskfilter / patheffects on the textblob return !blob.fViewMatrix.cheapEqualTo(viewMatrix) || blob.fX != x || blob.fY != y || @@ -110,24 +110,24 @@ bool GrBitmapTextContextB::MustRegenerateBlob(const BitmapTextBlob& blob, const } -inline SkGlyphCache* GrBitmapTextContextB::setupCache(BitmapTextBlob::Run* run, - const SkPaint& skPaint, - const SkMatrix& viewMatrix) { +inline SkGlyphCache* GrAtlasTextContext::setupCache(BitmapTextBlob::Run* run, + const SkPaint& skPaint, + const SkMatrix& viewMatrix) { skPaint.getScalerContextDescriptor(&run->fDescriptor, &fDeviceProperties, &viewMatrix, false); run->fTypeface.reset(SkSafeRef(skPaint.getTypeface())); return SkGlyphCache::DetachCache(run->fTypeface, run->fDescriptor.getDesc()); } -inline void GrBitmapTextContextB::BlobGlyphCount(int* glyphCount, int* runCount, - const SkTextBlob* blob) { +inline void GrAtlasTextContext::BlobGlyphCount(int* glyphCount, int* runCount, + const SkTextBlob* blob) { SkTextBlob::RunIterator itCounter(blob); for (; !itCounter.done(); itCounter.next(), (*runCount)++) { *glyphCount += itCounter.glyphCount(); } } -GrBitmapTextContextB::BitmapTextBlob* GrBitmapTextContextB::CreateBlob(int glyphCount, - int runCount) { +GrAtlasTextContext::BitmapTextBlob* GrAtlasTextContext::CreateBlob(int glyphCount, + int runCount) { // We allocate size for the BitmapTextBlob itself, plus size for the vertices array, // and size for the glyphIds array. SK_COMPILE_ASSERT(kGrayTextVASize >= kColorTextVASize && kGrayTextVASize >= kLCDTextVASize, @@ -154,10 +154,10 @@ GrBitmapTextContextB::BitmapTextBlob* GrBitmapTextContextB::CreateBlob(int glyph return cacheBlob; } -void GrBitmapTextContextB::drawTextBlob(GrRenderTarget* rt, const GrClip& clip, - const SkPaint& skPaint, const SkMatrix& viewMatrix, - const SkTextBlob* blob, SkScalar x, SkScalar y, - SkDrawFilter* drawFilter, const SkIRect& clipBounds) { +void GrAtlasTextContext::drawTextBlob(GrRenderTarget* rt, const GrClip& clip, + const SkPaint& skPaint, const SkMatrix& viewMatrix, + const SkTextBlob* blob, SkScalar x, SkScalar y, + SkDrawFilter* drawFilter, const SkIRect& clipBounds) { BitmapTextBlob* cacheBlob; BitmapTextBlob** foundBlob = fCache.find(blob->uniqueID()); SkIRect clipRect; @@ -196,10 +196,10 @@ void GrBitmapTextContextB::drawTextBlob(GrRenderTarget* rt, const GrClip& clip, fSkPaint.getAlpha()); } -void GrBitmapTextContextB::regenerateTextBlob(BitmapTextBlob* cacheBlob, - const SkPaint& skPaint, const SkMatrix& viewMatrix, - const SkTextBlob* blob, SkScalar x, SkScalar y, - SkDrawFilter* drawFilter, const SkIRect& clipRect) { +void GrAtlasTextContext::regenerateTextBlob(BitmapTextBlob* cacheBlob, + const SkPaint& skPaint, const SkMatrix& viewMatrix, + const SkTextBlob* blob, SkScalar x, SkScalar y, + SkDrawFilter* drawFilter, const SkIRect& clipRect) { cacheBlob->fViewMatrix = viewMatrix; cacheBlob->fX = x; cacheBlob->fY = y; @@ -265,11 +265,11 @@ void GrBitmapTextContextB::regenerateTextBlob(BitmapTextBlob* cacheBlob, } } -void GrBitmapTextContextB::onDrawText(GrRenderTarget* rt, const GrClip& clip, - const GrPaint& paint, const SkPaint& skPaint, - const SkMatrix& viewMatrix, - const char text[], size_t byteLength, - SkScalar x, SkScalar y, const SkIRect& regionClipBounds) { +void GrAtlasTextContext::onDrawText(GrRenderTarget* rt, const GrClip& clip, + const GrPaint& paint, const SkPaint& skPaint, + const SkMatrix& viewMatrix, + const char text[], size_t byteLength, + SkScalar x, SkScalar y, const SkIRect& regionClipBounds) { int glyphCount = skPaint.countText(text, byteLength); SkAutoTUnref blob(CreateBlob(glyphCount, 1)); blob->fViewMatrix = viewMatrix; @@ -288,11 +288,11 @@ void GrBitmapTextContextB::onDrawText(GrRenderTarget* rt, const GrClip& clip, this->flush(fContext->getTextTarget(), blob, rt, paint, clip, viewMatrix, skPaint.getAlpha()); } -void GrBitmapTextContextB::internalDrawText(BitmapTextBlob* blob, int runIndex, - SkGlyphCache* cache, const SkPaint& skPaint, - const SkMatrix& viewMatrix, - const char text[], size_t byteLength, - SkScalar x, SkScalar y, const SkIRect& clipRect) { +void GrAtlasTextContext::internalDrawText(BitmapTextBlob* blob, int runIndex, + SkGlyphCache* cache, const SkPaint& skPaint, + const SkMatrix& viewMatrix, + const char text[], size_t byteLength, + SkScalar x, SkScalar y, const SkIRect& clipRect) { SkASSERT(byteLength == 0 || text != NULL); // nothing to draw @@ -377,12 +377,12 @@ void GrBitmapTextContextB::internalDrawText(BitmapTextBlob* blob, int runIndex, } } -void GrBitmapTextContextB::onDrawPosText(GrRenderTarget* rt, const GrClip& clip, - const GrPaint& paint, const SkPaint& skPaint, - const SkMatrix& viewMatrix, - const char text[], size_t byteLength, - const SkScalar pos[], int scalarsPerPosition, - const SkPoint& offset, const SkIRect& regionClipBounds) { +void GrAtlasTextContext::onDrawPosText(GrRenderTarget* rt, const GrClip& clip, + const GrPaint& paint, const SkPaint& skPaint, + const SkMatrix& viewMatrix, + const char text[], size_t byteLength, + const SkScalar pos[], int scalarsPerPosition, + const SkPoint& offset, const SkIRect& regionClipBounds) { int glyphCount = skPaint.countText(text, byteLength); SkAutoTUnref blob(CreateBlob(glyphCount, 1)); blob->fStyle = skPaint.getStyle(); @@ -400,12 +400,12 @@ void GrBitmapTextContextB::onDrawPosText(GrRenderTarget* rt, const GrClip& clip, this->flush(fContext->getTextTarget(), blob, rt, paint, clip, viewMatrix, fSkPaint.getAlpha()); } -void GrBitmapTextContextB::internalDrawPosText(BitmapTextBlob* blob, int runIndex, - SkGlyphCache* cache, const SkPaint& skPaint, - const SkMatrix& viewMatrix, - const char text[], size_t byteLength, - const SkScalar pos[], int scalarsPerPosition, - const SkPoint& offset, const SkIRect& clipRect) { +void GrAtlasTextContext::internalDrawPosText(BitmapTextBlob* blob, int runIndex, + SkGlyphCache* cache, const SkPaint& skPaint, + const SkMatrix& viewMatrix, + const char text[], size_t byteLength, + const SkScalar pos[], int scalarsPerPosition, + const SkPoint& offset, const SkIRect& clipRect) { SkASSERT(byteLength == 0 || text != NULL); SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition); @@ -559,9 +559,9 @@ void GrBitmapTextContextB::internalDrawPosText(BitmapTextBlob* blob, int runInde } } -void GrBitmapTextContextB::appendGlyph(BitmapTextBlob* blob, int runIndex, GrGlyph::PackedID packed, - int vx, int vy, GrFontScaler* scaler, - const SkIRect& clipRect) { +void GrAtlasTextContext::appendGlyph(BitmapTextBlob* blob, int runIndex, GrGlyph::PackedID packed, + int vx, int vy, GrFontScaler* scaler, + const SkIRect& clipRect) { if (NULL == fCurrStrike) { fCurrStrike = fContext->getBatchFontCache()->getStrike(scaler); } @@ -674,7 +674,7 @@ void GrBitmapTextContextB::appendGlyph(BitmapTextBlob* blob, int runIndex, GrGly class BitmapTextBatch : public GrBatch { public: - typedef GrBitmapTextContextB::BitmapTextBlob Blob; + typedef GrAtlasTextContext::BitmapTextBlob Blob; typedef Blob::Run Run; typedef Run::SubRunInfo TextInfo; struct Geometry { @@ -1010,9 +1010,9 @@ private: GrBatchFontCache* fFontCache; }; -void GrBitmapTextContextB::flush(GrDrawTarget* target, BitmapTextBlob* blob, GrRenderTarget* rt, - const GrPaint& paint, const GrClip& clip, - const SkMatrix& viewMatrix, int paintAlpha) { +void GrAtlasTextContext::flush(GrDrawTarget* target, BitmapTextBlob* blob, GrRenderTarget* rt, + const GrPaint& paint, const GrClip& clip, + const SkMatrix& viewMatrix, int paintAlpha) { GrPipelineBuilder pipelineBuilder; pipelineBuilder.setFromPaint(paint, rt, clip); diff --git a/src/gpu/GrAtlasTextContext.h b/src/gpu/GrAtlasTextContext.h index d0c92b9..4725ee5 100644 --- a/src/gpu/GrAtlasTextContext.h +++ b/src/gpu/GrAtlasTextContext.h @@ -21,14 +21,14 @@ class GrPipelineBuilder; * This class implements GrTextContext using standard bitmap fonts, and can also process textblobs. * TODO replace GrBitmapTextContext */ -class GrBitmapTextContextB : public GrTextContext { +class GrAtlasTextContext : public GrTextContext { public: - static GrBitmapTextContextB* Create(GrContext*, SkGpuDevice*, const SkDeviceProperties&); + static GrAtlasTextContext* Create(GrContext*, SkGpuDevice*, const SkDeviceProperties&); - virtual ~GrBitmapTextContextB(); + virtual ~GrAtlasTextContext(); private: - GrBitmapTextContextB(GrContext*, SkGpuDevice*, const SkDeviceProperties&); + GrAtlasTextContext(GrContext*, SkGpuDevice*, const SkDeviceProperties&); bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, const SkMatrix& viewMatrix) override; diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index d3817aa..b38bc1e 100755 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -237,7 +237,7 @@ GrTextContext* GrContext::createTextContext(GrRenderTarget* renderTarget, } #ifdef USE_BITMAP_TEXTBLOBS - return GrBitmapTextContextB::Create(this, gpuDevice, leakyProperties); + return GrAtlasTextContext::Create(this, gpuDevice, leakyProperties); #else return GrDistanceFieldTextContext::Create(this, gpuDevice, leakyProperties, enableDistanceFieldFonts); diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp index 90d6d76..1fe4320 100755 --- a/src/gpu/GrDistanceFieldTextContext.cpp +++ b/src/gpu/GrDistanceFieldTextContext.cpp @@ -82,7 +82,7 @@ GrDistanceFieldTextContext* GrDistanceFieldTextContext::Create(GrContext* contex (context, gpuDevice, props, enable)); textContext->buildDistanceAdjustTable(); #ifdef USE_BITMAP_TEXTBLOBS - textContext->fFallbackTextContext = GrBitmapTextContextB::Create(context, gpuDevice, props); + textContext->fFallbackTextContext = GrAtlasTextContext::Create(context, gpuDevice, props); #else textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, gpuDevice, props); #endif diff --git a/src/gpu/GrStencilAndCoverTextContext.cpp b/src/gpu/GrStencilAndCoverTextContext.cpp index 1df8f16..1456aa2 100644 --- a/src/gpu/GrStencilAndCoverTextContext.cpp +++ b/src/gpu/GrStencilAndCoverTextContext.cpp @@ -36,7 +36,7 @@ GrStencilAndCoverTextContext::Create(GrContext* context, SkGpuDevice* gpuDevice, GrStencilAndCoverTextContext* textContext = SkNEW_ARGS(GrStencilAndCoverTextContext, (context, gpuDevice, props)); #ifdef USE_BITMAP_TEXTBLOBS - textContext->fFallbackTextContext = GrBitmapTextContextB::Create(context, gpuDevice, props); + textContext->fFallbackTextContext = GrAtlasTextContext::Create(context, gpuDevice, props); #else textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, gpuDevice, props); #endif diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h index 8c3414b..30cf68d 100644 --- a/src/gpu/SkGpuDevice.h +++ b/src/gpu/SkGpuDevice.h @@ -219,7 +219,7 @@ private: static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, const SkImageInfo&, int sampleCount); - friend class GrBitmapTextContextB; + friend class GrAtlasTextContext; friend class GrTextContext; typedef SkBaseDevice INHERITED; }; -- 2.7.4