Chromium Code Reviews| 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 "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget* target, const SkSurf aceProps* props) { | 114 SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget* target, const SkSurf aceProps* props) { |
| 115 SkAutoTUnref<SkGpuDevice> device( | 115 SkAutoTUnref<SkGpuDevice> device( |
| 116 SkGpuDevice::Create(target, props, SkGpuDevice::kUninit_InitContents)); | 116 SkGpuDevice::Create(target, props, SkGpuDevice::kUninit_InitContents)); |
| 117 if (!device) { | 117 if (!device) { |
| 118 return nullptr; | 118 return nullptr; |
| 119 } | 119 } |
| 120 return new SkSurface_Gpu(device); | 120 return new SkSurface_Gpu(device); |
| 121 } | 121 } |
| 122 | 122 |
| 123 SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, Budgeted budgeted, const S kImageInfo& info, | 123 SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, Budgeted budgeted, const S kImageInfo& info, |
| 124 int sampleCount, const SkSurfaceProps* pro ps) { | 124 int sampleCount, const SkSurfaceProps* pro ps, |
| 125 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(ctx, budgeted, info, sa mpleCount, props, | 125 GrTextureStorageAllocator customAllocator) { |
| 126 SkGpuDevice::kClear_Ini tContents)); | 126 // If the render target is being made with a custom allocator, it must be un budgeted. |
| 127 if (customAllocator.fAllocateTextureStorage && (budgeted == kYes_Budgeted)) | |
|
bsalomon
2016/02/04 16:27:08
This doesn't necessarily have to be true... kYes_B
erikchen
2016/02/04 18:44:07
Right - I've removed this logic.
| |
| 128 return nullptr; | |
| 129 | |
| 130 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create( | |
| 131 ctx, budgeted, info, sampleCount, props, SkGpuDevice::kClear_InitCon tents, | |
| 132 customAllocator)); | |
| 127 if (!device) { | 133 if (!device) { |
| 128 return nullptr; | 134 return nullptr; |
| 129 } | 135 } |
| 130 return new SkSurface_Gpu(device); | 136 return new SkSurface_Gpu(device); |
| 131 } | 137 } |
| 132 | 138 |
| 133 SkSurface* SkSurface::NewFromBackendTexture(GrContext* context, const GrBackendT extureDesc& desc, | 139 SkSurface* SkSurface::NewFromBackendTexture(GrContext* context, const GrBackendT extureDesc& desc, |
| 134 const SkSurfaceProps* props) { | 140 const SkSurfaceProps* props) { |
| 135 if (nullptr == context) { | 141 if (nullptr == context) { |
| 136 return nullptr; | 142 return nullptr; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 163 } | 169 } |
| 164 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props, | 170 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props, |
| 165 SkGpuDevice::kUninit_In itContents)); | 171 SkGpuDevice::kUninit_In itContents)); |
| 166 if (!device) { | 172 if (!device) { |
| 167 return nullptr; | 173 return nullptr; |
| 168 } | 174 } |
| 169 return new SkSurface_Gpu(device); | 175 return new SkSurface_Gpu(device); |
| 170 } | 176 } |
| 171 | 177 |
| 172 #endif | 178 #endif |
| OLD | NEW |