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

Side by Side Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1836143003: Dirty mipmaps whenever we upload new contents for a texture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrGLGpu.h" 8 #include "GrGLGpu.h"
9 #include "GrGLBuffer.h" 9 #include "GrGLBuffer.h"
10 #include "GrGLGLSL.h" 10 #include "GrGLGLSL.h"
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 if (GrPixelConfigIsCompressed(glTex->desc().fConfig)) { 833 if (GrPixelConfigIsCompressed(glTex->desc().fConfig)) {
834 // We check that config == desc.fConfig in GrGLGpu::canWriteTexturePixel s() 834 // We check that config == desc.fConfig in GrGLGpu::canWriteTexturePixel s()
835 SkASSERT(config == glTex->desc().fConfig); 835 SkASSERT(config == glTex->desc().fConfig);
836 success = this->uploadCompressedTexData(glTex->desc(), glTex->target(), texels, 836 success = this->uploadCompressedTexData(glTex->desc(), glTex->target(), texels,
837 kWrite_UploadType, left, top, wi dth, height); 837 kWrite_UploadType, left, top, wi dth, height);
838 } else { 838 } else {
839 success = this->uploadTexData(glTex->desc(), glTex->target(), kWrite_Upl oadType, 839 success = this->uploadTexData(glTex->desc(), glTex->target(), kWrite_Upl oadType,
840 left, top, width, height, config, texels); 840 left, top, width, height, config, texels);
841 } 841 }
842 842
843 if (success) {
844 SkIRect rect = SkIRect::MakeXYWH(left, top, width, height);
845 this->didWriteToSurface(surface, &rect);
846 }
847
843 return success; 848 return success;
844 } 849 }
845 850
846 bool GrGLGpu::onTransferPixels(GrSurface* surface, 851 bool GrGLGpu::onTransferPixels(GrSurface* surface,
847 int left, int top, int width, int height, 852 int left, int top, int width, int height,
848 GrPixelConfig config, GrBuffer* transferBuffer, 853 GrPixelConfig config, GrBuffer* transferBuffer,
849 size_t offset, size_t rowBytes) { 854 size_t offset, size_t rowBytes) {
850 GrGLTexture* glTex = static_cast<GrGLTexture*>(surface->asTexture()); 855 GrGLTexture* glTex = static_cast<GrGLTexture*>(surface->asTexture());
851 856
852 if (!check_write_and_transfer_input(glTex, surface, config)) { 857 if (!check_write_and_transfer_input(glTex, surface, config)) {
(...skipping 16 matching lines...) Expand all
869 874
870 bool success = false; 875 bool success = false;
871 GrMipLevel mipLevel; 876 GrMipLevel mipLevel;
872 mipLevel.fPixels = transferBuffer; 877 mipLevel.fPixels = transferBuffer;
873 mipLevel.fRowBytes = rowBytes; 878 mipLevel.fRowBytes = rowBytes;
874 SkSTArray<1, GrMipLevel> texels; 879 SkSTArray<1, GrMipLevel> texels;
875 texels.push_back(mipLevel); 880 texels.push_back(mipLevel);
876 success = this->uploadTexData(glTex->desc(), glTex->target(), kTransfer_Uplo adType, 881 success = this->uploadTexData(glTex->desc(), glTex->target(), kTransfer_Uplo adType,
877 left, top, width, height, config, texels); 882 left, top, width, height, config, texels);
878 if (success) { 883 if (success) {
879 glTex->texturePriv().dirtyMipMaps(true); 884 SkIRect rect = SkIRect::MakeXYWH(left, top, width, height);
885 this->didWriteToSurface(surface, &rect);
880 return true; 886 return true;
881 } 887 }
882 888
883 return false; 889 return false;
884 } 890 }
885 891
886 // For GL_[UN]PACK_ALIGNMENT. 892 // For GL_[UN]PACK_ALIGNMENT.
887 static inline GrGLint config_alignment(GrPixelConfig config) { 893 static inline GrGLint config_alignment(GrPixelConfig config) {
888 SkASSERT(!GrPixelConfigIsCompressed(config)); 894 SkASSERT(!GrPixelConfigIsCompressed(config));
889 switch (config) { 895 switch (config) {
(...skipping 3334 matching lines...) Expand 10 before | Expand all | Expand 10 after
4224 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || 4230 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() ||
4225 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { 4231 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) {
4226 copyParams->fFilter = GrTextureParams::kNone_FilterMode; 4232 copyParams->fFilter = GrTextureParams::kNone_FilterMode;
4227 copyParams->fWidth = texture->width(); 4233 copyParams->fWidth = texture->width();
4228 copyParams->fHeight = texture->height(); 4234 copyParams->fHeight = texture->height();
4229 return true; 4235 return true;
4230 } 4236 }
4231 } 4237 }
4232 return false; 4238 return false;
4233 } 4239 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698