Index: src/gpu/GrTest.cpp |
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp |
index 4adc3f7b7b770585a34e92729b3efe509c4c60e9..330d9cb266979b889d9c793e42dbaf77b30e47f7 100644 |
--- a/src/gpu/GrTest.cpp |
+++ b/src/gpu/GrTest.cpp |
@@ -11,10 +11,12 @@ |
#include "GrBatchAtlas.h" |
#include "GrBatchFontCache.h" |
#include "GrContextOptions.h" |
+#include "GrDrawContext.h" |
#include "GrDrawingManager.h" |
#include "GrGpuResourceCacheAccess.h" |
#include "GrResourceCache.h" |
#include "GrTextBlobCache.h" |
+#include "SkGrPriv.h" |
#include "SkString.h" |
namespace GrTest { |
@@ -97,6 +99,33 @@ void GrContext::printGpuStats() const { |
SkDebugf("%s", out.c_str()); |
} |
+void GrContext::drawFontCache(const SkRect& rect, GrMaskFormat format, const SkPaint& paint, |
+ GrRenderTarget* target) { |
+ GrBatchFontCache* cache = this->getBatchFontCache(); |
+ |
+ GrTexture* atlas = cache->getTexture(format); |
+ |
+ SkAutoTUnref<GrDrawContext> drawContext(this->drawContext(target)); |
robertphillips
2015/11/06 21:53:08
// TODO: add drawContext method to encapsulate thi
jvanverth1
2015/11/06 22:06:53
Done.
|
+ |
+ GrPaint grPaint; |
+ SkMatrix mat; |
robertphillips
2015/11/06 21:51:14
reset mat ?
jvanverth1
2015/11/06 22:06:53
Done.
|
+ if (!SkPaintToGrPaint(this, paint, mat, &grPaint)) { |
+ return; |
+ } |
robertphillips
2015/11/06 21:51:14
setScaleTranslate ?
jvanverth1
2015/11/06 22:06:53
Acknowledged.
|
+ SkMatrix textureMat; |
+ textureMat.reset(); |
+ textureMat[SkMatrix::kMScaleX] = 1.0f/rect.width(); |
+ textureMat[SkMatrix::kMScaleY] = 1.0f/rect.height(); |
+ textureMat[SkMatrix::kMTransX] = -rect.fLeft/rect.width(); |
+ textureMat[SkMatrix::kMTransY] = -rect.fTop/rect.height(); |
+ |
+ grPaint.addColorTextureProcessor(atlas, textureMat); |
+ |
+ GrClip clip; |
robertphillips
2015/11/06 21:51:14
don't need reset. Should default to wide open.
jvanverth1
2015/11/06 22:06:53
Done.
|
+ clip.reset(); |
+ drawContext->drawRect(clip, grPaint, mat, rect); |
+} |
+ |
#if GR_GPU_STATS |
void GrGpu::Stats::dump(SkString* out) { |
out->appendf("Render Target Binds: %d\n", fRenderTargetBinds); |