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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 void SkSurface_Gpu::onDiscard() { | 79 void SkSurface_Gpu::onDiscard() { |
80 fDevice->accessRenderTarget()->discard(); | 80 fDevice->accessRenderTarget()->discard(); |
81 } | 81 } |
82 | 82 |
83 /////////////////////////////////////////////////////////////////////////////// | 83 /////////////////////////////////////////////////////////////////////////////// |
84 | 84 |
85 SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget* target, const SkSurf
aceProps* props) { | 85 SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget* target, const SkSurf
aceProps* props) { |
86 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(target, props)); | 86 SkAutoTUnref<SkGpuDevice> device( |
| 87 SkGpuDevice::Create(target, props, SkGpuDevice::kUninit_InitContents)); |
87 if (!device) { | 88 if (!device) { |
88 return NULL; | 89 return NULL; |
89 } | 90 } |
90 return SkNEW_ARGS(SkSurface_Gpu, (device)); | 91 return SkNEW_ARGS(SkSurface_Gpu, (device)); |
91 } | 92 } |
92 | 93 |
93 SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, Budgeted budgeted, const S
kImageInfo& info, | 94 SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, Budgeted budgeted, const S
kImageInfo& info, |
94 int sampleCount, const SkSurfaceProps* pro
ps) { | 95 int sampleCount, const SkSurfaceProps* pro
ps) { |
95 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(ctx, budgeted, info, sa
mpleCount, props, | 96 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(ctx, budgeted, info, sa
mpleCount, props, |
96 SkGpuDevice::kNeedClear
_Flag)); | 97 SkGpuDevice::kClear_Ini
tContents)); |
97 if (!device) { | 98 if (!device) { |
98 return NULL; | 99 return NULL; |
99 } | 100 } |
100 return SkNEW_ARGS(SkSurface_Gpu, (device)); | 101 return SkNEW_ARGS(SkSurface_Gpu, (device)); |
101 } | 102 } |
102 | 103 |
103 SkSurface* SkSurface::NewWrappedRenderTarget(GrContext* context, GrBackendTextur
eDesc desc, | 104 SkSurface* SkSurface::NewWrappedRenderTarget(GrContext* context, GrBackendTextur
eDesc desc, |
104 const SkSurfaceProps* props) { | 105 const SkSurfaceProps* props) { |
105 if (NULL == context) { | 106 if (NULL == context) { |
106 return NULL; | 107 return NULL; |
107 } | 108 } |
108 if (!SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) { | 109 if (!SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) { |
109 return NULL; | 110 return NULL; |
110 } | 111 } |
111 SkAutoTUnref<GrSurface> surface(context->textureProvider()->wrapBackendTextu
re(desc, | 112 SkAutoTUnref<GrSurface> surface(context->textureProvider()->wrapBackendTextu
re(desc, |
112 kBorrow_GrWrapOwnership)); | 113 kBorrow_GrWrapOwnership)); |
113 if (!surface) { | 114 if (!surface) { |
114 return NULL; | 115 return NULL; |
115 } | 116 } |
116 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget
(), props)); | 117 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget
(), props, |
| 118 SkGpuDevice::kUninit_In
itContents)); |
117 if (!device) { | 119 if (!device) { |
118 return NULL; | 120 return NULL; |
119 } | 121 } |
120 return SkNEW_ARGS(SkSurface_Gpu, (device)); | 122 return SkNEW_ARGS(SkSurface_Gpu, (device)); |
121 } | 123 } |
122 | 124 |
123 #endif | 125 #endif |
OLD | NEW |