| Index: src/gpu/GrDistanceFieldTextContext.cpp
|
| diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
|
| index 180c506e33d271176a2ea9e3325f63cf69279882..5517ea25b9fde0ccf9daa193eef02c0dc74894b2 100755
|
| --- a/src/gpu/GrDistanceFieldTextContext.cpp
|
| +++ b/src/gpu/GrDistanceFieldTextContext.cpp
|
| @@ -42,9 +42,10 @@ static const int kVerticesPerGlyph = 4;
|
| static const int kIndicesPerGlyph = 6;
|
|
|
| GrDistanceFieldTextContext::GrDistanceFieldTextContext(GrContext* context,
|
| + SkGpuDevice* gpuDevice,
|
| const SkDeviceProperties& properties,
|
| bool enable)
|
| - : GrTextContext(context, properties) {
|
| + : GrTextContext(context, gpuDevice, properties) {
|
| #if SK_FORCE_DISTANCE_FIELD_TEXT
|
| fEnableDFRendering = true;
|
| #else
|
| @@ -67,11 +68,12 @@ GrDistanceFieldTextContext::GrDistanceFieldTextContext(GrContext* context,
|
| }
|
|
|
| GrDistanceFieldTextContext* GrDistanceFieldTextContext::Create(GrContext* context,
|
| + SkGpuDevice* gpuDevice,
|
| const SkDeviceProperties& props,
|
| bool enable) {
|
| GrDistanceFieldTextContext* textContext = SkNEW_ARGS(GrDistanceFieldTextContext,
|
| - (context, props, enable));
|
| - textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, props);
|
| + (context, gpuDevice, props, enable));
|
| + textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, gpuDevice, props);
|
|
|
| return textContext;
|
| }
|
| @@ -114,8 +116,9 @@ bool GrDistanceFieldTextContext::canDraw(const SkPaint& paint, const SkMatrix& v
|
| }
|
|
|
| inline void GrDistanceFieldTextContext::init(GrRenderTarget* rt, const GrClip& clip,
|
| - const GrPaint& paint, const SkPaint& skPaint) {
|
| - GrTextContext::init(rt, clip, paint, skPaint);
|
| + const GrPaint& paint, const SkPaint& skPaint,
|
| + const SkIRect& regionClipBounds) {
|
| + GrTextContext::init(rt, clip, paint, skPaint, regionClipBounds);
|
|
|
| fStrike = NULL;
|
|
|
| @@ -212,7 +215,8 @@ void GrDistanceFieldTextContext::onDrawText(GrRenderTarget* rt, const GrClip& cl
|
| const GrPaint& paint,
|
| const SkPaint& skPaint, const SkMatrix& viewMatrix,
|
| const char text[], size_t byteLength,
|
| - SkScalar x, SkScalar y) {
|
| + SkScalar x, SkScalar y,
|
| + const SkIRect& regionClipBounds) {
|
| SkASSERT(byteLength == 0 || text != NULL);
|
|
|
| // nothing to draw
|
| @@ -270,8 +274,8 @@ void GrDistanceFieldTextContext::onDrawText(GrRenderTarget* rt, const GrClip& cl
|
| y -= alignY;
|
| SkPoint offset = SkPoint::Make(x, y);
|
|
|
| - this->drawPosText(rt, clip, paint, skPaint, viewMatrix, text, byteLength, positions.begin(), 2,
|
| - offset);
|
| + this->onDrawPosText(rt, clip, paint, skPaint, viewMatrix, text, byteLength, positions.begin(),
|
| + 2, offset, regionClipBounds);
|
| }
|
|
|
| void GrDistanceFieldTextContext::onDrawPosText(GrRenderTarget* rt, const GrClip& clip,
|
| @@ -279,7 +283,8 @@ void GrDistanceFieldTextContext::onDrawPosText(GrRenderTarget* rt, const GrClip&
|
| const SkPaint& skPaint, const SkMatrix& viewMatrix,
|
| const char text[], size_t byteLength,
|
| const SkScalar pos[], int scalarsPerPosition,
|
| - const SkPoint& offset) {
|
| + const SkPoint& offset,
|
| + const SkIRect& regionClipBounds) {
|
|
|
| SkASSERT(byteLength == 0 || text != NULL);
|
| SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition);
|
| @@ -290,7 +295,7 @@ void GrDistanceFieldTextContext::onDrawPosText(GrRenderTarget* rt, const GrClip&
|
| }
|
|
|
| fViewMatrix = viewMatrix;
|
| - this->init(rt, clip, paint, skPaint);
|
| + this->init(rt, clip, paint, skPaint, regionClipBounds);
|
|
|
| SkDrawCacheProc glyphCacheProc = fSkPaint.getDrawCacheProc();
|
|
|
| @@ -367,9 +372,10 @@ void GrDistanceFieldTextContext::onDrawPosText(GrRenderTarget* rt, const GrClip&
|
| this->finish();
|
|
|
| if (fallbackTxt.count() > 0) {
|
| - fFallbackTextContext->drawPosText(rt, clip, paint, skPaint, viewMatrix, fallbackTxt.begin(),
|
| - fallbackTxt.count(), fallbackPos.begin(),
|
| - scalarsPerPosition, offset);
|
| + fFallbackTextContext->drawPosText(rt, clip, paint, skPaint, viewMatrix,
|
| + fallbackTxt.begin(), fallbackTxt.count(),
|
| + fallbackPos.begin(), scalarsPerPosition, offset,
|
| + regionClipBounds);
|
| }
|
| }
|
|
|
|
|