Flutter Engine
The Flutter Engine
Canvas_save.cpp
Go to the documentation of this file.
1// Copyright 2019 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4REG_FIDDLE(Canvas_save, 256, 100, false, 0) {
5void draw(SkCanvas* canvas) {
7 SkRect rect = { 0, 0, 25, 25 };
8 canvas->drawRect(rect, paint);
9 canvas->save();
10 canvas->translate(50, 50);
11 canvas->drawRect(rect, paint);
12 canvas->restore();
13 paint.setColor(SK_ColorRED);
14 canvas->drawRect(rect, paint);
15}
16} // END FIDDLE
REG_FIDDLE(Canvas_save, 256, 100, false, 0)
Definition: Canvas_save.cpp:4
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
int save()
Definition: SkCanvas.cpp:447
const Paint & paint
Definition: color_source.cc:38
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350