| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 if (!ctx->copySurface(copy, rt)) { | 94 if (!ctx->copySurface(copy, rt)) { |
| 95 return nullptr; | 95 return nullptr; |
| 96 } | 96 } |
| 97 tex = copy; | 97 tex = copy; |
| 98 } | 98 } |
| 99 const SkImageInfo info = fDevice->imageInfo(); | 99 const SkImageInfo info = fDevice->imageInfo(); |
| 100 sk_sp<SkImage> image; | 100 sk_sp<SkImage> image; |
| 101 if (tex) { | 101 if (tex) { |
| 102 image = sk_make_sp<SkImage_Gpu>(info.width(), info.height(), kNeedNewIma
geUniqueID, | 102 image = sk_make_sp<SkImage_Gpu>(info.width(), info.height(), kNeedNewIma
geUniqueID, |
| 103 info.alphaType(), tex, budgeted); | 103 info.alphaType(), tex, sk_ref_sp(info.co
lorSpace()), |
| 104 budgeted); |
| 104 } | 105 } |
| 105 return image; | 106 return image; |
| 106 } | 107 } |
| 107 | 108 |
| 108 // Create a new render target and, if necessary, copy the contents of the old | 109 // Create a new render target and, if necessary, copy the contents of the old |
| 109 // render target into it. Note that this flushes the SkGpuDevice but | 110 // render target into it. Note that this flushes the SkGpuDevice but |
| 110 // doesn't force an OpenGL flush. | 111 // doesn't force an OpenGL flush. |
| 111 void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) { | 112 void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) { |
| 112 GrRenderTarget* rt = fDevice->accessRenderTarget(); | 113 GrRenderTarget* rt = fDevice->accessRenderTarget(); |
| 113 // are we sharing our render target with the image? Note this call should ne
ver create a new | 114 // are we sharing our render target with the image? Note this call should ne
ver create a new |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 206 } |
| 206 sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(rt), props, | 207 sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(rt), props, |
| 207 SkGpuDevice::kUninit_InitContent
s)); | 208 SkGpuDevice::kUninit_InitContent
s)); |
| 208 if (!device) { | 209 if (!device) { |
| 209 return nullptr; | 210 return nullptr; |
| 210 } | 211 } |
| 211 return sk_make_sp<SkSurface_Gpu>(std::move(device)); | 212 return sk_make_sp<SkSurface_Gpu>(std::move(device)); |
| 212 } | 213 } |
| 213 | 214 |
| 214 #endif | 215 #endif |
| OLD | NEW |