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

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

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage Created 4 years, 9 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/image/SkSurface_Base.h ('k') | src/image/SkSurface_Raster.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 * 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_Gpu.h" 8 #include "SkSurface_Gpu.h"
9 9
10 #include "GrResourceProvider.h" 10 #include "GrResourceProvider.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return image; 107 return image;
108 } 108 }
109 109
110 // Create a new render target and, if necessary, copy the contents of the old 110 // Create a new render target and, if necessary, copy the contents of the old
111 // render target into it. Note that this flushes the SkGpuDevice but 111 // render target into it. Note that this flushes the SkGpuDevice but
112 // doesn't force an OpenGL flush. 112 // doesn't force an OpenGL flush.
113 void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) { 113 void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) {
114 GrRenderTarget* rt = fDevice->accessRenderTarget(); 114 GrRenderTarget* rt = fDevice->accessRenderTarget();
115 // are we sharing our render target with the image? Note this call should ne ver create a new 115 // are we sharing our render target with the image? Note this call should ne ver create a new
116 // image because onCopyOnWrite is only called when there is a cached image. 116 // image because onCopyOnWrite is only called when there is a cached image.
117 SkAutoTUnref<SkImage> image(this->refCachedImage(SkBudgeted::kNo, kNo_ForceU nique)); 117 sk_sp<SkImage> image(this->refCachedImage(SkBudgeted::kNo, kNo_ForceUnique)) ;
118 SkASSERT(image); 118 SkASSERT(image);
119 if (rt->asTexture() == as_IB(image)->peekTexture()) { 119 if (rt->asTexture() == as_IB(image)->peekTexture()) {
120 this->fDevice->replaceRenderTarget(SkSurface::kRetain_ContentChangeMode == mode); 120 this->fDevice->replaceRenderTarget(SkSurface::kRetain_ContentChangeMode == mode);
121 SkTextureImageApplyBudgetedDecision(image); 121 SkTextureImageApplyBudgetedDecision(image.get());
122 } else if (kDiscard_ContentChangeMode == mode) { 122 } else if (kDiscard_ContentChangeMode == mode) {
123 this->SkSurface_Gpu::onDiscard(); 123 this->SkSurface_Gpu::onDiscard();
124 } 124 }
125 } 125 }
126 126
127 void SkSurface_Gpu::onDiscard() { 127 void SkSurface_Gpu::onDiscard() {
128 fDevice->accessRenderTarget()->discard(); 128 fDevice->accessRenderTarget()->discard();
129 } 129 }
130 130
131 void SkSurface_Gpu::onPrepareForExternalIO() { 131 void SkSurface_Gpu::onPrepareForExternalIO() {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 } 207 }
208 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props, 208 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props,
209 SkGpuDevice::kUninit_In itContents)); 209 SkGpuDevice::kUninit_In itContents));
210 if (!device) { 210 if (!device) {
211 return nullptr; 211 return nullptr;
212 } 212 }
213 return new SkSurface_Gpu(device); 213 return new SkSurface_Gpu(device);
214 } 214 }
215 215
216 #endif 216 #endif
OLDNEW
« no previous file with comments | « src/image/SkSurface_Base.h ('k') | src/image/SkSurface_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698