Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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"
10#include "include/core/SkRect.h"
12#include "tools/DecodeUtils.h"
13#include "tools/Resources.h"
14
15namespace skiagm {
16
17DEF_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.
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
#define SkASSERT(cond)
Definition SkAssert.h:116
void setAntiAlias(bool aa)
Definition SkPaint.h:170
void setBlender(sk_sp< SkBlender > blender)
Definition SkPaint.cpp:155
static Result MakeForBlender(SkString sksl, const Options &)
const uint8_t uint32_t uint32_t GError ** error
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
Definition gm.h:50
sk_sp< SkImage > GetResourceAsImage(const char *resource)
Definition DecodeUtils.h:25
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition SkRect.h:646