Flutter Engine
The Flutter Engine
third_party
skia
docs
examples
Surface_notifyContentWillChange.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.
3
#include "
tools/fiddle/examples.h
"
4
REG_FIDDLE
(Surface_notifyContentWillChange, 256, 256,
true
, 0) {
5
void
draw
(
SkCanvas
* canvas) {
6
auto
surface
=
SkSurfaces::Raster
(
SkImageInfo::MakeN32Premul
(1, 1));
7
for
(
int
i
= 0;
i
< 3; ++
i
) {
8
SkDebugf
(
"surface generationID: %u\n"
,
surface
->generationID());
9
if
(0 ==
i
) {
10
surface
->getCanvas()->drawColor(
SK_ColorBLACK
);
11
}
else
{
12
surface
->notifyContentWillChange(
SkSurface::kDiscard_ContentChangeMode
);
13
}
14
}
15
}
16
}
// END FIDDLE
SK_ColorBLACK
constexpr SkColor SK_ColorBLACK
Definition:
SkColor.h:103
SkDebugf
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
REG_FIDDLE
REG_FIDDLE(Surface_notifyContentWillChange, 256, 256, true, 0)
Definition:
Surface_notifyContentWillChange.cpp:4
draw
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition:
aaclip.cpp:27
SkCanvas
Definition:
SkCanvas.h:106
SkSurface::kDiscard_ContentChangeMode
@ kDiscard_ContentChangeMode
discards surface on change
Definition:
SkSurface.h:204
surface
VkSurfaceKHR surface
Definition:
main.cc:49
examples.h
i
int i
Definition:
fl_socket_accessible.cc:18
SkSurfaces::Raster
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
Definition:
SkSurface_Raster.cpp:186
SkImageInfo::MakeN32Premul
static SkImageInfo MakeN32Premul(int width, int height)
Definition:
SkImageInfo.cpp:157
Generated on Sun Jun 23 2024 21:55:56 for Flutter Engine by
1.9.4