88 paint.setAntiAlias(
true);
115 bool bottomLeftOrigin) {
137 if (dContext && !dContext->abandoned()) {
146 return sk_make_sp<SkImage_Ganesh>(
168 return tmp.
invert(geomMat);
186 bool drawSubset,
bool drawScaled) {
202 canvas->
concat(imageGeomMat);
206 : kSubsets[matIndex],
222 void drawRow(
SkCanvas* canvas,
bool bottomLeftImage,
bool drawSubset,
bool drawScaled) {
228 this->drawImageWithMatrixAndLabels(canvas, fReferenceImages[bottomLeftImage].
get(),
229 i, drawSubset, drawScaled);
236 if (fLabels.
size()) {
259 if (!fReferenceImages[0] || !fReferenceImages[1]) {
260 *errorMsg =
"Failed to create reference images.";
267 void onGpuTeardown()
override {
269 fReferenceImages[0] = fReferenceImages[1] =
nullptr;
272 void onDraw(
SkCanvas* canvas)
override {
273 SkASSERT(fReferenceImages[0] && fReferenceImages[1]);
278 this->drawRow(canvas,
false,
false,
false);
283 this->drawRow(canvas,
true,
false,
false);
288 this->drawRow(canvas,
true,
true,
false);
293 this->drawRow(canvas,
true,
true,
true);
298 for (
int i = 0;
i < 4; ++
i) {
310 using INHERITED =
GM;
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
@ kBottomLeft_GrSurfaceOrigin
@ kTopLeft_GrSurfaceOrigin
@ kOpaque_SkAlphaType
pixel is opaque
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
constexpr SkColor SK_ColorCYAN
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
@ kUTF8
uses bytes to represent UTF-8 or ASCII
sk_sp< T > sk_ref_sp(T *obj)
void allocPixels(const SkImageInfo &info, size_t rowBytes)
const SkPixmap & pixmap() const
void drawSimpleText(const void *text, size_t byteLength, SkTextEncoding encoding, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
virtual GrRecordingContext * recordingContext() const
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
@ kFast_SrcRectConstraint
sample outside bounds; faster
void clear(SkColor color)
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
void concat(const SkMatrix &matrix)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
@ kAntiAlias
may have transparent pixels on glyph edges
static SkMatrix RectToRect(const SkRect &src, const SkRect &dst, ScaleToFit mode=kFill_ScaleToFit)
SkMatrix & postConcat(const SkMatrix &other)
SkMatrix & postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
static SkMatrix MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar pers0, SkScalar pers1, SkScalar pers2)
bool invert(SkMatrix *inverse) const
SkMatrix & preConcat(const SkMatrix &other)
SkMatrix & preScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
sk_sp< SkImage > makeImageSnapshot()
GM(SkColor backgroundColor=SK_ColorWHITE)
skiagm::DrawResult DrawResult
skiatest::graphite::GraphiteTestContext GraphiteTestContext
static bool UVMatToGeomMatForImage(SkMatrix *geomMat, const SkMatrix &uvMat)
static sk_sp< SkImage > make_reference_image(SkCanvas *mainCanvas, const TArray< sk_sp< SkImage > > &labels, bool bottomLeftOrigin)
static const int kLabelSize
static const int kNumMatrices
static sk_sp< SkImage > make_text_image(const char *text, SkColor color)
static const int kGMWidth
static const SkPoint kPoints[kNumLabels]
static const SkMatrix kUVMatrices[kNumMatrices]
static const int kImageSize
static const int kGMHeight
static const int kNumLabels
static const int kCellSize
SK_API sk_sp< SkImage > RasterFromBitmap(const SkBitmap &bitmap)
Optional< SkRect > bounds
sk_sp< const SkImage > image
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
font
Font Metadata and Metrics.
const myers::Point & get(const myers::Segment &)
GrSurfaceProxyView MakeTextureProxyViewFromData(GrDirectContext *dContext, GrRenderable renderable, GrSurfaceOrigin origin, GrCPixmap pixmap)
SkSamplingOptions(SkFilterMode::kLinear))
static constexpr SkISize Make(int32_t w, int32_t h)
const SkColorInfo & colorInfo() const
static SkImageInfo MakeN32Premul(int width, int height)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
static constexpr SkRect MakeWH(float w, float h)