aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDrawTarget.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-15 13:51:00 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-15 13:51:00 +0000
commiteb85117c05471e1a55ce387cbc38279f857a4584 (patch)
tree76ea39395f668d66cb6128bad10b8cf56dc7cad7 /src/gpu/GrDrawTarget.cpp
parentab38e560e922b554ea9fa98adc4f79aee7eca8ba (diff)
Add support for using glCopyTexSubImage2D when possible to copy surfaces.
Review URL: https://codereview.chromium.org/13915011 git-svn-id: http://skia.googlecode.com/svn/trunk@8675 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrDrawTarget.cpp')
-rw-r--r--src/gpu/GrDrawTarget.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 9036a57796..e875f0f93c 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -432,11 +432,9 @@ bool GrDrawTarget::setupDstReadIfNecessary(DrawInfo* info) {
// MSAA consideration: When there is support for reading MSAA samples in the shader we could
// have per-sample dst values by making the copy multisampled.
GrTextureDesc desc;
- desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit;
+ this->initCopySurfaceDstDesc(rt, &desc);
desc.fWidth = copyRect.width();
desc.fHeight = copyRect.height();
- desc.fSampleCnt = 0;
- desc.fConfig = rt->config();
GrAutoScratchTexture ast(fContext, desc, GrContext::kApprox_ScratchTexMatch);
@@ -447,7 +445,7 @@ bool GrDrawTarget::setupDstReadIfNecessary(DrawInfo* info) {
SkIPoint dstPoint = {0, 0};
if (this->copySurface(ast.texture(), rt, copyRect, dstPoint)) {
info->fDstCopy.setTexture(ast.texture());
- info->fDstCopy.setOffset(copyRect.fLeft, copyRect.fTop);
+ info->fDstCopy.setOffset(copyRect.fLeft, copyRect.fTop);
return true;
} else {
return false;
@@ -881,6 +879,13 @@ bool GrDrawTarget::onCopySurface(GrSurface* dst,
return true;
}
+void GrDrawTarget::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* desc) {
+ // Make the dst of the copy be a render target because the default copySurface draws to the dst.
+ desc->fOrigin = kDefault_GrSurfaceOrigin;
+ desc->fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit;
+ desc->fConfig = src->config();
+}
+
///////////////////////////////////////////////////////////////////////////////
SK_DEFINE_INST_COUNT(GrDrawTargetCaps)