Flutter Engine
The Flutter Engine
Functions
AutoCanvasRestore_restore.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (AutoCanvasRestore_restore, 256, 256, true, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( AutoCanvasRestore_restore  ,
256  ,
256  ,
true  ,
 
)

Definition at line 4 of file AutoCanvasRestore_restore.cpp.

4 {
5void draw(SkCanvas* canvas) {
6 for (bool callRestore : { false, true } ) {
7 for (bool saveCanvas : {false, true} ) {
8 SkAutoCanvasRestore autoRestore(canvas, saveCanvas);
9 if (!saveCanvas) {
10 canvas->save();
11 }
12 SkDebugf("saveCanvas: %s before restore: %d\n",
13 saveCanvas ? "true" : "false", canvas->getSaveCount());
14 if (callRestore) autoRestore.restore();
15 SkDebugf("saveCanvas: %s after restore: %d\n",
16 saveCanvas ? "true" : "false", canvas->getSaveCount());
17 }
18 }
19 SkDebugf("final count: %d\n", canvas->getSaveCount());
20}
21} // END FIDDLE
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
int getSaveCount() const
Definition: SkCanvas.cpp:431
int save()
Definition: SkCanvas.cpp:447