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

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: Address code review comments 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
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | src/core/SkSpecialImage.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 sk_sp<SkImage> makeTightSubset(const SkIRect& subset) const; 116 sk_sp<SkImage> makeTightSubset(const SkIRect& subset) const;
117 117
118 // These three internal methods will go away (see skbug.com/4965) 118 // These three internal methods will go away (see skbug.com/4965)
119 bool internal_getBM(SkBitmap* result); 119 bool internal_getBM(SkBitmap* result);
120 static sk_sp<SkSpecialImage> internal_fromBM(SkImageFilter::Proxy*, const Sk Bitmap&, 120 static sk_sp<SkSpecialImage> internal_fromBM(SkImageFilter::Proxy*, const Sk Bitmap&,
121 const SkSurfaceProps*); 121 const SkSurfaceProps*);
122 SkImageFilter::Proxy* internal_getProxy() const; 122 SkImageFilter::Proxy* internal_getProxy() const;
123 123
124 // TODO: hide this when GrLayerHoister uses SkSpecialImages more fully (see skbug.com/5063) 124 // TODO: hide this when GrLayerHoister uses SkSpecialImages more fully (see skbug.com/5063)
125 /** 125 /**
126 * If the SpecialImage is backed by a gpu texture, return that texture. 126 * If the SpecialImage is backed by a gpu texture, return true.
127 */
128 bool isTextureBacked() const;
129
130 /**
131 * Return the GrContext if the SkSpecialImage is GrTexture-backed
132 */
133 GrContext* getContext() const;
134
135 /**
136 * Regardless of the underlying backing store, return the contents as a GrT exture.
127 * The active portion of the texture can be retrieved via 'subset'. 137 * The active portion of the texture can be retrieved via 'subset'.
128 */ 138 */
129 GrTexture* peekTexture() const; 139 GrTexture* asTextureRef(GrContext*) const;
130 140
131 // TODO: hide this whe the imagefilter all have a consistent draw path (see skbug.com/5063) 141 // TODO: hide this whe the imagefilter all have a consistent draw path (see skbug.com/5063)
132 /** 142 /**
133 * If the SpecialImage is backed by cpu pixels, return the const address 143 * Regardless of the underlying backing store, return the contents as an Sk Bitmap
134 * of those pixels and, if not null, the ImageInfo, rowBytes, and, if prese nt,
135 * the color table. The returned address(es) is/are only valid while the im age object
136 * is in scope.
137 * 144 *
138 * The returned ImageInfo represents the backing memory. Use 'subset' 145 * The returned ImageInfo represents the backing memory. Use 'subset'
139 * to get the active portion's dimensions. 146 * to get the active portion's dimensions.
140 *
141 * On failure, return false and ignore the pixmap parameter.
142 */ 147 */
143 bool peekPixels(SkPixmap*) const; 148 bool getROPixels(SkBitmap*) const;
144 149
145 protected: 150 protected:
146 SkSpecialImage(SkImageFilter::Proxy*, const SkIRect& subset, uint32_t unique ID, 151 SkSpecialImage(SkImageFilter::Proxy*, const SkIRect& subset, uint32_t unique ID,
147 const SkSurfaceProps*); 152 const SkSurfaceProps*);
148 153
149 // The following 2 are for testing and shouldn't be used. 154 // The following 2 are for testing and shouldn't be used.
150 friend class TestingSpecialImageAccess; 155 friend class TestingSpecialImageAccess;
151 friend class TestingSpecialSurfaceAccess; 156 friend class TestingSpecialSurfaceAccess;
152 157
153 // This entry point is for testing only. It does a readback from VRAM for
154 // GPU-backed special images.
155 bool testingOnlyGetROPixels(SkBitmap*) const;
156
157 // TODO: remove this ASAP (see skbug.com/4965) 158 // TODO: remove this ASAP (see skbug.com/4965)
158 SkImageFilter::Proxy* proxy() const { return fProxy; } 159 SkImageFilter::Proxy* proxy() const { return fProxy; }
159 160
160 private: 161 private:
161 const SkSurfaceProps fProps; 162 const SkSurfaceProps fProps;
162 const SkIRect fSubset; 163 const SkIRect fSubset;
163 const uint32_t fUniqueID; 164 const uint32_t fUniqueID;
164 165
165 // TODO: remove this ASAP (see skbug.com/4965) 166 // TODO: remove this ASAP (see skbug.com/4965)
166 SkImageFilter::Proxy* fProxy; 167 SkImageFilter::Proxy* fProxy;
167 168
168 typedef SkRefCnt INHERITED; 169 typedef SkRefCnt INHERITED;
169 }; 170 };
170 171
171 #endif 172 #endif
OLDNEW
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | src/core/SkSpecialImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698