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

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

Issue 1216243003: Rename flushForExternalRead->flushForExternalIO and always call in SkSurface::getTextureHandle (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 5 years, 5 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/SkImage.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_Gpu.h" 8 #include "SkSurface_Gpu.h"
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 SkSurface_Gpu::~SkSurface_Gpu() { 25 SkSurface_Gpu::~SkSurface_Gpu() {
26 fDevice->unref(); 26 fDevice->unref();
27 } 27 }
28 28
29 GrBackendObject SkSurface_Gpu::onGetTextureHandle(TextureHandleAccess access) { 29 GrBackendObject SkSurface_Gpu::onGetTextureHandle(TextureHandleAccess access) {
30 GrRenderTarget* rt = fDevice->accessRenderTarget(); 30 GrRenderTarget* rt = fDevice->accessRenderTarget();
31 switch (access) { 31 switch (access) {
32 case kFlushRead_TextureHandleAccess: 32 case kFlushRead_TextureHandleAccess:
33 rt->prepareForExternalRead(); // todo: rename to prepareForExterna lAccess()
34 break; 33 break;
35 case kFlushWrite_TextureHandleAccess: 34 case kFlushWrite_TextureHandleAccess:
36 case kDiscardWrite_TextureHandleAccess: 35 case kDiscardWrite_TextureHandleAccess:
37 // for now we don't special-case on Discard, but we may in the futur e. 36 // for now we don't special-case on Discard, but we may in the futur e.
38 this->notifyContentWillChange(kRetain_ContentChangeMode); 37 this->notifyContentWillChange(kRetain_ContentChangeMode);
39 rt->flushWrites();
40 break; 38 break;
41 } 39 }
40 rt->prepareForExternalIO();
42 return rt->asTexture()->getTextureHandle(); 41 return rt->asTexture()->getTextureHandle();
43 } 42 }
44 43
45 SkCanvas* SkSurface_Gpu::onNewCanvas() { 44 SkCanvas* SkSurface_Gpu::onNewCanvas() {
46 SkCanvas::InitFlags flags = SkCanvas::kDefault_InitFlags; 45 SkCanvas::InitFlags flags = SkCanvas::kDefault_InitFlags;
47 // When we think this works... 46 // When we think this works...
48 // flags |= SkCanvas::kConservativeRasterClip_InitFlag; 47 // flags |= SkCanvas::kConservativeRasterClip_InitFlag;
49 48
50 return SkNEW_ARGS(SkCanvas, (fDevice, flags)); 49 return SkNEW_ARGS(SkCanvas, (fDevice, flags));
51 } 50 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 131 }
133 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget (), props, 132 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget (), props,
134 SkGpuDevice::kUninit_In itContents)); 133 SkGpuDevice::kUninit_In itContents));
135 if (!device) { 134 if (!device) {
136 return NULL; 135 return NULL;
137 } 136 }
138 return SkNEW_ARGS(SkSurface_Gpu, (device)); 137 return SkNEW_ARGS(SkSurface_Gpu, (device));
139 } 138 }
140 139
141 #endif 140 #endif
OLDNEW
« no previous file with comments | « src/image/SkImage.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698