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

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

Issue 609863002: Don't flush on copyTexture, take 2 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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/gpu/GrContext.cpp ('k') | 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 /* 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
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 void SkROLockPixelsPixelRef::onUnlockPixels() { 46 void SkROLockPixelsPixelRef::onUnlockPixels() {
47 fBitmap.unlockPixels(); 47 fBitmap.unlockPixels();
48 } 48 }
49 49
50 bool SkROLockPixelsPixelRef::onLockPixelsAreWritable() const { 50 bool SkROLockPixelsPixelRef::onLockPixelsAreWritable() const {
51 return false; 51 return false;
52 } 52 }
53 53
54 /////////////////////////////////////////////////////////////////////////////// 54 ///////////////////////////////////////////////////////////////////////////////
55 55
56 static SkGrPixelRef* copyToTexturePixelRef(GrTexture* texture, SkColorType dstCT , 56 static SkGrPixelRef* copy_to_new_texture_pixelref(GrTexture* texture, SkColorTyp e dstCT,
57 const SkIRect* subset) { 57 const SkIRect* subset) {
58 if (NULL == texture || kUnknown_SkColorType == dstCT) { 58 if (NULL == texture || kUnknown_SkColorType == dstCT) {
59 return NULL; 59 return NULL;
60 } 60 }
61 GrContext* context = texture->getContext(); 61 GrContext* context = texture->getContext();
62 if (NULL == context) { 62 if (NULL == context) {
63 return NULL; 63 return NULL;
64 } 64 }
65 GrTextureDesc desc; 65 GrTextureDesc desc;
66 66
67 SkIPoint pointStorage; 67 SkIPoint pointStorage;
(...skipping 13 matching lines...) Expand all
81 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; 81 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit;
82 desc.fConfig = SkImageInfo2GrPixelConfig(dstCT, kPremul_SkAlphaType); 82 desc.fConfig = SkImageInfo2GrPixelConfig(dstCT, kPremul_SkAlphaType);
83 83
84 GrTexture* dst = context->createUncachedTexture(desc, NULL, 0); 84 GrTexture* dst = context->createUncachedTexture(desc, NULL, 0);
85 if (NULL == dst) { 85 if (NULL == dst) {
86 return NULL; 86 return NULL;
87 } 87 }
88 88
89 context->copyTexture(texture, dst->asRenderTarget(), topLeft); 89 context->copyTexture(texture, dst->asRenderTarget(), topLeft);
90 90
91 // TODO: figure out if this is responsible for Chrome canvas errors 91 // Blink is relying on the above copy being sent to GL immediately in the ca se when the source
92 #if 0 92 // is a WebGL canvas backing store. We could have a TODO to remove this flus h, but we have a
93 // The render texture we have created (to perform the copy) isn't fully 93 // larger TODO to remove SkGrPixelRef entirely.
94 // functional (since it doesn't have a stencil buffer). Release it here 94 context->flush();
95 // so the caller doesn't try to render to it.
96 // TODO: we can undo this release when dynamic stencil buffer attach/
97 // detach has been implemented
98 dst->releaseRenderTarget();
99 #endif
100 95
101 SkImageInfo info = SkImageInfo::Make(desc.fWidth, desc.fHeight, dstCT, kPrem ul_SkAlphaType); 96 SkImageInfo info = SkImageInfo::Make(desc.fWidth, desc.fHeight, dstCT, kPrem ul_SkAlphaType);
102 SkGrPixelRef* pixelRef = SkNEW_ARGS(SkGrPixelRef, (info, dst)); 97 SkGrPixelRef* pixelRef = SkNEW_ARGS(SkGrPixelRef, (info, dst));
103 SkSafeUnref(dst); 98 SkSafeUnref(dst);
104 return pixelRef; 99 return pixelRef;
105 } 100 }
106 101
107 /////////////////////////////////////////////////////////////////////////////// 102 ///////////////////////////////////////////////////////////////////////////////
108 103
109 SkGrPixelRef::SkGrPixelRef(const SkImageInfo& info, GrSurface* surface, 104 SkGrPixelRef::SkGrPixelRef(const SkImageInfo& info, GrSurface* surface,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 cachedBitmap.setImmutable(); 199 cachedBitmap.setImmutable();
205 //Add to the cache 200 //Add to the cache
206 SkBitmapCache::Add(this->getGenerationID(), bounds, cachedBitmap); 201 SkBitmapCache::Add(this->getGenerationID(), bounds, cachedBitmap);
207 202
208 dst->swap(cachedBitmap); 203 dst->swap(cachedBitmap);
209 } 204 }
210 205
211 return true; 206 return true;
212 207
213 } 208 }
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698