Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Canvas_getBaseLayerSize.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.
4// HASH=374e245d91cd729eca48fd20e631fdf3
5REG_FIDDLE(Canvas_getBaseLayerSize, 256, 256, true, 0) {
6void draw(SkCanvas* ) {
8 bitmap.allocPixels(SkImageInfo::MakeN32Premul(20, 30));
10 canvas.clipRect(SkRect::MakeWH(10, 40));
11 SkIRect clipDeviceBounds = canvas.getDeviceClipBounds();
12 if (clipDeviceBounds.isEmpty()) {
13 SkDebugf("Empty clip bounds is unexpected!\n");
14 }
15 SkDebugf("clip=%d,%d\n", clipDeviceBounds.width(), clipDeviceBounds.height());
16 SkISize baseLayerSize = canvas.getBaseLayerSize();
17 SkDebugf("size=%d,%d\n", baseLayerSize.width(), baseLayerSize.height());
18}
19} // END FIDDLE
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
@ kUnknown_SkPixelGeometry
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
virtual SkISize getBaseLayerSize() const
Definition SkCanvas.cpp:373
SkIRect getDeviceClipBounds() const
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60
constexpr int32_t height() const
Definition SkRect.h:165
constexpr int32_t width() const
Definition SkRect.h:158
bool isEmpty() const
Definition SkRect.h:202
constexpr int32_t width() const
Definition SkSize.h:36
constexpr int32_t height() const
Definition SkSize.h:37
static SkImageInfo MakeN32Premul(int width, int height)
static constexpr SkRect MakeWH(float w, float h)
Definition SkRect.h:609