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

Side by Side Diff: include/core/SkPixelRef.h

Issue 23591030: start to remove lockPixels from bitmapshader (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkBitmapProcShader.cpp » ('j') | src/core/SkBitmapProcShader.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkPixelRef_DEFINED 10 #ifndef SkPixelRef_DEFINED
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 * return a ref to its data. If the pixelRef 134 * return a ref to its data. If the pixelRef
135 * is uncompressed or otherwise does not have this form, return NULL. 135 * is uncompressed or otherwise does not have this form, return NULL.
136 * 136 *
137 * If non-null is returned, the caller is responsible for calling unref() 137 * If non-null is returned, the caller is responsible for calling unref()
138 * on the data when it is finished. 138 * on the data when it is finished.
139 */ 139 */
140 SkData* refEncodedData() { 140 SkData* refEncodedData() {
141 return this->onRefEncodedData(); 141 return this->onRefEncodedData();
142 } 142 }
143 143
144 /**
145 * Return a decoded instance of this pixelRef in bitmap. If this cannot be
146 * done, return false and ignore bitmap.
147 * pow2 is the requeste power-of-two downscale that the caller needs. This
148 * can be ignored, and the "original" size can be returned, but if the
149 * underlying codec can efficiently return a smaller size, that should be
150 * done.
151 * If this returns true, then bitmap must be "locked" and point to the
152 * pixels for this pixelref.
153 */
154 bool decodeInto(int pow2, SkBitmap* bitmap) {
155 SkASSERT(pow2 >= 0);
156 return this->onDecodeInto(pow2, bitmap);
157 }
158
144 /** Are we really wrapping a texture instead of a bitmap? 159 /** Are we really wrapping a texture instead of a bitmap?
145 */ 160 */
146 virtual GrTexture* getTexture() { return NULL; } 161 virtual GrTexture* getTexture() { return NULL; }
147 162
148 bool readPixels(SkBitmap* dst, const SkIRect* subset = NULL); 163 bool readPixels(SkBitmap* dst, const SkIRect* subset = NULL);
149 164
150 /** 165 /**
151 * Makes a deep copy of this PixelRef, respecting the requested config. 166 * Makes a deep copy of this PixelRef, respecting the requested config.
152 * @param config Desired config. 167 * @param config Desired config.
153 * @param subset Subset of this PixelRef to copy. Must be fully contained w ithin the bounds of 168 * @param subset Subset of this PixelRef to copy. Must be fully contained w ithin the bounds of
(...skipping 29 matching lines...) Expand all
183 virtual void* onLockPixels(SkColorTable**) = 0; 198 virtual void* onLockPixels(SkColorTable**) = 0;
184 /** Called when the lock count goes from 1 to 0. The caller will have 199 /** Called when the lock count goes from 1 to 0. The caller will have
185 already acquire a mutex for thread safety, so this method need not do 200 already acquire a mutex for thread safety, so this method need not do
186 that. 201 that.
187 */ 202 */
188 virtual void onUnlockPixels() = 0; 203 virtual void onUnlockPixels() = 0;
189 204
190 /** Default impl returns true */ 205 /** Default impl returns true */
191 virtual bool onLockPixelsAreWritable() const; 206 virtual bool onLockPixelsAreWritable() const;
192 207
208 virtual bool onDecodeInto(int pow2, SkBitmap* bitmap);
209
193 /** 210 /**
194 * For pixelrefs that don't have access to their raw pixels, they may be 211 * For pixelrefs that don't have access to their raw pixels, they may be
195 * able to make a copy of them (e.g. if the pixels are on the GPU). 212 * able to make a copy of them (e.g. if the pixels are on the GPU).
196 * 213 *
197 * The base class implementation returns false; 214 * The base class implementation returns false;
198 */ 215 */
199 virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subsetOrNull); 216 virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subsetOrNull);
200 217
201 // default impl returns NULL. 218 // default impl returns NULL.
202 virtual SkData* onRefEncodedData(); 219 virtual SkData* onRefEncodedData();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 bool fIsImmutable; 251 bool fIsImmutable;
235 // only ever set in constructor, const after that 252 // only ever set in constructor, const after that
236 bool fPreLocked; 253 bool fPreLocked;
237 254
238 void setMutex(SkBaseMutex* mutex); 255 void setMutex(SkBaseMutex* mutex);
239 256
240 typedef SkFlattenable INHERITED; 257 typedef SkFlattenable INHERITED;
241 }; 258 };
242 259
243 #endif 260 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkBitmapProcShader.cpp » ('j') | src/core/SkBitmapProcShader.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698