Flutter Engine
The Flutter Engine
Canvas_clipRect_3.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_clipRect_3, 256, 133, false, 0) {
5void draw(SkCanvas* canvas) {
6 canvas->clear(SK_ColorWHITE);
8 paint.setAntiAlias(true);
9 paint.setColor(0x8055aaff);
10 SkRect clipRect = { 0, 0, 87.4f, 87.4f };
11 for (auto alias: { false, true } ) {
12 canvas->save();
13 canvas->clipRect(clipRect, SkClipOp::kIntersect, alias);
14 canvas->drawCircle(67, 67, 60, paint);
15 canvas->restore();
16 canvas->save();
18 canvas->drawCircle(67, 67, 60, paint);
19 canvas->restore();
20 canvas->translate(120, 0);
21 }
22}
23} // END FIDDLE
REG_FIDDLE(Canvas_clipRect_3, 256, 133, false, 0)
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void clear(SkColor color)
Definition: SkCanvas.h:1199
int save()
Definition: SkCanvas.cpp:447
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707
const Paint & paint
Definition: color_source.cc:38
clipRect(r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw