aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTest.cpp
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2015-12-08 18:53:44 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-08 18:53:44 -0800
commit0671b967eb02d44c8951dc4dc39df09fac15b097 (patch)
treeb03f60a7eefee024cf92361680326eac695c931d /src/gpu/GrTest.cpp
parent55462e5f50f713af731d8c07383c43ec53885d00 (diff)
Move texture drawing utility method to SkGpuDevice
Diffstat (limited to 'src/gpu/GrTest.cpp')
-rw-r--r--src/gpu/GrTest.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index e7b2ae7699..755fabc215 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -16,6 +16,8 @@
#include "GrGpuResourceCacheAccess.h"
#include "GrResourceCache.h"
#include "GrTextBlobCache.h"
+
+#include "SkGpuDevice.h"
#include "SkGrPriv.h"
#include "SkString.h"
@@ -137,35 +139,33 @@ void GrContext::printGpuStats() const {
SkDebugf("%s", out.c_str());
}
-void GrContext::drawFontCache(const SkRect& rect, GrMaskFormat format, const SkPaint& paint,
- GrRenderTarget* target) {
+GrTexture* GrContext::getFontAtlasTexture(GrMaskFormat format) {
GrBatchFontCache* cache = this->getBatchFontCache();
- GrTexture* atlas = cache->getTexture(format);
-
- SkAutoTUnref<GrDrawContext> drawContext(this->drawContext(target));
- // TODO: add drawContext method to encapsulate this.
+ return cache->getTexture(format);
+}
+void SkGpuDevice::drawTexture(GrTexture* tex, const SkRect& dst, const SkPaint& paint) {
GrPaint grPaint;
SkMatrix mat;
mat.reset();
- if (!SkPaintToGrPaint(this, paint, mat, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), paint, mat, &grPaint)) {
return;
}
SkMatrix textureMat;
textureMat.reset();
- // TODO: use setScaleTranslate()
- 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();
+ textureMat[SkMatrix::kMScaleX] = 1.0f/dst.width();
+ textureMat[SkMatrix::kMScaleY] = 1.0f/dst.height();
+ textureMat[SkMatrix::kMTransX] = -dst.fLeft/dst.width();
+ textureMat[SkMatrix::kMTransY] = -dst.fTop/dst.height();
- grPaint.addColorTextureProcessor(atlas, textureMat);
+ grPaint.addColorTextureProcessor(tex, textureMat);
GrClip clip;
- drawContext->drawRect(clip, grPaint, mat, rect);
+ fDrawContext->drawRect(clip, grPaint, mat, dst);
}
+
#if GR_GPU_STATS
void GrGpu::Stats::dump(SkString* out) {
out->appendf("Render Target Binds: %d\n", fRenderTargetBinds);