diff options
author | Brian Salomon <bsalomon@google.com> | 2018-02-09 09:54:25 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-09 15:57:41 +0000 |
commit | 1fabd51f585383b0f7b8f82c4489989e9379627b (patch) | |
tree | 4303136d754832c6bc0aaa708c3792f1b7639166 /src/gpu/GrGpu.cpp | |
parent | df430053e03ce6baa38fe7f1fcd6c4ccae66d4bf (diff) |
Track dirty rects on GrRenderTargets in native space rather than origin-relative
Change-Id: Icccf2fcb5d468696c42c5a0ccf405e30e5e9bc65
Reviewed-on: https://skia-review.googlesource.com/105980
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrGpu.cpp')
-rw-r--r-- | src/gpu/GrGpu.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index d9b3b87397..ea13c851ad 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -300,7 +300,7 @@ bool GrGpu::writePixels(GrSurface* surface, GrSurfaceOrigin origin, if (this->onWritePixels(surface, origin, left, top, width, height, config, texels, mipLevelCount)) { SkIRect rect = SkIRect::MakeXYWH(left, top, width, height); - this->didWriteToSurface(surface, &rect, mipLevelCount); + this->didWriteToSurface(surface, origin, &rect, mipLevelCount); fStats.incTextureUploads(); return true; } @@ -333,7 +333,7 @@ bool GrGpu::transferPixels(GrTexture* texture, if (this->onTransferPixels(texture, left, top, width, height, config, transferBuffer, offset, rowBytes)) { SkIRect rect = SkIRect::MakeXYWH(left, top, width, height); - this->didWriteToSurface(texture, &rect); + this->didWriteToSurface(texture, kTopLeft_GrSurfaceOrigin, &rect); fStats.incTransfersToTexture(); return true; @@ -341,17 +341,24 @@ bool GrGpu::transferPixels(GrTexture* texture, return false; } -void GrGpu::resolveRenderTarget(GrRenderTarget* target, GrSurfaceOrigin origin) { +void GrGpu::resolveRenderTarget(GrRenderTarget* target) { SkASSERT(target); this->handleDirtyContext(); - this->onResolveRenderTarget(target, origin); + this->onResolveRenderTarget(target); } -void GrGpu::didWriteToSurface(GrSurface* surface, const SkIRect* bounds, uint32_t mipLevels) const { +void GrGpu::didWriteToSurface(GrSurface* surface, GrSurfaceOrigin origin, const SkIRect* bounds, + uint32_t mipLevels) const { SkASSERT(surface); // Mark any MIP chain and resolve buffer as dirty if and only if there is a non-empty bounds. if (nullptr == bounds || !bounds->isEmpty()) { if (GrRenderTarget* target = surface->asRenderTarget()) { + SkIRect flippedBounds; + if (kBottomLeft_GrSurfaceOrigin == origin && bounds) { + flippedBounds = {bounds->fLeft, surface->height() - bounds->fBottom, + bounds->fRight, surface->height() - bounds->fTop}; + bounds = &flippedBounds; + } target->flagAsNeedingResolve(bounds); } GrTexture* texture = surface->asTexture(); |