Index: src/gpu/gl/GrGpuGL.cpp |
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp |
index 4102c8c48ba72bf1e643d22b5c893f4cae39674e..dcc4db8f6c58c28809e0cdcf753b0b03e49b69ac 100644 |
--- a/src/gpu/gl/GrGpuGL.cpp |
+++ b/src/gpu/gl/GrGpuGL.cpp |
@@ -526,9 +526,14 @@ bool GrGpuGL::onWriteTexturePixels(GrTexture* texture, |
desc.fTextureID = glTex->textureID(); |
desc.fOrigin = glTex->origin(); |
- return this->uploadTexData(desc, false, |
- left, top, width, height, |
- config, buffer, rowBytes); |
+ if (this->uploadTexData(desc, false, |
+ left, top, width, height, |
+ config, buffer, rowBytes)) { |
+ texture->dirtyMipMaps(true); |
+ return true; |
+ } else { |
+ return false; |
+ } |
} |
namespace { |
@@ -1547,6 +1552,11 @@ void GrGpuGL::flushRenderTarget(const SkIRect* bound) { |
if (NULL == bound || !bound->isEmpty()) { |
rt->flagAsNeedingResolve(bound); |
} |
+ |
+ GrTexture *texture = rt->asTexture(); |
+ if (texture) { |
+ texture->dirtyMipMaps(true); |
+ } |
} |
GrGLenum gPrimitiveType2GLMode[] = { |
@@ -2006,7 +2016,19 @@ void GrGpuGL::bindTexture(int unitIdx, const GrTextureParams& params, GrGLTextur |
bool setAll = timestamp < this->getResetTimestamp(); |
GrGLTexture::TexParams newTexParams; |
- newTexParams.fFilter = (params.filterMode() == GrTextureParams::kNone_FilterMode) ? GR_GL_LINEAR : GR_GL_NEAREST; |
+ static GrGLenum glFilterModes[] = { |
+ GR_GL_NEAREST, |
+ GR_GL_LINEAR, |
+ GR_GL_LINEAR_MIPMAP_LINEAR |
+ }; |
+ newTexParams.fFilter = glFilterModes[params.filterMode()]; |
+ |
+ if (params.filterMode() == GrTextureParams::kMipMap_FilterMode && |
+ texture->mipMapsAreDirty()) { |
+// GL_CALL(Hint(GR_GL_GENERATE_MIPMAP_HINT,GR_GL_NICEST)); |
+ GL_CALL(GenerateMipmap(GR_GL_TEXTURE_2D)); |
+ texture->dirtyMipMaps(false); |
+ } |
newTexParams.fWrapS = tile_to_gl_wrap(params.getTileModeX()); |
newTexParams.fWrapT = tile_to_gl_wrap(params.getTileModeY()); |