Make all pixel ops go thru ctx so we can correctly flush. Unify two texture upload code paths.
Review URL: http://codereview.appspot.com/5373108/
git-svn-id: http://skia.googlecode.com/svn/trunk@2701 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrAtlas.cpp b/src/gpu/GrAtlas.cpp
index 7b88498..5c95153 100644
--- a/src/gpu/GrAtlas.cpp
+++ b/src/gpu/GrAtlas.cpp
@@ -9,6 +9,7 @@
#include "GrAtlas.h"
+#include "GrContext.h"
#include "GrGpu.h"
#include "GrRectanizer.h"
#include "GrPlotMgr.h"
@@ -109,7 +110,14 @@
image = storage.get();
}
adjustForPlot(loc, fPlot);
- fTexture->uploadTextureData(loc->fX, loc->fY, dstW, dstH, image, 0);
+ GrContext* context = fTexture->getContext();
+ // We call the internal version so that we don't 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.
+ context->internalWriteTexturePixels(fTexture, loc->fX, loc->fY,
+ dstW, dstH, fTexture->config(),
+ image, 0,
+ GrContext::kDontFlush_PixelOpsFlag);
// now tell the caller to skip the top/left BORDER
loc->fX += BORDER;