| 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 "GrResourceProvider.h" | 10 #include "GrResourceProvider.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 static GrRenderTarget* prepare_rt_for_external_access(SkSurface_Gpu* surface, | 28 static GrRenderTarget* prepare_rt_for_external_access(SkSurface_Gpu* surface, |
| 29 SkSurface::BackendHandleAc
cess access) { | 29 SkSurface::BackendHandleAc
cess access) { |
| 30 switch (access) { | 30 switch (access) { |
| 31 case SkSurface::kFlushRead_BackendHandleAccess: | 31 case SkSurface::kFlushRead_BackendHandleAccess: |
| 32 break; | 32 break; |
| 33 case SkSurface::kFlushWrite_BackendHandleAccess: | 33 case SkSurface::kFlushWrite_BackendHandleAccess: |
| 34 case SkSurface::kDiscardWrite_BackendHandleAccess: | 34 case SkSurface::kDiscardWrite_BackendHandleAccess: |
| 35 // for now we don't special-case on Discard, but we may in the futur
e. | 35 // for now we don't special-case on Discard, but we may in the futur
e. |
| 36 surface->notifyContentWillChange(SkSurface::kRetain_ContentChangeMod
e); | 36 surface->notifyContentWillChange(SkSurface::kRetain_ContentChangeMod
e); |
| 37 // legacy: need to dirty the bitmap's genID in our device (curse it) | |
| 38 surface->getDevice()->accessBitmap(false).notifyPixelsChanged(); | |
| 39 break; | 37 break; |
| 40 } | 38 } |
| 41 | 39 |
| 42 // Grab the render target *after* firing notifications, as it may get switch
ed if CoW kicks in. | 40 // Grab the render target *after* firing notifications, as it may get switch
ed if CoW kicks in. |
| 43 surface->getDevice()->flush(); | 41 surface->getDevice()->flush(); |
| 44 GrDrawContext* dc = surface->getDevice()->accessDrawContext(); | 42 GrDrawContext* dc = surface->getDevice()->accessDrawContext(); |
| 45 return dc->accessRenderTarget(); | 43 return dc->accessRenderTarget(); |
| 46 } | 44 } |
| 47 | 45 |
| 48 GrBackendObject SkSurface_Gpu::onGetTextureHandle(BackendHandleAccess access) { | 46 GrBackendObject SkSurface_Gpu::onGetTextureHandle(BackendHandleAccess access) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 } | 204 } |
| 207 sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(rt), props, | 205 sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(rt), props, |
| 208 SkGpuDevice::kUninit_InitContent
s)); | 206 SkGpuDevice::kUninit_InitContent
s)); |
| 209 if (!device) { | 207 if (!device) { |
| 210 return nullptr; | 208 return nullptr; |
| 211 } | 209 } |
| 212 return sk_make_sp<SkSurface_Gpu>(std::move(device)); | 210 return sk_make_sp<SkSurface_Gpu>(std::move(device)); |
| 213 } | 211 } |
| 214 | 212 |
| 215 #endif | 213 #endif |
| OLD | NEW |