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

Side by Side Diff: src/image/SkSurface_Gpu.cpp

Issue 622663002: GrContext::copyTexture->GrContext::copySurface. Add a flush writes pixel ops flag. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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/SkGrPixelRef.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 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "SkSurface_Base.h" 8 #include "SkSurface_Base.h"
9 #include "SkImagePriv.h" 9 #include "SkImagePriv.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // are we sharing our render target with the image? 82 // are we sharing our render target with the image?
83 SkASSERT(this->getCachedImage()); 83 SkASSERT(this->getCachedImage());
84 if (rt->asTexture() == SkTextureImageGetTexture(this->getCachedImage())) { 84 if (rt->asTexture() == SkTextureImageGetTexture(this->getCachedImage())) {
85 // We call createCompatibleDevice because it uses the texture cache. Thi s isn't 85 // We call createCompatibleDevice because it uses the texture cache. Thi s isn't
86 // necessarily correct (http://skbug.com/2252), but never using the cach e causes 86 // necessarily correct (http://skbug.com/2252), but never using the cach e causes
87 // a Chromium regression. (http://crbug.com/344020) 87 // a Chromium regression. (http://crbug.com/344020)
88 SkGpuDevice* newDevice = static_cast<SkGpuDevice*>( 88 SkGpuDevice* newDevice = static_cast<SkGpuDevice*>(
89 fDevice->createCompatibleDevice(fDevice->imageInfo())); 89 fDevice->createCompatibleDevice(fDevice->imageInfo()));
90 SkAutoTUnref<SkGpuDevice> aurd(newDevice); 90 SkAutoTUnref<SkGpuDevice> aurd(newDevice);
91 if (kRetain_ContentChangeMode == mode) { 91 if (kRetain_ContentChangeMode == mode) {
92 fDevice->context()->copyTexture(rt->asTexture(), newDevice->accessRe nderTarget()); 92 fDevice->context()->copySurface(newDevice->accessRenderTarget(), rt- >asTexture());
93 } 93 }
94 SkASSERT(this->getCachedCanvas()); 94 SkASSERT(this->getCachedCanvas());
95 SkASSERT(this->getCachedCanvas()->getDevice() == fDevice); 95 SkASSERT(this->getCachedCanvas()->getDevice() == fDevice);
96 96
97 this->getCachedCanvas()->setRootDevice(newDevice); 97 this->getCachedCanvas()->setRootDevice(newDevice);
98 SkRefCnt_SafeAssign(fDevice, newDevice); 98 SkRefCnt_SafeAssign(fDevice, newDevice);
99 } else if (kDiscard_ContentChangeMode == mode) { 99 } else if (kDiscard_ContentChangeMode == mode) {
100 this->SkSurface_Gpu::onDiscard(); 100 this->SkSurface_Gpu::onDiscard();
101 } 101 }
102 } 102 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 desc.fSampleCnt = sampleCount; 149 desc.fSampleCnt = sampleCount;
150 150
151 SkAutoTUnref<GrTexture> tex(ctx->lockAndRefScratchTexture(desc, GrContext::k Exact_ScratchTexMatch)); 151 SkAutoTUnref<GrTexture> tex(ctx->lockAndRefScratchTexture(desc, GrContext::k Exact_ScratchTexMatch));
152 152
153 if (NULL == tex) { 153 if (NULL == tex) {
154 return NULL; 154 return NULL;
155 } 155 }
156 156
157 return SkNEW_ARGS(SkSurface_Gpu, (tex->asRenderTarget(), true, props, true)) ; 157 return SkNEW_ARGS(SkSurface_Gpu, (tex->asRenderTarget(), true, props, true)) ;
158 } 158 }
OLDNEW
« no previous file with comments | « src/gpu/SkGrPixelRef.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698