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

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

Issue 1784563002: unify peekPixels around pixmap parameter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update GrUploadPixmapToTexture to know about the new desc if readPixels was called Created 4 years, 9 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 | « include/core/SkImage.h ('k') | src/core/SkCanvas.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 2012 Google Inc. 2 * Copyright 2012 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 SkSurface_DEFINED 8 #ifndef SkSurface_DEFINED
9 #define SkSurface_DEFINED 9 #define SkSurface_DEFINED
10 10
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 * Though the caller could get a snapshot image explicitly, and draw that, 250 * Though the caller could get a snapshot image explicitly, and draw that,
251 * it seems that directly drawing a surface into another canvas might be 251 * it seems that directly drawing a surface into another canvas might be
252 * a common pattern, and that we could possibly be more efficient, since 252 * a common pattern, and that we could possibly be more efficient, since
253 * we'd know that the "snapshot" need only live until we've handed it off 253 * we'd know that the "snapshot" need only live until we've handed it off
254 * to the canvas. 254 * to the canvas.
255 */ 255 */
256 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); 256 void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*);
257 257
258 /** 258 /**
259 * If the surface has direct access to its pixels (i.e. they are in local 259 * If the surface has direct access to its pixels (i.e. they are in local
260 * RAM) return the const-address of those pixels, and if not null, return 260 * RAM) return true, and if not null, set the pixmap parameter to point to the information
261 * the ImageInfo and rowBytes. The returned address is only valid while 261 * about the surface's pixels. The pixel address in the pixmap is only vali d while
262 * the surface object is in scope, and no API call is made on the surface 262 * the surface object is in scope, and no API call is made on the surface
263 * or its canvas. 263 * or its canvas.
264 * 264 *
265 * On failure, returns NULL and the info and rowBytes parameters are 265 * On failure, returns false and the pixmap parameter is ignored.
266 * ignored.
267 */ 266 */
267 bool peekPixels(SkPixmap*);
268
269 #ifdef SK_SUPPORT_LEGACY_PEEKPIXELS_PARMS
268 const void* peekPixels(SkImageInfo* info, size_t* rowBytes); 270 const void* peekPixels(SkImageInfo* info, size_t* rowBytes);
271 #endif
269 272
270 /** 273 /**
271 * Copy the pixels from the surface into the specified buffer (pixels + row Bytes), 274 * Copy the pixels from the surface into the specified buffer (pixels + row Bytes),
272 * converting them into the requested format (dstInfo). The surface pixels are read 275 * converting them into the requested format (dstInfo). The surface pixels are read
273 * starting at the specified (srcX,srcY) location. 276 * starting at the specified (srcX,srcY) location.
274 * 277 *
275 * The specified ImageInfo and (srcX,srcY) offset specifies a source rectan gle 278 * The specified ImageInfo and (srcX,srcY) offset specifies a source rectan gle
276 * 279 *
277 * srcR.setXYWH(srcX, srcY, dstInfo.width(), dstInfo.height()); 280 * srcR.setXYWH(srcX, srcY, dstInfo.width(), dstInfo.height());
278 * 281 *
(...skipping 28 matching lines...) Expand all
307 private: 310 private:
308 const SkSurfaceProps fProps; 311 const SkSurfaceProps fProps;
309 const int fWidth; 312 const int fWidth;
310 const int fHeight; 313 const int fHeight;
311 uint32_t fGenerationID; 314 uint32_t fGenerationID;
312 315
313 typedef SkRefCnt INHERITED; 316 typedef SkRefCnt INHERITED;
314 }; 317 };
315 318
316 #endif 319 #endif
OLDNEW
« no previous file with comments | « include/core/SkImage.h ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698