Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Unified Diff: src/gpu/GrDistanceFieldTextContext.cpp

Issue 1015173002: Let text contexts fall back directly to paths (Closed) Base URL: https://skia.googlesource.com/skia.git@text-blob-to-context
Patch Set: move createTextContext to private Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.h ('k') | src/gpu/GrStencilAndCoverTextContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.h ('k') | src/gpu/GrStencilAndCoverTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698