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 30 matching lines...) Expand all Loading... |
41 */ | 41 */ |
42 SkCanvas* getCanvas(); | 42 SkCanvas* getCanvas(); |
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 SkSpecialImage* newImageSnapshot(); | 51 sk_sp<SkSpecialImage> makeImageSnapshot(); |
52 | 52 |
53 /** | 53 /** |
54 * Use an existing (renderTarget-capable) GrTexture as the backing store. | 54 * Use an existing (renderTarget-capable) GrTexture as the backing store. |
55 */ | 55 */ |
56 static SkSpecialSurface* NewFromTexture(SkImageFilter::Proxy* proxy, | 56 static sk_sp<SkSpecialSurface> MakeFromTexture(SkImageFilter::Proxy* proxy, |
57 const SkIRect& subset, GrTexture*, | 57 const SkIRect& subset, GrText
ure*, |
58 const SkSurfaceProps* = nullptr); | 58 const SkSurfaceProps* = nullp
tr); |
59 | 59 |
60 /** | 60 /** |
61 * 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 |
62 * be created, nullptr will be returned. | 62 * be created, nullptr will be returned. |
63 */ | 63 */ |
64 static SkSpecialSurface* NewRenderTarget(SkImageFilter::Proxy* proxy, | 64 static sk_sp<SkSpecialSurface> MakeRenderTarget(SkImageFilter::Proxy* proxy, |
65 GrContext*, const GrSurfaceDesc&, | 65 GrContext*, const GrSurfaceD
esc&, |
66 const SkSurfaceProps* = nullptr); | 66 const SkSurfaceProps* = null
ptr); |
67 | 67 |
68 /** | 68 /** |
69 * Use and existing SkBitmap as the backing store. | 69 * Use and existing SkBitmap as the backing store. |
70 */ | 70 */ |
71 static SkSpecialSurface* NewFromBitmap(SkImageFilter::Proxy* proxy, | 71 static sk_sp<SkSpecialSurface> MakeFromBitmap(SkImageFilter::Proxy* proxy, |
72 const SkIRect& subset, SkBitmap& bm, | 72 const SkIRect& subset, SkBitma
p& bm, |
73 const SkSurfaceProps* = nullptr); | 73 const SkSurfaceProps* = nullpt
r); |
74 | 74 |
75 /** | 75 /** |
76 * Return a new CPU-backed surface, with the memory for the pixels automati
cally | 76 * Return a new CPU-backed surface, with the memory for the pixels automati
cally |
77 * allocated. | 77 * allocated. |
78 * | 78 * |
79 * If the requested surface cannot be created, or the request is not a | 79 * If the requested surface cannot be created, or the request is not a |
80 * supported configuration, nullptr will be returned. | 80 * supported configuration, nullptr will be returned. |
81 */ | 81 */ |
82 static SkSpecialSurface* NewRaster(SkImageFilter::Proxy* proxy, | 82 static sk_sp<SkSpecialSurface> MakeRaster(SkImageFilter::Proxy* proxy, |
83 const SkImageInfo&, const SkSurfaceProps*
= nullptr); | 83 const SkImageInfo&, |
| 84 const SkSurfaceProps* = nullptr); |
84 | 85 |
85 protected: | 86 protected: |
86 SkSpecialSurface(SkImageFilter::Proxy*, const SkIRect& subset, const SkSurfa
ceProps*); | 87 SkSpecialSurface(SkImageFilter::Proxy*, const SkIRect& subset, const SkSurfa
ceProps*); |
87 | 88 |
88 // For testing only | 89 // For testing only |
89 friend class TestingSpecialSurfaceAccess; | 90 friend class TestingSpecialSurfaceAccess; |
90 const SkIRect& subset() const { return fSubset; } | 91 const SkIRect& subset() const { return fSubset; } |
91 | 92 |
92 // TODO: remove this ASAP (see skbug.com/4965) | 93 // TODO: remove this ASAP (see skbug.com/4965) |
93 SkImageFilter::Proxy* proxy() const { return fProxy; } | 94 SkImageFilter::Proxy* proxy() const { return fProxy; } |
94 | 95 |
95 private: | 96 private: |
96 const SkSurfaceProps fProps; | 97 const SkSurfaceProps fProps; |
97 const SkIRect fSubset; | 98 const SkIRect fSubset; |
98 | 99 |
99 // TODO: remove this ASAP (see skbug.com/4965) | 100 // TODO: remove this ASAP (see skbug.com/4965) |
100 SkImageFilter::Proxy* fProxy; | 101 SkImageFilter::Proxy* fProxy; |
101 | 102 |
102 typedef SkRefCnt INHERITED; | 103 typedef SkRefCnt INHERITED; |
103 }; | 104 }; |
104 | 105 |
105 #endif | 106 #endif |
OLD | NEW |