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 SkSpecialImage_DEFINED | 8 #ifndef SkSpecialImage_DEFINED |
9 #define SkSpecialImage_DEFINED | 9 #define SkSpecialImage_DEFINED |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 /** | 65 /** |
66 * Create a new surface with a backend that is compatible with this image. | 66 * Create a new surface with a backend that is compatible with this image. |
67 */ | 67 */ |
68 SkSpecialSurface* newSurface(const SkImageInfo&) const; | 68 SkSpecialSurface* newSurface(const SkImageInfo&) const; |
69 | 69 |
70 // These three internal methods will go away (see skbug.com/4965) | 70 // These three internal methods will go away (see skbug.com/4965) |
71 bool internal_getBM(SkBitmap* result); | 71 bool internal_getBM(SkBitmap* result); |
72 static SkSpecialImage* internal_fromBM(SkImageFilter::Proxy*, const SkBitmap &); | 72 static SkSpecialImage* internal_fromBM(SkImageFilter::Proxy*, const SkBitmap &); |
73 SkImageFilter::Proxy* internal_getProxy(); | 73 SkImageFilter::Proxy* internal_getProxy(); |
74 | 74 |
75 // TODO: hide this when GrLayerHoister uses SkSpecialImages more fully | |
Stephen White
2016/03/04 15:55:05
Log a bug and reference it here?
robertphillips
2016/03/04 18:08:36
Done.
| |
76 /** | |
77 * If the SpecialImage is backed by a gpu texture, return that texture. | |
78 * The active portion of the texture can be retrieved via 'subset'. | |
79 */ | |
80 GrTexture* peekTexture() const; | |
81 | |
75 protected: | 82 protected: |
76 SkSpecialImage(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint32_t uniqueID) | 83 SkSpecialImage(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint32_t uniqueID) |
77 : fSubset(subset) | 84 : fSubset(subset) |
78 , fUniqueID(kNeedNewImageUniqueID_SpecialImage == uniqueID ? SkNextID::I mageID() | 85 , fUniqueID(kNeedNewImageUniqueID_SpecialImage == uniqueID ? SkNextID::I mageID() |
79 : uniqueID) | 86 : uniqueID) |
80 , fProxy(proxy) { | 87 , fProxy(proxy) { |
81 } | 88 } |
82 | 89 |
83 // The following 2 are for testing and shouldn't be used. | 90 // The following 2 are for testing and shouldn't be used. |
84 friend class TestingSpecialImageAccess; | 91 friend class TestingSpecialImageAccess; |
85 friend class TestingSpecialSurfaceAccess; | 92 friend class TestingSpecialSurfaceAccess; |
86 | 93 |
87 /** | 94 /** |
88 * If the SpecialImage is backed by cpu pixels, return the const address | 95 * If the SpecialImage is backed by cpu pixels, return the const address |
89 * of those pixels and, if not null, return the ImageInfo and rowBytes. | 96 * of those pixels and, if not null, return the ImageInfo and rowBytes. |
90 * The returned address is only valid while the image object is in scope. | 97 * The returned address is only valid while the image object is in scope. |
91 * | 98 * |
92 * The returned ImageInfo represents the backing memory. Use 'subset' | 99 * The returned ImageInfo represents the backing memory. Use 'subset' |
93 * to get the active portion's dimensions. | 100 * to get the active portion's dimensions. |
94 * | 101 * |
95 * On failure, return false and ignore the pixmap parameter. | 102 * On failure, return false and ignore the pixmap parameter. |
96 */ | 103 */ |
97 bool peekPixels(SkPixmap*) const; | 104 bool peekPixels(SkPixmap*) const; |
98 | 105 |
99 /** | 106 // This entry point is for testing only. It does a readback from VRAM for |
100 * If the SpecialImage is backed by a gpu texture, return that texture. | 107 // GPU-backed special images. |
101 * The active portion of the texture can be retrieved via 'subset'. | 108 bool getROPixels(SkBitmap*) const; |
Stephen White
2016/03/04 15:55:05
getROPixelsForTesting(), then?
robertphillips
2016/03/04 18:08:36
Done - went with a prefix.
| |
102 */ | |
103 GrTexture* peekTexture() const; | |
104 | 109 |
105 // TODO: remove this ASAP (see skbug.com/4965) | 110 // TODO: remove this ASAP (see skbug.com/4965) |
106 SkImageFilter::Proxy* proxy() const { return fProxy; } | 111 SkImageFilter::Proxy* proxy() const { return fProxy; } |
107 | 112 |
108 private: | 113 private: |
109 const SkIRect fSubset; | 114 const SkIRect fSubset; |
110 const uint32_t fUniqueID; | 115 const uint32_t fUniqueID; |
111 | 116 |
112 // TODO: remove this ASAP (see skbug.com/4965) | 117 // TODO: remove this ASAP (see skbug.com/4965) |
113 SkImageFilter::Proxy* fProxy; | 118 SkImageFilter::Proxy* fProxy; |
114 | 119 |
115 typedef SkRefCnt INHERITED; | 120 typedef SkRefCnt INHERITED; |
116 }; | 121 }; |
117 | 122 |
118 #endif | 123 #endif |
119 | 124 |
OLD | NEW |