Flutter Engine
The Flutter Engine
Classes | Functions
image_pict.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageGenerator.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPicture.h"
#include "include/core/SkPictureRecorder.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTypes.h"
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrRecordingContext.h"
#include "include/gpu/GrTypes.h"
#include "include/gpu/ganesh/GrExternalTextureGenerator.h"
#include "include/gpu/ganesh/SkSurfaceGanesh.h"
#include "include/private/gpu/ganesh/GrTextureGenerator.h"
#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrSamplerState.h"
#include "src/gpu/ganesh/GrTextureProxy.h"
#include "src/gpu/ganesh/SurfaceContext.h"
#include "src/gpu/ganesh/image/GrImageUtils.h"
#include "src/gpu/ganesh/image/SkImage_Ganesh.h"
#include "src/image/SkImageGeneratorPriv.h"
#include "src/image/SkImage_Base.h"
#include <memory>
#include <utility>

Go to the source code of this file.

Classes

class  ImagePictGM
 
class  RasterGenerator
 
class  TextureGenerator
 
class  ImageCacheratorGM
 

Functions

static void draw_something (SkCanvas *canvas, const SkRect &bounds)
 
static std::unique_ptr< SkImageGeneratormake_pic_generator (SkCanvas *, sk_sp< SkPicture > pic)
 
static std::unique_ptr< SkImageGeneratormake_ras_generator (SkCanvas *, sk_sp< SkPicture > pic)
 
static std::unique_ptr< SkImageGeneratormake_tex_generator (SkCanvas *canvas, sk_sp< SkPicture > pic)
 

Function Documentation

◆ draw_something()

static void draw_something ( SkCanvas canvas,
const SkRect bounds 
)
static

Definition at line 53 of file image_pict.cpp.

53 {
55 paint.setAntiAlias(true);
56 paint.setColor(SK_ColorRED);
58 paint.setStrokeWidth(10);
59 canvas->drawRect(bounds, paint);
61 paint.setColor(SK_ColorBLUE);
62 canvas->drawOval(bounds, paint);
63}
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void drawOval(const SkRect &oval, const SkPaint &paint)
Definition: SkCanvas.cpp:1698
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
@ kFill_Style
set to fill geometry
Definition: SkPaint.h:193
const Paint & paint
Definition: color_source.cc:38
Optional< SkRect > bounds
Definition: SkRecords.h:189

◆ make_pic_generator()

static std::unique_ptr< SkImageGenerator > make_pic_generator ( SkCanvas ,
sk_sp< SkPicture pic 
)
static

Definition at line 134 of file image_pict.cpp.

135 {
137 matrix.setTranslate(-100, -100);
138 return SkImageGenerators::MakeFromPicture({100, 100},
139 std::move(pic),
140 &matrix,
141 nullptr,
144}
static sk_sp< SkColorSpace > MakeSRGB()
std::unique_ptr< SkImageGenerator > MakeFromPicture(const SkISize &, sk_sp< SkPicture >, const SkMatrix *, const SkPaint *, SkImages::BitDepth, sk_sp< SkColorSpace >, SkSurfaceProps props)
@ kU8
uses 8-bit unsigned int per color component
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258

◆ make_ras_generator()

static std::unique_ptr< SkImageGenerator > make_ras_generator ( SkCanvas ,
sk_sp< SkPicture pic 
)
static

Definition at line 161 of file image_pict.cpp.

162 {
163 SkBitmap bm;
164 bm.allocN32Pixels(100, 100);
165 SkCanvas canvas(bm);
166 canvas.clear(0);
167 canvas.translate(-100, -100);
168 canvas.drawPicture(pic);
169 return std::make_unique<RasterGenerator>(bm);
170}
void allocN32Pixels(int width, int height, bool isOpaque=false)
Definition: SkBitmap.cpp:232

◆ make_tex_generator()

static std::unique_ptr< SkImageGenerator > make_tex_generator ( SkCanvas canvas,
sk_sp< SkPicture pic 
)
static

Definition at line 238 of file image_pict.cpp.

239 {
240 auto dContext = GrAsDirectContext(canvas->recordingContext());
241 if (!dContext && !canvas->recorder()) {
242 return nullptr;
243 }
244
246
247 return std::make_unique<TextureGenerator>(canvas, info, pic);
248}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
virtual GrRecordingContext * recordingContext() const
Definition: SkCanvas.cpp:1637
virtual skgpu::graphite::Recorder * recorder() const
Definition: SkCanvas.cpp:1641
static SkImageInfo MakeN32Premul(int width, int height)