2015-06-24 17:29:17 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "gm/gm.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "include/core/SkBlendMode.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkCanvas.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "include/core/SkColor.h"
|
|
|
|
#include "include/core/SkColorFilter.h"
|
|
|
|
#include "include/core/SkFilterQuality.h"
|
|
|
|
#include "include/core/SkFont.h"
|
2020-07-09 14:51:27 +00:00
|
|
|
#include "include/core/SkFontMgr.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "include/core/SkFontTypes.h"
|
|
|
|
#include "include/core/SkImage.h"
|
|
|
|
#include "include/core/SkImageInfo.h"
|
|
|
|
#include "include/core/SkPaint.h"
|
|
|
|
#include "include/core/SkPath.h"
|
|
|
|
#include "include/core/SkPathMeasure.h"
|
|
|
|
#include "include/core/SkPoint.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkRSXform.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "include/core/SkRect.h"
|
|
|
|
#include "include/core/SkRefCnt.h"
|
|
|
|
#include "include/core/SkScalar.h"
|
|
|
|
#include "include/core/SkShader.h"
|
|
|
|
#include "include/core/SkSize.h"
|
|
|
|
#include "include/core/SkString.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkSurface.h"
|
|
|
|
#include "include/core/SkTextBlob.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "include/core/SkTileMode.h"
|
|
|
|
#include "include/core/SkTypeface.h"
|
|
|
|
#include "include/core/SkTypes.h"
|
|
|
|
#include "include/core/SkVertices.h"
|
|
|
|
#include "include/effects/SkGradientShader.h"
|
|
|
|
#include "include/private/SkTemplates.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "src/core/SkAutoMalloc.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "src/core/SkFontPriv.h"
|
|
|
|
#include "tools/Resources.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "tools/ToolUtils.h"
|
2015-06-24 17:29:17 +00:00
|
|
|
|
2019-05-01 21:28:53 +00:00
|
|
|
#include <initializer_list>
|
|
|
|
|
2015-06-24 17:29:17 +00:00
|
|
|
class DrawAtlasGM : public skiagm::GM {
|
2016-03-17 17:51:11 +00:00
|
|
|
static sk_sp<SkImage> MakeAtlas(SkCanvas* caller, const SkRect& target) {
|
2015-06-24 17:29:17 +00:00
|
|
|
SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
|
2019-03-20 16:12:10 +00:00
|
|
|
auto surface(ToolUtils::makeSurface(caller, info));
|
2015-06-24 17:29:17 +00:00
|
|
|
SkCanvas* canvas = surface->getCanvas();
|
|
|
|
// draw red everywhere, but we don't expect to see it in the draw, testing the notion
|
|
|
|
// that drawAtlas draws a subset-region of the atlas.
|
|
|
|
canvas->clear(SK_ColorRED);
|
|
|
|
|
|
|
|
SkPaint paint;
|
2016-10-06 00:33:02 +00:00
|
|
|
paint.setBlendMode(SkBlendMode::kClear);
|
2015-06-24 17:29:17 +00:00
|
|
|
SkRect r(target);
|
|
|
|
r.inset(-1, -1);
|
|
|
|
// zero out a place (with a 1-pixel border) to land our drawing.
|
|
|
|
canvas->drawRect(r, paint);
|
2016-10-06 00:33:02 +00:00
|
|
|
paint.setBlendMode(SkBlendMode::kSrcOver);
|
2015-06-24 17:29:17 +00:00
|
|
|
paint.setColor(SK_ColorBLUE);
|
|
|
|
paint.setAntiAlias(true);
|
|
|
|
canvas->drawOval(target, paint);
|
2016-03-17 17:51:11 +00:00
|
|
|
return surface->makeImageSnapshot();
|
2015-06-24 17:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
DrawAtlasGM() {}
|
2016-03-29 16:03:52 +00:00
|
|
|
|
2015-06-24 17:29:17 +00:00
|
|
|
protected:
|
2016-03-29 16:03:52 +00:00
|
|
|
|
2015-06-24 17:29:17 +00:00
|
|
|
SkString onShortName() override {
|
|
|
|
return SkString("draw-atlas");
|
|
|
|
}
|
2016-03-29 16:03:52 +00:00
|
|
|
|
2015-06-24 17:29:17 +00:00
|
|
|
SkISize onISize() override {
|
|
|
|
return SkISize::Make(640, 480);
|
|
|
|
}
|
2016-03-29 16:03:52 +00:00
|
|
|
|
2015-06-24 17:29:17 +00:00
|
|
|
void onDraw(SkCanvas* canvas) override {
|
|
|
|
const SkRect target = { 50, 50, 80, 90 };
|
2016-09-29 20:43:49 +00:00
|
|
|
auto atlas = MakeAtlas(canvas, target);
|
2015-06-24 17:29:17 +00:00
|
|
|
|
|
|
|
const struct {
|
|
|
|
SkScalar fScale;
|
|
|
|
SkScalar fDegrees;
|
|
|
|
SkScalar fTx;
|
|
|
|
SkScalar fTy;
|
2016-03-29 16:03:52 +00:00
|
|
|
|
2015-06-24 17:29:17 +00:00
|
|
|
void apply(SkRSXform* xform) const {
|
|
|
|
const SkScalar rad = SkDegreesToRadians(fDegrees);
|
|
|
|
xform->fSCos = fScale * SkScalarCos(rad);
|
|
|
|
xform->fSSin = fScale * SkScalarSin(rad);
|
|
|
|
xform->fTx = fTx;
|
|
|
|
xform->fTy = fTy;
|
|
|
|
}
|
|
|
|
} rec[] = {
|
|
|
|
{ 1, 0, 10, 10 }, // just translate
|
|
|
|
{ 2, 0, 110, 10 }, // scale + translate
|
|
|
|
{ 1, 30, 210, 10 }, // rotate + translate
|
|
|
|
{ 2, -30, 310, 30 }, // scale + rotate + translate
|
|
|
|
};
|
|
|
|
|
|
|
|
const int N = SK_ARRAY_COUNT(rec);
|
|
|
|
SkRSXform xform[N];
|
|
|
|
SkRect tex[N];
|
|
|
|
SkColor colors[N];
|
|
|
|
|
|
|
|
for (int i = 0; i < N; ++i) {
|
|
|
|
rec[i].apply(&xform[i]);
|
|
|
|
tex[i] = target;
|
|
|
|
colors[i] = 0x80FF0000 + (i * 40 * 256);
|
|
|
|
}
|
|
|
|
|
|
|
|
SkPaint paint;
|
|
|
|
paint.setAntiAlias(true);
|
2021-01-25 16:37:10 +00:00
|
|
|
SkSamplingOptions sampling(SkFilterMode::kLinear);
|
2015-06-24 17:29:17 +00:00
|
|
|
|
2021-01-25 16:37:10 +00:00
|
|
|
canvas->drawAtlas(atlas.get(), xform, tex, nullptr, N, SkBlendMode::kDst,
|
|
|
|
sampling, nullptr, &paint);
|
2015-06-24 17:29:17 +00:00
|
|
|
canvas->translate(0, 100);
|
2021-01-25 16:37:10 +00:00
|
|
|
canvas->drawAtlas(atlas.get(), xform, tex, colors, N, SkBlendMode::kSrcIn,
|
|
|
|
sampling, nullptr, &paint);
|
2015-06-24 17:29:17 +00:00
|
|
|
}
|
2016-03-29 16:03:52 +00:00
|
|
|
|
2015-06-24 17:29:17 +00:00
|
|
|
private:
|
2020-09-03 02:42:33 +00:00
|
|
|
using INHERITED = GM;
|
2015-06-24 17:29:17 +00:00
|
|
|
};
|
|
|
|
DEF_GM( return new DrawAtlasGM; )
|
2016-07-07 19:47:17 +00:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2018-01-29 18:33:06 +00:00
|
|
|
static void draw_text_on_path(SkCanvas* canvas, const void* text, size_t length,
|
2018-12-20 22:10:27 +00:00
|
|
|
const SkPoint xy[], const SkPath& path, const SkFont& font, const SkPaint& paint,
|
2018-10-01 16:16:59 +00:00
|
|
|
float baseline_offset) {
|
2016-07-07 19:47:17 +00:00
|
|
|
SkPathMeasure meas(path, false);
|
|
|
|
|
2019-05-07 19:38:46 +00:00
|
|
|
int count = font.countText(text, length, SkTextEncoding::kUTF8);
|
2016-07-12 22:06:33 +00:00
|
|
|
size_t size = count * (sizeof(SkRSXform) + sizeof(SkScalar));
|
|
|
|
SkAutoSMalloc<512> storage(size);
|
|
|
|
SkRSXform* xform = (SkRSXform*)storage.get();
|
|
|
|
SkScalar* widths = (SkScalar*)(xform + count);
|
|
|
|
|
|
|
|
// Compute a conservative bounds so we can cull the draw
|
2018-12-04 22:35:56 +00:00
|
|
|
const SkRect fontb = SkFontPriv::GetFontBounds(font);
|
2020-02-07 15:36:46 +00:00
|
|
|
const SkScalar max = std::max(std::max(SkScalarAbs(fontb.fLeft), SkScalarAbs(fontb.fRight)),
|
|
|
|
std::max(SkScalarAbs(fontb.fTop), SkScalarAbs(fontb.fBottom)));
|
2016-07-12 22:06:33 +00:00
|
|
|
const SkRect bounds = path.getBounds().makeOutset(max, max);
|
|
|
|
|
2018-12-20 22:10:27 +00:00
|
|
|
SkAutoTArray<SkGlyphID> glyphs(count);
|
2019-05-07 19:38:46 +00:00
|
|
|
font.textToGlyphs(text, length, SkTextEncoding::kUTF8, glyphs.get(), count);
|
2018-12-20 22:10:27 +00:00
|
|
|
font.getWidths(glyphs.get(), count, widths);
|
2018-01-29 18:33:06 +00:00
|
|
|
|
2018-10-01 16:16:59 +00:00
|
|
|
for (int i = 0; i < count; ++i) {
|
|
|
|
// we want to position each character on the center of its advance
|
|
|
|
const SkScalar offset = SkScalarHalf(widths[i]);
|
|
|
|
SkPoint pos;
|
|
|
|
SkVector tan;
|
|
|
|
if (!meas.getPosTan(xy[i].x() + offset, &pos, &tan)) {
|
|
|
|
pos = xy[i];
|
|
|
|
tan.set(1, 0);
|
2018-01-29 18:33:06 +00:00
|
|
|
}
|
2018-10-01 16:16:59 +00:00
|
|
|
pos += SkVector::Make(-tan.fY, tan.fX) * baseline_offset;
|
2018-01-29 18:33:06 +00:00
|
|
|
|
2018-10-01 16:16:59 +00:00
|
|
|
xform[i].fSCos = tan.x();
|
|
|
|
xform[i].fSSin = tan.y();
|
|
|
|
xform[i].fTx = pos.x() - tan.y() * xy[i].y() - tan.x() * offset;
|
|
|
|
xform[i].fTy = pos.y() + tan.x() * xy[i].y() - tan.y() * offset;
|
2018-01-29 18:33:06 +00:00
|
|
|
}
|
2016-07-12 22:06:33 +00:00
|
|
|
|
2018-12-20 22:10:27 +00:00
|
|
|
canvas->drawTextBlob(SkTextBlob::MakeFromRSXform(glyphs.get(), count * sizeof(SkGlyphID),
|
2019-05-07 19:38:46 +00:00
|
|
|
&xform[0], font, SkTextEncoding::kGlyphID),
|
2018-12-20 22:10:27 +00:00
|
|
|
0, 0, paint);
|
2018-10-01 16:16:59 +00:00
|
|
|
|
2016-07-12 22:06:33 +00:00
|
|
|
if (true) {
|
|
|
|
SkPaint p;
|
|
|
|
p.setStyle(SkPaint::kStroke_Style);
|
|
|
|
canvas->drawRect(bounds, p);
|
|
|
|
}
|
2016-07-07 19:47:17 +00:00
|
|
|
}
|
|
|
|
|
2018-03-15 17:37:08 +00:00
|
|
|
static sk_sp<SkShader> make_shader() {
|
|
|
|
SkPoint pts[2] = {{0, 0}, {220, 0}};
|
|
|
|
SkColor colors[2] = {SK_ColorRED, SK_ColorBLUE};
|
2019-04-03 14:27:45 +00:00
|
|
|
return SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkTileMode::kMirror);
|
2018-03-15 17:37:08 +00:00
|
|
|
}
|
|
|
|
|
2018-10-01 16:16:59 +00:00
|
|
|
static void drawTextPath(SkCanvas* canvas, bool doStroke) {
|
2016-07-08 10:31:09 +00:00
|
|
|
const char text0[] = "ABCDFGHJKLMNOPQRSTUVWXYZ";
|
|
|
|
const int N = sizeof(text0) - 1;
|
2016-07-07 19:47:17 +00:00
|
|
|
SkPoint pos[N];
|
|
|
|
|
2018-12-20 22:10:27 +00:00
|
|
|
SkFont font;
|
|
|
|
font.setSize(100);
|
|
|
|
|
2016-07-12 22:06:33 +00:00
|
|
|
SkPaint paint;
|
2018-03-15 17:37:08 +00:00
|
|
|
paint.setShader(make_shader());
|
2016-07-12 22:06:33 +00:00
|
|
|
paint.setAntiAlias(true);
|
2018-01-29 19:32:38 +00:00
|
|
|
if (doStroke) {
|
|
|
|
paint.setStyle(SkPaint::kStroke_Style);
|
|
|
|
paint.setStrokeWidth(2.25f);
|
|
|
|
paint.setStrokeJoin(SkPaint::kRound_Join);
|
|
|
|
}
|
2016-07-07 19:47:17 +00:00
|
|
|
|
2016-07-12 22:06:33 +00:00
|
|
|
SkScalar x = 0;
|
2016-07-07 19:47:17 +00:00
|
|
|
for (int i = 0; i < N; ++i) {
|
2016-07-12 22:06:33 +00:00
|
|
|
pos[i].set(x, 0);
|
2019-05-07 19:38:46 +00:00
|
|
|
x += font.measureText(&text0[i], 1, SkTextEncoding::kUTF8, nullptr, &paint);
|
2016-07-07 19:47:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SkPath path;
|
2018-01-29 18:33:06 +00:00
|
|
|
const float baseline_offset = -5;
|
|
|
|
|
2019-11-22 18:34:02 +00:00
|
|
|
const SkPathDirection dirs[] = {
|
|
|
|
SkPathDirection::kCW, SkPathDirection::kCCW,
|
2018-01-29 18:33:06 +00:00
|
|
|
};
|
|
|
|
for (auto d : dirs) {
|
|
|
|
path.reset();
|
|
|
|
path.addOval(SkRect::MakeXYWH(160, 160, 540, 540), d);
|
2018-12-20 22:10:27 +00:00
|
|
|
draw_text_on_path(canvas, text0, N, pos, path, font, paint, baseline_offset);
|
2018-01-29 18:33:06 +00:00
|
|
|
}
|
2016-07-07 19:47:17 +00:00
|
|
|
|
2018-01-29 19:32:38 +00:00
|
|
|
paint.reset();
|
2016-07-07 19:47:17 +00:00
|
|
|
paint.setStyle(SkPaint::kStroke_Style);
|
|
|
|
canvas->drawPath(path, paint);
|
|
|
|
}
|
|
|
|
|
2018-10-01 16:16:59 +00:00
|
|
|
DEF_SIMPLE_GM(drawTextRSXform, canvas, 430, 860) {
|
2018-01-29 18:33:06 +00:00
|
|
|
canvas->scale(0.5f, 0.5f);
|
2018-01-29 19:32:38 +00:00
|
|
|
const bool doStroke[] = { false, true };
|
|
|
|
for (auto st : doStroke) {
|
2018-10-01 16:16:59 +00:00
|
|
|
drawTextPath(canvas, st);
|
2018-01-29 19:32:38 +00:00
|
|
|
canvas->translate(0, 860);
|
|
|
|
}
|
2018-01-29 18:33:06 +00:00
|
|
|
}
|
|
|
|
|
2018-12-20 20:24:21 +00:00
|
|
|
// Exercise xform blob and its bounds
|
|
|
|
DEF_SIMPLE_GM(blob_rsxform, canvas, 500, 100) {
|
|
|
|
SkFont font;
|
2019-03-20 16:12:10 +00:00
|
|
|
font.setTypeface(ToolUtils::create_portable_typeface());
|
2018-12-20 20:24:21 +00:00
|
|
|
font.setSize(50);
|
|
|
|
|
|
|
|
const char text[] = "CrazyXform";
|
|
|
|
constexpr size_t len = sizeof(text) - 1;
|
|
|
|
|
|
|
|
SkRSXform xforms[len];
|
|
|
|
SkScalar scale = 1;
|
|
|
|
SkScalar x = 0, y = 0;
|
|
|
|
for (size_t i = 0; i < len; ++i) {
|
|
|
|
scale = SkScalarSin(i * SK_ScalarPI / (len-1)) * 0.75f + 0.5f;
|
|
|
|
xforms[i] = SkRSXform::Make(scale, 0, x, y);
|
|
|
|
x += 50 * scale;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto blob = SkTextBlob::MakeFromRSXform(text, len, xforms, font);
|
|
|
|
|
|
|
|
SkPoint offset = { 20, 70 };
|
|
|
|
SkPaint paint;
|
|
|
|
paint.setColor(0xFFCCCCCC);
|
|
|
|
canvas->drawRect(blob->bounds().makeOffset(offset.fX, offset.fY), paint);
|
|
|
|
paint.setColor(SK_ColorBLACK);
|
|
|
|
canvas->drawTextBlob(blob, offset.fX, offset.fY, paint);
|
|
|
|
}
|
|
|
|
|
2020-07-09 14:51:27 +00:00
|
|
|
// Exercise xform blob and its tight bounds
|
|
|
|
DEF_SIMPLE_GM(blob_rsxform_distortable, canvas, 500, 100) {
|
|
|
|
sk_sp<SkTypeface> typeface;
|
|
|
|
std::unique_ptr<SkStreamAsset> distortable(GetResourceAsStream("fonts/Distortable.ttf"));
|
|
|
|
if (distortable) {
|
|
|
|
sk_sp<SkFontMgr> fm = SkFontMgr::RefDefault();
|
|
|
|
const SkFontArguments::VariationPosition::Coordinate position[] = {
|
|
|
|
{ SkSetFourByteTag('w','g','h','t'), 1.618033988749895f }
|
|
|
|
};
|
|
|
|
SkFontArguments params;
|
|
|
|
params.setVariationDesignPosition({position, SK_ARRAY_COUNT(position)});
|
|
|
|
typeface = fm->makeFromStream(std::move(distortable), params);
|
|
|
|
}
|
|
|
|
|
|
|
|
SkFont font(typeface, 50);
|
|
|
|
|
|
|
|
const char text[] = "abcabcabc";
|
|
|
|
constexpr size_t len = sizeof(text) - 1;
|
|
|
|
|
|
|
|
SkRSXform xforms[len];
|
|
|
|
SkScalar scale = 1;
|
|
|
|
SkScalar x = 0, y = 0;
|
|
|
|
for (size_t i = 0; i < len; ++i) {
|
|
|
|
scale = SkScalarSin(i * SK_ScalarPI / (len-1)) * 0.75f + 0.5f;
|
|
|
|
xforms[i] = SkRSXform::Make(scale, 0, x, y);
|
|
|
|
x += 50 * scale;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto blob = SkTextBlob::MakeFromRSXform(text, len, xforms, font);
|
|
|
|
|
|
|
|
SkPoint offset = { 20, 70 };
|
|
|
|
SkPaint paint;
|
|
|
|
paint.setColor(0xFFCCCCCC);
|
|
|
|
canvas->drawRect(blob->bounds().makeOffset(offset.fX, offset.fY), paint);
|
|
|
|
paint.setColor(SK_ColorBLACK);
|
|
|
|
canvas->drawTextBlob(blob, offset.fX, offset.fY, paint);
|
|
|
|
}
|
|
|
|
|
2017-04-28 14:02:47 +00:00
|
|
|
static sk_sp<SkVertices> make_vertices(sk_sp<SkImage> image, const SkRect& r,
|
|
|
|
SkColor color) {
|
|
|
|
SkPoint pos[4];
|
|
|
|
r.toQuad(pos);
|
|
|
|
SkColor colors[4] = { color, color, color, color };
|
|
|
|
return SkVertices::MakeCopy(SkVertices::kTriangleFan_VertexMode, 4,
|
|
|
|
pos, pos, colors);
|
|
|
|
}
|
2016-07-07 19:47:17 +00:00
|
|
|
|
2017-04-28 14:02:47 +00:00
|
|
|
/*
|
|
|
|
* drawAtlas and drawVertices have several things in common:
|
|
|
|
* - can create compound "shaders", combining texture and colors
|
|
|
|
* - these are combined via an explicit blendmode
|
|
|
|
* - like drawImage, they only respect parts of the paint
|
|
|
|
* - colorfilter, imagefilter, blendmode, alpha
|
|
|
|
*
|
|
|
|
* This GM produces a series of pairs of images (atlas | vertices).
|
|
|
|
* Each pair should look the same, and each set shows a different combination
|
|
|
|
* of alpha | colorFilter | mode
|
|
|
|
*/
|
|
|
|
DEF_SIMPLE_GM(compare_atlas_vertices, canvas, 560, 585) {
|
|
|
|
const SkRect tex = SkRect::MakeWH(128, 128);
|
|
|
|
const SkRSXform xform = SkRSXform::Make(1, 0, 0, 0);
|
|
|
|
const SkColor color = 0x884488CC;
|
|
|
|
|
2017-12-08 15:21:31 +00:00
|
|
|
auto image = GetResourceAsImage("images/mandrill_128.png");
|
2017-04-28 14:02:47 +00:00
|
|
|
auto verts = make_vertices(image, tex, color);
|
|
|
|
const sk_sp<SkColorFilter> filters[] = {
|
|
|
|
nullptr,
|
2019-04-08 20:23:20 +00:00
|
|
|
SkColorFilters::Blend(0xFF00FF88, SkBlendMode::kModulate),
|
2017-04-28 14:02:47 +00:00
|
|
|
};
|
|
|
|
const SkBlendMode modes[] = {
|
|
|
|
SkBlendMode::kSrcOver,
|
|
|
|
SkBlendMode::kPlus,
|
|
|
|
};
|
|
|
|
|
|
|
|
canvas->translate(10, 10);
|
|
|
|
SkPaint paint;
|
|
|
|
for (SkBlendMode mode : modes) {
|
2019-02-15 21:13:57 +00:00
|
|
|
for (float alpha : { 1.0f, 0.5f }) {
|
|
|
|
paint.setAlphaf(alpha);
|
2017-04-28 14:02:47 +00:00
|
|
|
canvas->save();
|
2020-07-31 00:24:57 +00:00
|
|
|
for (const sk_sp<SkColorFilter>& cf : filters) {
|
2017-04-28 14:02:47 +00:00
|
|
|
paint.setColorFilter(cf);
|
2021-01-25 16:37:10 +00:00
|
|
|
canvas->drawAtlas(image.get(), &xform, &tex, &color, 1, mode,
|
|
|
|
SkSamplingOptions(), &tex, &paint);
|
2017-04-28 14:02:47 +00:00
|
|
|
canvas->translate(128, 0);
|
2020-12-09 02:58:35 +00:00
|
|
|
paint.setShader(image->makeShader(SkSamplingOptions()));
|
2017-04-28 14:02:47 +00:00
|
|
|
canvas->drawVertices(verts, mode, paint);
|
|
|
|
paint.setShader(nullptr);
|
|
|
|
canvas->translate(145, 0);
|
|
|
|
}
|
|
|
|
canvas->restore();
|
|
|
|
canvas->translate(0, 145);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|