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