aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGpuGL.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-26 16:36:04 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-26 16:36:04 +0000
commitcffff79a40bd7672e13b31b9801a3f3cda64875e (patch)
treefac5fe8f4170e8eb7b28dfbe5fe601aaebb9adc9 /src/gpu/gl/GrGpuGL.cpp
parent0f48ee0a07aa50ab60bfff3c2718b9649e3639ea (diff)
get genmipmap function in the struct
BUG= R=bsalomon@google.com, reed@google.com Author: humper@google.com Review URL: https://chromiumcodereview.appspot.com/20436002 git-svn-id: http://skia.googlecode.com/svn/trunk@10393 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/gl/GrGpuGL.cpp')
-rw-r--r--src/gpu/gl/GrGpuGL.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 5b9609bc88..149025aa0d 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());