aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGpu.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-06-20 16:25:26 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-20 21:13:27 +0000
commit930f939c48af1be6005af12bb6f709ca5da9d118 (patch)
tree21dbb8b105aa1190237c148358b7993565158335 /src/gpu/GrGpu.cpp
parent2a284de7a51c198096a6f34ec1cbfe9118db554c (diff)
Ensure that textures exported via SkImage::MakeBackendTextureFromSkImage
have consistent content in their mip map levels. Bug= chromium:850617 Change-Id: I3ad918aa453bd8e4e625eb145de6ba2a5dab7b0c Reviewed-on: https://skia-review.googlesource.com/136230 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrGpu.cpp')
-rw-r--r--src/gpu/GrGpu.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 3ebfa364d4..4b7e786f87 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -291,6 +291,19 @@ bool GrGpu::transferPixels(GrTexture* texture, int left, int top, int width, int
return false;
}
+bool GrGpu::regenerateMipMapLevels(GrTexture* texture) {
+ SkASSERT(texture);
+ SkASSERT(this->caps()->mipMapSupport());
+ SkASSERT(texture->texturePriv().mipMapped() == GrMipMapped::kYes);
+ SkASSERT(texture->texturePriv().mipMapsAreDirty());
+ SkASSERT(!texture->asRenderTarget() || !texture->asRenderTarget()->needsResolve());
+ if (this->onRegenerateMipMapLevels(texture)) {
+ texture->texturePriv().markMipMapsClean();
+ return true;
+ }
+ return false;
+}
+
void GrGpu::resolveRenderTarget(GrRenderTarget* target) {
SkASSERT(target);
this->handleDirtyContext();