Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Unified Diff: src/gpu/gl/GrGpuGL.cpp

Issue 20436002: get genmipmap function in the struct (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix rebase conflicts Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLInterface.cpp ('k') | src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGpuGL.cpp
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 5b9609bc88f7c31c388b54dd0b2b33830aeef846..149025aa0d9606fc718176ca48f722394712b542 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,21 @@ 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_NEAREST : GR_GL_LINEAR;
+ static GrGLenum glFilterModes[] = {
+ GR_GL_NEAREST,
+ GR_GL_LINEAR,
+ GR_GL_LINEAR_MIPMAP_LINEAR
+ };
+ newTexParams.fFilter = glFilterModes[params.filterMode()];
+
+#ifndef SKIA_IGNORE_GPU_MIPMAPS
+ 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);
+ }
+#endif
newTexParams.fWrapS = tile_to_gl_wrap(params.getTileModeX());
newTexParams.fWrapT = tile_to_gl_wrap(params.getTileModeY());
« no previous file with comments | « src/gpu/gl/GrGLInterface.cpp ('k') | src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698