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

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

Issue 1162203005: clarify that accessPixels is for write-access, and peekPixels is RO (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | src/core/SkBitmapDevice.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 2010 The Android Open Source Project 2 * Copyright 2010 The Android Open Source Project
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 SkDevice_DEFINED 8 #ifndef SkDevice_DEFINED
9 #define SkDevice_DEFINED 9 #define SkDevice_DEFINED
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 /** Return the bitmap associated with this device. Call this each time you n eed 75 /** Return the bitmap associated with this device. Call this each time you n eed
76 to access the bitmap, as it notifies the subclass to perform any flushin g 76 to access the bitmap, as it notifies the subclass to perform any flushin g
77 etc. before you examine the pixels. 77 etc. before you examine the pixels.
78 @param changePixels set to true if the caller plans to change the pixels 78 @param changePixels set to true if the caller plans to change the pixels
79 @return the device's bitmap 79 @return the device's bitmap
80 */ 80 */
81 const SkBitmap& accessBitmap(bool changePixels); 81 const SkBitmap& accessBitmap(bool changePixels);
82 82
83 bool writePixels(const SkImageInfo&, const void*, size_t rowBytes, int x, in t y); 83 bool writePixels(const SkImageInfo&, const void*, size_t rowBytes, int x, in t y);
84 84
85 /**
86 * Try to get write-access to the pixels behind the device. If successful, this returns true
87 * and fills-out the pixmap parameter. On success it also bumps the genID o f the underlying
88 * bitmap.
89 *
90 * On failure, returns false and ignores the pixmap parameter.
91 */
85 bool accessPixels(SkPixmap* pmap); 92 bool accessPixels(SkPixmap* pmap);
86 93
87 /** 94 /**
95 * Try to get read-only-access to the pixels behind the device. If successf ul, this returns
96 * true and fills-out the pixmap parameter.
97 *
98 * On failure, returns false and ignores the pixmap parameter.
99 */
100 bool peekPixels(SkPixmap*);
101
102 /**
88 * Return the device's associated gpu render target, or NULL. 103 * Return the device's associated gpu render target, or NULL.
89 */ 104 */
90 virtual GrRenderTarget* accessRenderTarget() { return NULL; } 105 virtual GrRenderTarget* accessRenderTarget() { return NULL; }
91 106
92 107
93 /** 108 /**
94 * Return the device's origin: its offset in device coordinates from 109 * Return the device's origin: its offset in device coordinates from
95 * the default origin in its canvas' matrix/clip 110 * the default origin in its canvas' matrix/clip
96 */ 111 */
97 const SkIPoint& getOrigin() const { return fOrigin; } 112 const SkIPoint& getOrigin() const { return fOrigin; }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 /** The SkDevice passed will be an SkDevice which was returned by a call to 249 /** The SkDevice passed will be an SkDevice which was returned by a call to
235 onCreateDevice on this device with kNeverTile_TileExpectation. 250 onCreateDevice on this device with kNeverTile_TileExpectation.
236 */ 251 */
237 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, 252 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
238 const SkPaint&) = 0; 253 const SkPaint&) = 0;
239 254
240 virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len, con st SkPath&, 255 virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len, con st SkPath&,
241 const SkMatrix*, const SkPaint&); 256 const SkMatrix*, const SkPaint&);
242 257
243 bool readPixels(const SkImageInfo&, void* dst, size_t rowBytes, int x, int y ); 258 bool readPixels(const SkImageInfo&, void* dst, size_t rowBytes, int x, int y );
244 bool peekPixels(SkPixmap*);
245 259
246 /////////////////////////////////////////////////////////////////////////// 260 ///////////////////////////////////////////////////////////////////////////
247 261
248 /** Update as needed the pixel value in the bitmap, so that the caller can 262 /** Update as needed the pixel value in the bitmap, so that the caller can
249 access the pixels directly. 263 access the pixels directly.
250 @return The device contents as a bitmap 264 @return The device contents as a bitmap
251 */ 265 */
252 virtual const SkBitmap& onAccessBitmap() = 0; 266 virtual const SkBitmap& onAccessBitmap() = 0;
253 267
254 /** 268 /**
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 SkDeviceProperties* fLeakyProperties; // will always exist. 402 SkDeviceProperties* fLeakyProperties; // will always exist.
389 403
390 #ifdef SK_DEBUG 404 #ifdef SK_DEBUG
391 bool fAttachedToCanvas; 405 bool fAttachedToCanvas;
392 #endif 406 #endif
393 407
394 typedef SkRefCnt INHERITED; 408 typedef SkRefCnt INHERITED;
395 }; 409 };
396 410
397 #endif 411 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698