| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 100 } |
| 101 | 101 |
| 102 SkSurface* SkSurface::NewWrappedRenderTarget(GrContext* context, GrBackendTextur
eDesc desc, | 102 SkSurface* SkSurface::NewWrappedRenderTarget(GrContext* context, GrBackendTextur
eDesc desc, |
| 103 const SkSurfaceProps* props) { | 103 const SkSurfaceProps* props) { |
| 104 if (NULL == context) { | 104 if (NULL == context) { |
| 105 return NULL; | 105 return NULL; |
| 106 } | 106 } |
| 107 if (!SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) { | 107 if (!SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) { |
| 108 return NULL; | 108 return NULL; |
| 109 } | 109 } |
| 110 SkAutoTUnref<GrSurface> surface(context->wrapBackendTexture(desc)); | 110 SkAutoTUnref<GrSurface> surface(context->textureProvider()->wrapBackendTextu
re(desc)); |
| 111 if (!surface) { | 111 if (!surface) { |
| 112 return NULL; | 112 return NULL; |
| 113 } | 113 } |
| 114 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget
(), props, | 114 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget
(), props, |
| 115 SkGpuDevice::kNeedClear
_Flag)); | 115 SkGpuDevice::kNeedClear
_Flag)); |
| 116 if (!device) { | 116 if (!device) { |
| 117 return NULL; | 117 return NULL; |
| 118 } | 118 } |
| 119 return SkNEW_ARGS(SkSurface_Gpu, (device)); | 119 return SkNEW_ARGS(SkSurface_Gpu, (device)); |
| 120 } | 120 } |
| 121 | 121 |
| 122 #endif | 122 #endif |
| OLD | NEW |