Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/core/SkSpecialImage.h

Issue 1861643003: Upgrade SkSpecialImage to have getTextureRef & getROPixels entry points (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Really fix no-GPU build Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 static sk_sp<SkSpecialImage> internal_fromBM(SkImageFilter::Proxy*, const Sk Bitmap&); 113 static sk_sp<SkSpecialImage> internal_fromBM(SkImageFilter::Proxy*, const Sk Bitmap&);
114 SkImageFilter::Proxy* internal_getProxy() const; 114 SkImageFilter::Proxy* internal_getProxy() const;
115 115
116 // TODO: hide this when GrLayerHoister uses SkSpecialImages more fully (see skbug.com/5063) 116 // TODO: hide this when GrLayerHoister uses SkSpecialImages more fully (see skbug.com/5063)
117 /** 117 /**
118 * If the SpecialImage is backed by a gpu texture, return that texture. 118 * If the SpecialImage is backed by a gpu texture, return that texture.
119 * The active portion of the texture can be retrieved via 'subset'. 119 * The active portion of the texture can be retrieved via 'subset'.
120 */ 120 */
121 GrTexture* peekTexture() const; 121 GrTexture* peekTexture() const;
122 122
123 /**
124 * Regardless of the underlying backing store, return the contents as a GrT exture.
125 * The active portion of the texture can be retrieved via 'subset'.
126 */
127 GrTexture* asTextureRef(GrContext*) const;
128
123 // TODO: hide this whe the imagefilter all have a consistent draw path (see skbug.com/5063) 129 // TODO: hide this whe the imagefilter all have a consistent draw path (see skbug.com/5063)
124 /** 130 /**
125 * If the SpecialImage is backed by cpu pixels, return the const address 131 * Regardless of the underlying backing store, return the contents as an Sk Bitmap
126 * of those pixels and, if not null, the ImageInfo, rowBytes, and, if prese nt,
127 * the color table. The returned address(es) is/are only valid while the im age object
128 * is in scope.
129 * 132 *
130 * The returned ImageInfo represents the backing memory. Use 'subset' 133 * The returned ImageInfo represents the backing memory. Use 'subset'
131 * to get the active portion's dimensions. 134 * to get the active portion's dimensions.
132 *
133 * On failure, return false and ignore the pixmap parameter.
134 */ 135 */
135 bool peekPixels(SkPixmap*) const; 136 bool getROPixels(SkBitmap*) const;
136 137
137 protected: 138 protected:
138 SkSpecialImage(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint32_t uniqueID) 139 SkSpecialImage(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint32_t uniqueID)
139 : fSubset(subset) 140 : fSubset(subset)
140 , fUniqueID(kNeedNewImageUniqueID_SpecialImage == uniqueID ? SkNextID::I mageID() 141 , fUniqueID(kNeedNewImageUniqueID_SpecialImage == uniqueID ? SkNextID::I mageID()
141 : uniqueID) 142 : uniqueID)
142 , fProxy(proxy) { 143 , fProxy(proxy) {
143 } 144 }
144 145
145 // The following 2 are for testing and shouldn't be used. 146 // The following 2 are for testing and shouldn't be used.
146 friend class TestingSpecialImageAccess; 147 friend class TestingSpecialImageAccess;
147 friend class TestingSpecialSurfaceAccess; 148 friend class TestingSpecialSurfaceAccess;
148 149
149 // This entry point is for testing only. It does a readback from VRAM for
150 // GPU-backed special images.
151 bool testingOnlyGetROPixels(SkBitmap*) const;
152
153 // TODO: remove this ASAP (see skbug.com/4965) 150 // TODO: remove this ASAP (see skbug.com/4965)
154 SkImageFilter::Proxy* proxy() const { return fProxy; } 151 SkImageFilter::Proxy* proxy() const { return fProxy; }
155 152
156 private: 153 private:
157 const SkIRect fSubset; 154 const SkIRect fSubset;
158 const uint32_t fUniqueID; 155 const uint32_t fUniqueID;
159 156
160 // TODO: remove this ASAP (see skbug.com/4965) 157 // TODO: remove this ASAP (see skbug.com/4965)
161 SkImageFilter::Proxy* fProxy; 158 SkImageFilter::Proxy* fProxy;
162 159
163 typedef SkRefCnt INHERITED; 160 typedef SkRefCnt INHERITED;
164 }; 161 };
165 162
166 #endif 163 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698