Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
swizzle.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkRect.h"
#include "include/core/SkTypes.h"
#include "src/core/SkCanvasPriv.h"
#include "src/gpu/ganesh/GrCanvas.h"
#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "src/gpu/ganesh/SkGr.h"
#include "src/gpu/ganesh/SurfaceFillContext.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
#include "tools/DecodeUtils.h"
#include "tools/Resources.h"

Go to the source code of this file.

Functions

 DEF_SIMPLE_GPU_GM (swizzle, rContext, canvas, 512, 512)
 

Function Documentation

◆ DEF_SIMPLE_GPU_GM()

DEF_SIMPLE_GPU_GM ( swizzle  ,
rContext  ,
canvas  ,
512  ,
512   
)

Definition at line 24 of file swizzle.cpp.

24 {
26 if (!sfc) {
27 return;
28 }
29
30 SkBitmap bmp;
31 ToolUtils::GetResourceAsBitmap("images/mandrill_512_q075.jpg", &bmp);
32 auto view = std::get<0>(GrMakeCachedBitmapProxyView(
33 rContext, bmp, /*label=*/"Gm_Swizzle", skgpu::Mipmapped::kNo));
34 if (!view) {
35 return;
36 }
37 std::unique_ptr<GrFragmentProcessor> imgFP =
38 GrTextureEffect::Make(std::move(view), bmp.alphaType(), SkMatrix());
39 auto fp = GrFragmentProcessor::SwizzleOutput(std::move(imgFP), skgpu::Swizzle("grb1"));
40
41 sfc->fillWithFP(std::move(fp));
42}
std::tuple< GrSurfaceProxyView, GrColorType > GrMakeCachedBitmapProxyView(GrRecordingContext *rContext, const SkBitmap &bitmap, std::string_view label, skgpu::Mipmapped mipmapped)
Definition SkGr.cpp:188
static std::unique_ptr< GrFragmentProcessor > SwizzleOutput(std::unique_ptr< GrFragmentProcessor >, const skgpu::Swizzle &)
static std::unique_ptr< GrFragmentProcessor > Make(GrSurfaceProxyView, SkAlphaType, const SkMatrix &=SkMatrix::I(), GrSamplerState::Filter=GrSamplerState::Filter::kNearest, GrSamplerState::MipmapMode mipmapMode=GrSamplerState::MipmapMode::kNone)
SkAlphaType alphaType() const
Definition SkBitmap.h:162
bool GetResourceAsBitmap(const char *resource, SkBitmap *dst)
Definition DecodeUtils.h:21
const uint32_t fp
SurfaceFillContext * TopDeviceSurfaceFillContext(const SkCanvas *canvas)
Definition GrCanvas.cpp:27