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 SkSpecialImage* newImageSnapshot(); | 51 SkSpecialImage* newImageSnapshot(); |
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(const SkIRect& subset, GrTexture*, | 56 static SkSpecialSurface* NewFromTexture(SkImageFilter::Proxy* proxy, |
| 57 const SkIRect& subset, GrTexture*, |
57 const SkSurfaceProps* = nullptr); | 58 const SkSurfaceProps* = nullptr); |
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 SkSpecialSurface* NewRenderTarget(GrContext*, const GrSurfaceDesc&, | 64 static SkSpecialSurface* NewRenderTarget(SkImageFilter::Proxy* proxy, |
| 65 GrContext*, const GrSurfaceDesc&, |
64 const SkSurfaceProps* = nullptr); | 66 const SkSurfaceProps* = nullptr); |
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 SkSpecialSurface* NewFromBitmap(const SkIRect& subset, SkBitmap& bm, | 71 static SkSpecialSurface* NewFromBitmap(SkImageFilter::Proxy* proxy, |
| 72 const SkIRect& subset, SkBitmap& bm, |
70 const SkSurfaceProps* = nullptr); | 73 const SkSurfaceProps* = nullptr); |
71 | 74 |
72 /** | 75 /** |
73 * 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 |
74 * allocated. | 77 * allocated. |
75 * | 78 * |
76 * 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 |
77 * supported configuration, nullptr will be returned. | 80 * supported configuration, nullptr will be returned. |
78 */ | 81 */ |
79 static SkSpecialSurface* NewRaster(const SkImageInfo&, const SkSurfaceProps*
= nullptr); | 82 static SkSpecialSurface* NewRaster(SkImageFilter::Proxy* proxy, |
| 83 const SkImageInfo&, const SkSurfaceProps*
= nullptr); |
80 | 84 |
81 protected: | 85 protected: |
82 SkSpecialSurface(const SkIRect& subset, const SkSurfaceProps*); | 86 SkSpecialSurface(SkImageFilter::Proxy*, const SkIRect& subset, const SkSurfa
ceProps*); |
83 | 87 |
84 // For testing only | 88 // For testing only |
85 friend class TestingSpecialSurfaceAccess; | 89 friend class TestingSpecialSurfaceAccess; |
86 const SkIRect& subset() const { return fSubset; } | 90 const SkIRect& subset() const { return fSubset; } |
87 | 91 |
| 92 // TODO: remove this ASAP (see skbug.com/4965) |
| 93 SkImageFilter::Proxy* proxy() const { return fProxy; } |
| 94 |
88 private: | 95 private: |
89 const SkSurfaceProps fProps; | 96 const SkSurfaceProps fProps; |
90 const SkIRect fSubset; | 97 const SkIRect fSubset; |
91 | 98 |
| 99 // TODO: remove this ASAP (see skbug.com/4965) |
| 100 SkImageFilter::Proxy* fProxy; |
| 101 |
92 typedef SkRefCnt INHERITED; | 102 typedef SkRefCnt INHERITED; |
93 }; | 103 }; |
94 | 104 |
95 #endif | 105 #endif |
OLD | NEW |