| OLD | NEW |
| 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 "GrContextPriv.h" | 10 #include "GrContextPriv.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 case SkSurface::kFlushWrite_BackendHandleAccess: | 34 case SkSurface::kFlushWrite_BackendHandleAccess: |
| 35 case SkSurface::kDiscardWrite_BackendHandleAccess: | 35 case SkSurface::kDiscardWrite_BackendHandleAccess: |
| 36 // 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. |
| 37 surface->notifyContentWillChange(SkSurface::kRetain_ContentChangeMod
e); | 37 surface->notifyContentWillChange(SkSurface::kRetain_ContentChangeMod
e); |
| 38 break; | 38 break; |
| 39 } | 39 } |
| 40 | 40 |
| 41 // Grab the render target *after* firing notifications, as it may get switch
ed if CoW kicks in. | 41 // Grab the render target *after* firing notifications, as it may get switch
ed if CoW kicks in. |
| 42 surface->getDevice()->flush(); | 42 surface->getDevice()->flush(); |
| 43 GrRenderTargetContext* rtc = surface->getDevice()->accessRenderTargetContext
(); | 43 GrRenderTargetContext* rtc = surface->getDevice()->accessRenderTargetContext
(); |
| 44 return rtc->accessRenderTarget(); | 44 return rtc->instantiate(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 GrBackendObject SkSurface_Gpu::onGetTextureHandle(BackendHandleAccess access) { | 47 GrBackendObject SkSurface_Gpu::onGetTextureHandle(BackendHandleAccess access) { |
| 48 GrRenderTarget* rt = prepare_rt_for_external_access(this, access); | 48 GrRenderTarget* rt = prepare_rt_for_external_access(this, access); |
| 49 GrTexture* texture = rt->asTexture(); | 49 GrTexture* texture = rt->asTexture(); |
| 50 if (texture) { | 50 if (texture) { |
| 51 return texture->getTextureHandle(); | 51 return texture->getTextureHandle(); |
| 52 } | 52 } |
| 53 return 0; | 53 return 0; |
| 54 } | 54 } |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 259 |
| 260 sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(rtc), desc.fWidth, des
c.fHeight, | 260 sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(rtc), desc.fWidth, des
c.fHeight, |
| 261 SkGpuDevice::kUninit_InitContent
s)); | 261 SkGpuDevice::kUninit_InitContent
s)); |
| 262 if (!device) { | 262 if (!device) { |
| 263 return nullptr; | 263 return nullptr; |
| 264 } | 264 } |
| 265 return sk_make_sp<SkSurface_Gpu>(std::move(device)); | 265 return sk_make_sp<SkSurface_Gpu>(std::move(device)); |
| 266 } | 266 } |
| 267 | 267 |
| 268 #endif | 268 #endif |
| OLD | NEW |