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

Unified Diff: src/gpu/GrTest.cpp

Issue 1506203002: Move texture drawing utility method to SkGpuDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comment Created 5 years 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 | « samplecode/SampleAnimatedText.cpp ('k') | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTest.cpp
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index e7b2ae7699f2234be4e02e1ac0a771eaa354e406..755fabc2158f3a7c3915013e782375341fcb1bfb 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);
« no previous file with comments | « samplecode/SampleAnimatedText.cpp ('k') | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698