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

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

Issue 246023008: Deprecate SaveFlags use in the public SkCanvas API. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Disable deprecation warnings for skia_android_framework. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « gyp/common_conditions.gypi ('k') | include/core/SkPostConfig.h » ('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 2006 The Android Open Source Project 2 * Copyright 2006 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 SkCanvas_DEFINED 8 #ifndef SkCanvas_DEFINED
9 #define SkCanvas_DEFINED 9 #define SkCanvas_DEFINED
10 10
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 #endif 323 #endif
324 kARGB_ClipLayer_SaveFlag = 0x1F 324 kARGB_ClipLayer_SaveFlag = 0x1F
325 }; 325 };
326 326
327 /** This call saves the current matrix, clip, and drawFilter, and pushes a 327 /** This call saves the current matrix, clip, and drawFilter, and pushes a
328 copy onto a private stack. Subsequent calls to translate, scale, 328 copy onto a private stack. Subsequent calls to translate, scale,
329 rotate, skew, concat or clipRect, clipPath, and setDrawFilter all 329 rotate, skew, concat or clipRect, clipPath, and setDrawFilter all
330 operate on this copy. 330 operate on this copy.
331 When the balancing call to restore() is made, the previous matrix, clip, 331 When the balancing call to restore() is made, the previous matrix, clip,
332 and drawFilter are restored. 332 and drawFilter are restored.
333
334 @return The value to pass to restoreToCount() to balance this save()
335 */
336 int save();
337
338 /** DEPRECATED - use save() instead.
339
340 This behaves the same as save(), but it allows fine-grained control of
341 which state bits to be saved (and subsequently restored).
342
333 @param flags The flags govern what portion of the Matrix/Clip/drawFilter 343 @param flags The flags govern what portion of the Matrix/Clip/drawFilter
334 state the save (and matching restore) effect. For example, 344 state the save (and matching restore) effect. For example,
335 if only kMatrix is specified, then only the matrix state 345 if only kMatrix is specified, then only the matrix state
336 will be pushed and popped. Likewise for the clip if kClip 346 will be pushed and popped. Likewise for the clip if kClip
337 is specified. However, the drawFilter is always affected 347 is specified. However, the drawFilter is always affected
338 by calls to save/restore. 348 by calls to save/restore.
339 @return The value to pass to restoreToCount() to balance this save() 349 @return The value to pass to restoreToCount() to balance this save()
340 */ 350 */
341 int save(SaveFlags flags = kMatrixClip_SaveFlag); 351 SK_ATTR_EXTERNALLY_DEPRECATED("SaveFlags use is deprecated")
352 int save(SaveFlags flags);
342 353
343 /** This behaves the same as save(), but in addition it allocates an 354 /** This behaves the same as save(), but in addition it allocates an
344 offscreen bitmap. All drawing calls are directed there, and only when 355 offscreen bitmap. All drawing calls are directed there, and only when
345 the balancing call to restore() is made is that offscreen transfered to 356 the balancing call to restore() is made is that offscreen transfered to
346 the canvas (or the previous layer). 357 the canvas (or the previous layer).
347 @param bounds (may be null) This rect, if non-null, is used as a hint to 358 @param bounds (may be null) This rect, if non-null, is used as a hint to
348 limit the size of the offscreen, and thus drawing may be 359 limit the size of the offscreen, and thus drawing may be
349 clipped to it, though that clipping is not guaranteed to 360 clipped to it, though that clipping is not guaranteed to
350 happen. If exact clipping is desired, use clipRect(). 361 happen. If exact clipping is desired, use clipRect().
351 @param paint (may be null) This is copied, and is applied to the 362 @param paint (may be null) This is copied, and is applied to the
352 offscreen when restore() is called 363 offscreen when restore() is called
364 @return The value to pass to restoreToCount() to balance this save()
365 */
366 int saveLayer(const SkRect* bounds, const SkPaint* paint);
367
368 /** DEPRECATED - use saveLayer(const SkRect*, const SkPaint*) instead.
369
370 This behaves the same as saveLayer(const SkRect*, const SkPaint*),
371 but it allows fine-grained control of which state bits to be saved
372 (and subsequently restored).
373
374 @param bounds (may be null) This rect, if non-null, is used as a hint to
375 limit the size of the offscreen, and thus drawing may be
376 clipped to it, though that clipping is not guaranteed to
377 happen. If exact clipping is desired, use clipRect().
378 @param paint (may be null) This is copied, and is applied to the
379 offscreen when restore() is called
353 @param flags LayerFlags 380 @param flags LayerFlags
354 @return The value to pass to restoreToCount() to balance this save() 381 @return The value to pass to restoreToCount() to balance this save()
355 */ 382 */
356 int saveLayer(const SkRect* bounds, const SkPaint* paint, 383 SK_ATTR_EXTERNALLY_DEPRECATED("SaveFlags use is deprecated")
357 SaveFlags flags = kARGB_ClipLayer_SaveFlag); 384 int saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags);
358 385
359 /** This behaves the same as save(), but in addition it allocates an 386 /** This behaves the same as save(), but in addition it allocates an
360 offscreen bitmap. All drawing calls are directed there, and only when 387 offscreen bitmap. All drawing calls are directed there, and only when
361 the balancing call to restore() is made is that offscreen transfered to 388 the balancing call to restore() is made is that offscreen transfered to
362 the canvas (or the previous layer). 389 the canvas (or the previous layer).
363 @param bounds (may be null) This rect, if non-null, is used as a hint to 390 @param bounds (may be null) This rect, if non-null, is used as a hint to
364 limit the size of the offscreen, and thus drawing may be 391 limit the size of the offscreen, and thus drawing may be
365 clipped to it, though that clipping is not guaranteed to 392 clipped to it, though that clipping is not guaranteed to
366 happen. If exact clipping is desired, use clipRect(). 393 happen. If exact clipping is desired, use clipRect().
367 @param alpha This is applied to the offscreen when restore() is called. 394 @param alpha This is applied to the offscreen when restore() is called.
395 @return The value to pass to restoreToCount() to balance this save()
396 */
397 int saveLayerAlpha(const SkRect* bounds, U8CPU alpha);
398
399 /** DEPRECATED - use saveLayerAlpha(const SkRect*, U8CPU) instead.
400
401 This behaves the same as saveLayerAlpha(const SkRect*, U8CPU),
402 but it allows fine-grained control of which state bits to be saved
403 (and subsequently restored).
404
405 @param bounds (may be null) This rect, if non-null, is used as a hint to
406 limit the size of the offscreen, and thus drawing may be
407 clipped to it, though that clipping is not guaranteed to
408 happen. If exact clipping is desired, use clipRect().
409 @param alpha This is applied to the offscreen when restore() is called.
368 @param flags LayerFlags 410 @param flags LayerFlags
369 @return The value to pass to restoreToCount() to balance this save() 411 @return The value to pass to restoreToCount() to balance this save()
370 */ 412 */
371 int saveLayerAlpha(const SkRect* bounds, U8CPU alpha, 413 SK_ATTR_EXTERNALLY_DEPRECATED("SaveFlags use is deprecated")
372 SaveFlags flags = kARGB_ClipLayer_SaveFlag); 414 int saveLayerAlpha(const SkRect* bounds, U8CPU alpha, SaveFlags flags);
373 415
374 /** This call balances a previous call to save(), and is used to remove all 416 /** This call balances a previous call to save(), and is used to remove all
375 modifications to the matrix/clip/drawFilter state since the last save 417 modifications to the matrix/clip/drawFilter state since the last save
376 call. 418 call.
377 It is an error to call restore() more times than save() was called. 419 It is an error to call restore() more times than save() was called.
378 */ 420 */
379 void restore(); 421 void restore();
380 422
381 /** Returns the number of matrix/clip states on the SkCanvas' private stack. 423 /** Returns the number of matrix/clip states on the SkCanvas' private stack.
382 This will equal # save() calls - # restore() calls + 1. The save count o n 424 This will equal # save() calls - # restore() calls + 1. The save count o n
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 bool asROBitmap(SkBitmap*) const; 1498 bool asROBitmap(SkBitmap*) const;
1457 1499
1458 private: 1500 private:
1459 SkBitmap fBitmap; // used if peekPixels() fails 1501 SkBitmap fBitmap; // used if peekPixels() fails
1460 const void* fAddr; // NULL on failure 1502 const void* fAddr; // NULL on failure
1461 SkImageInfo fInfo; 1503 SkImageInfo fInfo;
1462 size_t fRowBytes; 1504 size_t fRowBytes;
1463 }; 1505 };
1464 1506
1465 #endif 1507 #endif
OLDNEW
« no previous file with comments | « gyp/common_conditions.gypi ('k') | include/core/SkPostConfig.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698