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

Side by Side Diff: src/gpu/SkGrPixelRef.cpp

Issue 1177843007: Invalidate GrTexture mipmap on content change notification (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: typo fix Created 5 years, 6 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 | « src/core/SkPixelRef.cpp ('k') | tests/GrTextureMipMapInvalidationTest.cpp » ('j') | 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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
11 #include "SkGrPixelRef.h" 11 #include "SkGrPixelRef.h"
12 12
13 #include "GrContext.h" 13 #include "GrContext.h"
14 #include "GrTexture.h" 14 #include "GrTexture.h"
15 #include "GrTexturePriv.h"
15 #include "SkBitmapCache.h" 16 #include "SkBitmapCache.h"
16 #include "SkGr.h" 17 #include "SkGr.h"
17 #include "SkRect.h" 18 #include "SkRect.h"
18 19
19 // since we call lockPixels recursively on fBitmap, we need a distinct mutex, 20 // since we call lockPixels recursively on fBitmap, we need a distinct mutex,
20 // to avoid deadlock with the default one provided by SkPixelRef. 21 // to avoid deadlock with the default one provided by SkPixelRef.
21 SK_DECLARE_STATIC_MUTEX(gROLockPixelsPixelRefMutex); 22 SK_DECLARE_STATIC_MUTEX(gROLockPixelsPixelRefMutex);
22 23
23 SkROLockPixelsPixelRef::SkROLockPixelsPixelRef(const SkImageInfo& info) 24 SkROLockPixelsPixelRef::SkROLockPixelsPixelRef(const SkImageInfo& info)
24 : INHERITED(info, &gROLockPixelsPixelRefMutex) {} 25 : INHERITED(info, &gROLockPixelsPixelRefMutex) {}
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 SkSafeUnref(fSurface); 120 SkSafeUnref(fSurface);
120 } 121 }
121 122
122 GrTexture* SkGrPixelRef::getTexture() { 123 GrTexture* SkGrPixelRef::getTexture() {
123 if (fSurface) { 124 if (fSurface) {
124 return fSurface->asTexture(); 125 return fSurface->asTexture();
125 } 126 }
126 return NULL; 127 return NULL;
127 } 128 }
128 129
130 void SkGrPixelRef::onNotifyPixelsChanged() {
131 GrTexture* texture = this->getTexture();
132 if (texture) {
133 texture->texturePriv().dirtyMipMaps(true);
134 }
135 }
136
129 SkPixelRef* SkGrPixelRef::deepCopy(SkColorType dstCT, SkColorProfileType dstPT, 137 SkPixelRef* SkGrPixelRef::deepCopy(SkColorType dstCT, SkColorProfileType dstPT,
130 const SkIRect* subset) { 138 const SkIRect* subset) {
131 if (NULL == fSurface) { 139 if (NULL == fSurface) {
132 return NULL; 140 return NULL;
133 } 141 }
134 142
135 // Note that when copying a render-target-backed pixel ref, we 143 // Note that when copying a render-target-backed pixel ref, we
136 // return a texture-backed pixel ref instead. This is because 144 // return a texture-backed pixel ref instead. This is because
137 // render-target pixel refs are usually created in conjunction with 145 // render-target pixel refs are usually created in conjunction with
138 // a GrTexture owned elsewhere (e.g., SkGpuDevice), and cannot live 146 // a GrTexture owned elsewhere (e.g., SkGpuDevice), and cannot live
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 cachedBitmap.setImmutable(); 198 cachedBitmap.setImmutable();
191 //Add to the cache 199 //Add to the cache
192 SkBitmapCache::Add(this, bounds, cachedBitmap); 200 SkBitmapCache::Add(this, bounds, cachedBitmap);
193 201
194 dst->swap(cachedBitmap); 202 dst->swap(cachedBitmap);
195 } 203 }
196 204
197 return true; 205 return true;
198 206
199 } 207 }
OLDNEW
« no previous file with comments | « src/core/SkPixelRef.cpp ('k') | tests/GrTextureMipMapInvalidationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698