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 #ifndef SkSurface_DEFINED | 8 #ifndef SkSurface_DEFINED |
9 #define SkSurface_DEFINED | 9 #define SkSurface_DEFINED |
10 | 10 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 * must be set on GrBackendTextureDesc for this to succeed. Skia will not a
ssume ownership | 105 * must be set on GrBackendTextureDesc for this to succeed. Skia will not a
ssume ownership |
106 * of the texture and the client must ensure the texture is valid for the l
ifetime of the | 106 * of the texture and the client must ensure the texture is valid for the l
ifetime of the |
107 * SkSurface. | 107 * SkSurface. |
108 */ | 108 */ |
109 static sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget( | 109 static sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget( |
110 GrContext*, const GrBackendTextureDesc&, const SkSurfaceProps*); | 110 GrContext*, const GrBackendTextureDesc&, const SkSurfaceProps*); |
111 | 111 |
112 /** | 112 /** |
113 * Return a new surface whose contents will be drawn to an offscreen | 113 * Return a new surface whose contents will be drawn to an offscreen |
114 * render target, allocated by the surface. | 114 * render target, allocated by the surface. |
115 * | |
116 * The GrTextureStorageAllocator will be reused if SkImage snapshots create | |
117 * additional textures. | |
118 */ | 115 */ |
119 static sk_sp<SkSurface> MakeRenderTarget( | 116 static sk_sp<SkSurface> MakeRenderTarget( |
120 GrContext*, SkBudgeted, const SkImageInfo&, int sampleCount, const S
kSurfaceProps*, | 117 GrContext*, SkBudgeted, const SkImageInfo&, int sampleCount, const S
kSurfaceProps*); |
121 GrTextureStorageAllocator = GrTextureStorageAllocator()); | |
122 | 118 |
123 static sk_sp<SkSurface> MakeRenderTarget(GrContext* gr, SkBudgeted b, const
SkImageInfo& info) { | 119 static sk_sp<SkSurface> MakeRenderTarget(GrContext* gr, SkBudgeted b, const
SkImageInfo& info) { |
124 return MakeRenderTarget(gr, b, info, 0, nullptr); | 120 return MakeRenderTarget(gr, b, info, 0, nullptr); |
125 } | 121 } |
126 | 122 |
127 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API | 123 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API |
128 static SkSurface* NewRasterDirect(const SkImageInfo& info, void* pixels, siz
e_t rowBytes, | 124 static SkSurface* NewRasterDirect(const SkImageInfo& info, void* pixels, siz
e_t rowBytes, |
129 const SkSurfaceProps* props = NULL) { | 125 const SkSurfaceProps* props = NULL) { |
130 return MakeRasterDirect(info, pixels, rowBytes, props).release(); | 126 return MakeRasterDirect(info, pixels, rowBytes, props).release(); |
131 } | 127 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 static SkSurface* NewFromBackendRenderTarget(GrContext* ctx, const GrBackend
RenderTargetDesc& d, | 161 static SkSurface* NewFromBackendRenderTarget(GrContext* ctx, const GrBackend
RenderTargetDesc& d, |
166 const SkSurfaceProps* props) { | 162 const SkSurfaceProps* props) { |
167 return MakeFromBackendRenderTarget(ctx, d, props).release(); | 163 return MakeFromBackendRenderTarget(ctx, d, props).release(); |
168 } | 164 } |
169 static SkSurface* NewFromBackendTextureAsRenderTarget(GrContext* ctx, | 165 static SkSurface* NewFromBackendTextureAsRenderTarget(GrContext* ctx, |
170 const GrBackendTexture
Desc& desc, | 166 const GrBackendTexture
Desc& desc, |
171 const SkSurfaceProps*
props) { | 167 const SkSurfaceProps*
props) { |
172 return MakeFromBackendTextureAsRenderTarget(ctx, desc, props).release(); | 168 return MakeFromBackendTextureAsRenderTarget(ctx, desc, props).release(); |
173 } | 169 } |
174 static SkSurface* NewRenderTarget(GrContext* ctx, SkBudgeted b, const SkImag
eInfo& info, | 170 static SkSurface* NewRenderTarget(GrContext* ctx, SkBudgeted b, const SkImag
eInfo& info, |
175 int sampleCount, const SkSurfaceProps* pro
ps = NULL, | 171 int sampleCount, const SkSurfaceProps* pro
ps = NULL) { |
176 GrTextureStorageAllocator a = GrTextureSto
rageAllocator()) { | |
177 return MakeRenderTarget(ctx, b, info, sampleCount, props, a).release(); | 172 return MakeRenderTarget(ctx, b, info, sampleCount, props, a).release(); |
178 } | 173 } |
179 static SkSurface* NewRenderTarget(GrContext* gr, SkBudgeted b, const SkImage
Info& info) { | 174 static SkSurface* NewRenderTarget(GrContext* gr, SkBudgeted b, const SkImage
Info& info) { |
180 return NewRenderTarget(gr, b, info, 0); | 175 return NewRenderTarget(gr, b, info, 0); |
181 } | 176 } |
182 SkSurface* newSurface(const SkImageInfo& info) { return this->makeSurface(in
fo).release(); } | 177 SkSurface* newSurface(const SkImageInfo& info) { return this->makeSurface(in
fo).release(); } |
183 #endif | 178 #endif |
184 | 179 |
185 int width() const { return fWidth; } | 180 int width() const { return fWidth; } |
186 int height() const { return fHeight; } | 181 int height() const { return fHeight; } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 private: | 366 private: |
372 const SkSurfaceProps fProps; | 367 const SkSurfaceProps fProps; |
373 const int fWidth; | 368 const int fWidth; |
374 const int fHeight; | 369 const int fHeight; |
375 uint32_t fGenerationID; | 370 uint32_t fGenerationID; |
376 | 371 |
377 typedef SkRefCnt INHERITED; | 372 typedef SkRefCnt INHERITED; |
378 }; | 373 }; |
379 | 374 |
380 #endif | 375 #endif |
OLD | NEW |