Index: src/gpu/GrTest.cpp |
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp |
index 6e9df211fa93c4e8abcee595c37b9f5aa13f3a63..3e9c259b94fbfa3686556f6974408cfd0a00a3d4 100644 |
--- a/src/gpu/GrTest.cpp |
+++ b/src/gpu/GrTest.cpp |
@@ -57,7 +57,21 @@ void GrContext::getTestTarget(GrTestTarget* tar) { |
// then disconnects. This would help prevent test writers from mixing using the returned |
// GrDrawTarget and regular drawing. We could also assert or fail in GrContext drawing methods |
// until ~GrTestTarget(). |
- SkAutoTUnref<GrDrawTarget> dt(fDrawingManager->newDrawTarget(nullptr)); |
+ GrSurfaceDesc desc; |
+ desc.fFlags = kRenderTarget_GrSurfaceFlag; |
+ desc.fWidth = 256; |
+ desc.fHeight = 256; |
+ desc.fConfig = kRGBA_8888_GrPixelConfig; |
+ desc.fSampleCnt = 0; |
+ |
+ GrTexture* texture = this->textureProvider()->createTexture(desc, false, nullptr, 0); |
+ if (nullptr == texture) { |
+ return; |
+ } |
+ SkASSERT(nullptr != texture->asRenderTarget()); |
+ GrRenderTarget* rt = texture->asRenderTarget(); |
+ |
+ SkAutoTUnref<GrDrawTarget> dt(fDrawingManager->newDrawTarget(rt)); |
tar->init(this, dt); |
} |
@@ -111,7 +125,7 @@ void GrContext::drawFontCache(const SkRect& rect, GrMaskFormat format, const SkP |
GrPaint grPaint; |
SkMatrix mat; |
mat.reset(); |
- if (!SkPaintToGrPaint(this, paint, mat, &grPaint)) { |
+ if (!SkPaintToGrPaint(this, paint, mat, &grPaint, target)) { |
return; |
} |
SkMatrix textureMat; |
@@ -122,7 +136,7 @@ void GrContext::drawFontCache(const SkRect& rect, GrMaskFormat format, const SkP |
textureMat[SkMatrix::kMTransX] = -rect.fLeft/rect.width(); |
textureMat[SkMatrix::kMTransY] = -rect.fTop/rect.height(); |
- grPaint.addColorTextureProcessor(atlas, textureMat); |
+ grPaint.addColorTextureProcessor(atlas, textureMat, target); |
GrClip clip; |
drawContext->drawRect(clip, grPaint, mat, rect); |