Flutter Engine
The Flutter Engine
third_party
skia
gm
destcolor.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2021 Google LLC.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#include "
gm/gm.h
"
9
#include "
include/core/SkCanvas.h
"
10
#include "
include/core/SkRect.h
"
11
#include "
include/effects/SkRuntimeEffect.h
"
12
#include "
tools/DecodeUtils.h
"
13
#include "
tools/Resources.h
"
14
15
namespace
skiagm
{
16
17
DEF_SIMPLE_GM
(destcolor, canvas, 640, 640) {
18
// Draw the mandrill.
19
canvas->drawImage(
ToolUtils::GetResourceAsImage
(
"images/mandrill_512.png"
), 0, 0);
20
21
// Now let's add our test effect on top. It reads back the original image and inverts it.
22
auto
[effect,
error
] =
SkRuntimeEffect::MakeForBlender
(
SkString
(R
"(
23
half4 main(half4 src, half4 dst) {
24
return (half4(1) - dst).rgb1;
25
}
26
)"));
27
SkASSERT
(effect);
28
SkPaint
invertPaint;
29
invertPaint.
setAntiAlias
(
true
);
30
invertPaint.
setBlender
(effect->makeBlender(
nullptr
));
31
canvas->drawOval(
SkRect::MakeLTRB
(128, 128, 640, 640), invertPaint);
32
}
33
34
}
// namespace skiagm
DecodeUtils.h
Resources.h
SkASSERT
#define SkASSERT(cond)
Definition:
SkAssert.h:116
SkCanvas.h
SkRect.h
SkRuntimeEffect.h
SkPaint
Definition:
SkPaint.h:44
SkPaint::setAntiAlias
void setAntiAlias(bool aa)
Definition:
SkPaint.h:170
SkPaint::setBlender
void setBlender(sk_sp< SkBlender > blender)
Definition:
SkPaint.cpp:155
SkRuntimeEffect::MakeForBlender
static Result MakeForBlender(SkString sksl, const Options &)
Definition:
SkRuntimeEffect.cpp:672
SkString
Definition:
SkString.h:118
error
const uint8_t uint32_t uint32_t GError ** error
Definition:
fl_pixel_buffer_texture_test.cc:40
gm.h
ToolUtils::GetResourceAsImage
sk_sp< SkImage > GetResourceAsImage(const char *resource)
Definition:
DecodeUtils.h:25
skiagm
Definition:
DMSrcSink.h:27
skiagm::DEF_SIMPLE_GM
DEF_SIMPLE_GM(hugebitmapshader, canvas, 100, 100)
Definition:
bitmapshader.cpp:114
SkRect::MakeLTRB
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition:
SkRect.h:646
Generated on Sun Jun 23 2024 21:55:58 for Flutter Engine by
1.9.4