aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2014-06-19 12:01:10 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-19 12:01:11 -0700
commit8e80d17d2b63fa84081236012f31bb10c58d344d (patch)
tree58f93b35b0f5a9e563357de8c022936ef93d9d47
parentd7f846bdd171e4be0c05cfe61bc4446caf5c99c6 (diff)
Reduce texture uploads for font atlas.
Also adds upload tracing for Chrome. R=bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/347563005
-rw-r--r--src/gpu/GrAtlas.cpp5
-rwxr-xr-xsrc/gpu/GrBitmapTextContext.cpp2
-rwxr-xr-xsrc/gpu/GrDistanceFieldTextContext.cpp2
-rw-r--r--src/gpu/GrInOrderDrawBuffer.cpp3
4 files changed, 7 insertions, 5 deletions
diff --git a/src/gpu/GrAtlas.cpp b/src/gpu/GrAtlas.cpp
index 331f5d92aa..ea5ad50a39 100644
--- a/src/gpu/GrAtlas.cpp
+++ b/src/gpu/GrAtlas.cpp
@@ -10,6 +10,7 @@
#include "GrContext.h"
#include "GrGpu.h"
#include "GrRectanizer.h"
+#include "GrTracing.h"
///////////////////////////////////////////////////////////////////////////////
@@ -90,6 +91,7 @@ bool GrPlot::addSubImage(int width, int height, const void* image,
} else {
adjust_for_offset(loc, fOffset);
GrContext* context = fTexture->getContext();
+ TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("skia.gpu"), "GrPlot::uploadToTexture");
context->writeTexturePixels(fTexture,
loc->fX, loc->fY, width, height,
fTexture->config(), image, 0,
@@ -110,12 +112,13 @@ void GrPlot::uploadToTexture() {
SkASSERT(fBatchUploads);
if (fDirty) {
+ TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("skia.gpu"), "GrPlot::uploadToTexture");
SkASSERT(NULL != fTexture);
GrContext* context = fTexture->getContext();
// We pass the flag that does not force a flush. We assume our caller is
// smart and hasn't referenced the part of the texture we're about to update
// since the last flush.
- int rowBytes = fBytesPerPixel*fRects->width();
+ size_t rowBytes = fBytesPerPixel*fRects->width();
const unsigned char* dataPtr = fPlotData;
dataPtr += rowBytes*fDirtyRect.fTop;
dataPtr += fBytesPerPixel*fDirtyRect.fLeft;
diff --git a/src/gpu/GrBitmapTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp
index 696077dd95..4f6a1af7b2 100755
--- a/src/gpu/GrBitmapTextContext.cpp
+++ b/src/gpu/GrBitmapTextContext.cpp
@@ -88,8 +88,6 @@ void GrBitmapTextContext::flushGlyphs() {
drawState->setFromPaint(fPaint, SkMatrix::I(), fContext->getRenderTarget());
if (fCurrVertex > 0) {
- fContext->getFontCache()->updateTextures();
-
// setup our sampler state for our text texture/atlas
SkASSERT(SkIsAlign4(fCurrVertex));
SkASSERT(fCurrTexture);
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
index c79276777d..fe6e50fbde 100755
--- a/src/gpu/GrDistanceFieldTextContext.cpp
+++ b/src/gpu/GrDistanceFieldTextContext.cpp
@@ -106,8 +106,6 @@ void GrDistanceFieldTextContext::flushGlyphs() {
drawState->setFromPaint(fPaint, fContext->getMatrix(), fContext->getRenderTarget());
if (fCurrVertex > 0) {
- fContext->getFontCache()->updateTextures();
-
// setup our sampler state for our text texture/atlas
SkASSERT(SkIsAlign4(fCurrVertex));
SkASSERT(fCurrTexture);
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 6a503bbfd5..deea72b90d 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -9,6 +9,7 @@
#include "GrBufferAllocPool.h"
#include "GrDrawTargetCaps.h"
+#include "GrTextStrike.h"
#include "GrGpu.h"
#include "GrIndexBuffer.h"
#include "GrPath.h"
@@ -557,6 +558,8 @@ void GrInOrderDrawBuffer::flush() {
return;
}
+ this->getContext()->getFontCache()->updateTextures();
+
SkASSERT(kReserved_GeometrySrcType != this->getGeomSrc().fVertexSrc);
SkASSERT(kReserved_GeometrySrcType != this->getGeomSrc().fIndexSrc);