OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 SkSpecialSurface_DEFINED | 8 #ifndef SkSpecialSurface_DEFINED |
9 #define SkSpecialSurface_DEFINED | 9 #define SkSpecialSurface_DEFINED |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 /** | 44 /** |
45 * Returns an image of the current state of the surface pixels up to this | 45 * Returns an image of the current state of the surface pixels up to this |
46 * point. The canvas returned by 'getCanvas' becomes invalidated by this | 46 * point. The canvas returned by 'getCanvas' becomes invalidated by this |
47 * call and no more drawing to this surface is allowed. | 47 * call and no more drawing to this surface is allowed. |
48 * | 48 * |
49 * Note: the caller inherits a ref from this call that must be balanced | 49 * Note: the caller inherits a ref from this call that must be balanced |
50 */ | 50 */ |
51 sk_sp<SkSpecialImage> makeImageSnapshot(); | 51 sk_sp<SkSpecialImage> makeImageSnapshot(); |
52 | 52 |
| 53 #if SK_SUPPORT_GPU |
53 /** | 54 /** |
54 * Use an existing (renderTarget-capable) GrTexture as the backing store. | 55 * Use an existing (renderTarget-capable) GrTexture as the backing store. |
55 */ | 56 */ |
56 static sk_sp<SkSpecialSurface> MakeFromTexture(const SkIRect& subset, GrText
ure*, | 57 static sk_sp<SkSpecialSurface> MakeFromTexture(const SkIRect& subset, sk_sp<
GrTexture>, |
57 const SkSurfaceProps* = nullp
tr); | 58 const SkSurfaceProps* = nullp
tr); |
58 | 59 |
59 /** | 60 /** |
60 * Allocate a new GPU-backed SkSpecialSurface. If the requested surface can
not | 61 * Allocate a new GPU-backed SkSpecialSurface. If the requested surface can
not |
61 * be created, nullptr will be returned. | 62 * be created, nullptr will be returned. |
62 */ | 63 */ |
63 static sk_sp<SkSpecialSurface> MakeRenderTarget(GrContext*, const GrSurfaceD
esc&, | 64 static sk_sp<SkSpecialSurface> MakeRenderTarget(GrContext*, const GrSurfaceD
esc&, |
64 const SkSurfaceProps* = null
ptr); | 65 const SkSurfaceProps* = null
ptr); |
| 66 #endif |
65 | 67 |
66 /** | 68 /** |
67 * Use and existing SkBitmap as the backing store. | 69 * Use and existing SkBitmap as the backing store. |
68 */ | 70 */ |
69 static sk_sp<SkSpecialSurface> MakeFromBitmap(const SkIRect& subset, SkBitma
p& bm, | 71 static sk_sp<SkSpecialSurface> MakeFromBitmap(const SkIRect& subset, SkBitma
p& bm, |
70 const SkSurfaceProps* = nullpt
r); | 72 const SkSurfaceProps* = nullpt
r); |
71 | 73 |
72 /** | 74 /** |
73 * Return a new CPU-backed surface, with the memory for the pixels automati
cally | 75 * Return a new CPU-backed surface, with the memory for the pixels automati
cally |
74 * allocated. | 76 * allocated. |
(...skipping 12 matching lines...) Expand all Loading... |
87 const SkIRect& subset() const { return fSubset; } | 89 const SkIRect& subset() const { return fSubset; } |
88 | 90 |
89 private: | 91 private: |
90 const SkSurfaceProps fProps; | 92 const SkSurfaceProps fProps; |
91 const SkIRect fSubset; | 93 const SkIRect fSubset; |
92 | 94 |
93 typedef SkRefCnt INHERITED; | 95 typedef SkRefCnt INHERITED; |
94 }; | 96 }; |
95 | 97 |
96 #endif | 98 #endif |
OLD | NEW |