static void draw_skia(SkCanvas* canvas, const SkMatrix44& m4, const SkMatrix& vp, skottie::Animation* anim) { auto proc = [canvas, vp, anim](SkColor c, const SkMatrix44& m4) { SkPaint p; p.setColor(c); SkRect r = { 0, 0, 1, 1 }; canvas->save(); canvas->concat(vp * SkMatrix(m4)); anim->render(canvas, &r); // canvas->drawRect({0, 0, 1, 1}, p); canvas->restore(); }; SkMatrix44 tmp; proc(0x400000FF, m4); tmp.setTranslate(0, 0, 1); proc(0xC00000FF, m4 * tmp); tmp.setRotateAboutUnit(1, 0, 0, SK_ScalarPI/2); proc(0x4000FF00, m4 * tmp); tmp.postTranslate(0, 1, 0); proc(0xC000FF00, m4 * tmp); tmp.setRotateAboutUnit(0, 1, 0, -SK_ScalarPI/2); proc(0x40FF0000, m4 * tmp); tmp.postTranslate(1, 0, 0); proc(0xC0FF0000, m4 * tmp); }
void SkOverdrawCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint& paint) { ProcessOneGlyphBounds processBounds(this); SkSurfaceProps props(0, kUnknown_SkPixelGeometry); this->getProps(&props); auto cache = SkStrikeCache::FindOrCreateStrikeExclusive( paint, &props, SkScalerContextFlags::kNone, &this->getTotalMatrix()); SkFindAndPlaceGlyph::ProcessText(paint.getTextEncoding(), (const char*) text, byteLength, SkPoint::Make(x, y), SkMatrix(), paint.getTextAlign(), cache.get(), processBounds); }
DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { GrContext* ctx = ctxInfo.grContext(); sk_sp<GrRenderTargetContext> rtc(ctx->makeDeferredRenderTargetContext( SkBackingFit::kApprox, 800, 800, kRGBA_8888_GrPixelConfig, nullptr, 0, kTopLeft_GrSurfaceOrigin)); if (!rtc) { return; } ctx->flush(); test_path(ctx, rtc.get(), create_path_0()); test_path(ctx, rtc.get(), create_path_1()); test_path(ctx, rtc.get(), create_path_2()); test_path(ctx, rtc.get(), create_path_3()); test_path(ctx, rtc.get(), create_path_4()); test_path(ctx, rtc.get(), create_path_5()); test_path(ctx, rtc.get(), create_path_6()); test_path(ctx, rtc.get(), create_path_7()); test_path(ctx, rtc.get(), create_path_8()); test_path(ctx, rtc.get(), create_path_9()); test_path(ctx, rtc.get(), create_path_10()); test_path(ctx, rtc.get(), create_path_11()); test_path(ctx, rtc.get(), create_path_12()); test_path(ctx, rtc.get(), create_path_13()); test_path(ctx, rtc.get(), create_path_14()); test_path(ctx, rtc.get(), create_path_15()); test_path(ctx, rtc.get(), create_path_16()); SkMatrix nonInvertibleMatrix = SkMatrix::MakeScale(0, 0); sk_sp<GrFragmentProcessor> fp(create_linear_gradient_processor(ctx)); test_path(ctx, rtc.get(), create_path_17(), nonInvertibleMatrix, GrAAType::kCoverage, fp); test_path(ctx, rtc.get(), create_path_18()); test_path(ctx, rtc.get(), create_path_19()); test_path(ctx, rtc.get(), create_path_20(), SkMatrix(), GrAAType::kCoverage); test_path(ctx, rtc.get(), create_path_21(), SkMatrix(), GrAAType::kCoverage); test_path(ctx, rtc.get(), create_path_22()); }
DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { GrContext* ctx = ctxInfo.grContext(); sk_sp<GrRenderTargetContext> rtc(ctx->makeDeferredRenderTargetContext( SkBackingFit::kApprox, 800, 800, kRGBA_8888_GrPixelConfig, nullptr, 1, GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin)); if (!rtc) { return; } ctx->flush(); // Adding discard to appease vulkan validation warning about loading uninitialized data on draw rtc->discard(); test_path(ctx, rtc.get(), create_path_0()); test_path(ctx, rtc.get(), create_path_1()); test_path(ctx, rtc.get(), create_path_2()); test_path(ctx, rtc.get(), create_path_3()); test_path(ctx, rtc.get(), create_path_4()); test_path(ctx, rtc.get(), create_path_5()); test_path(ctx, rtc.get(), create_path_6()); test_path(ctx, rtc.get(), create_path_7()); test_path(ctx, rtc.get(), create_path_8()); test_path(ctx, rtc.get(), create_path_9()); test_path(ctx, rtc.get(), create_path_10()); test_path(ctx, rtc.get(), create_path_11()); test_path(ctx, rtc.get(), create_path_12()); test_path(ctx, rtc.get(), create_path_13()); test_path(ctx, rtc.get(), create_path_14()); test_path(ctx, rtc.get(), create_path_15()); test_path(ctx, rtc.get(), create_path_16()); SkMatrix nonInvertibleMatrix = SkMatrix::MakeScale(0, 0); std::unique_ptr<GrFragmentProcessor> fp(create_linear_gradient_processor(ctx)); test_path(ctx, rtc.get(), create_path_17(), nonInvertibleMatrix, GrAAType::kCoverage, std::move(fp)); test_path(ctx, rtc.get(), create_path_18()); test_path(ctx, rtc.get(), create_path_19()); test_path(ctx, rtc.get(), create_path_20(), SkMatrix(), GrAAType::kCoverage); test_path(ctx, rtc.get(), create_path_21(), SkMatrix(), GrAAType::kCoverage); test_path(ctx, rtc.get(), create_path_22()); test_path(ctx, rtc.get(), create_path_23()); test_path(ctx, rtc.get(), create_path_24()); test_path(ctx, rtc.get(), create_path_25(), SkMatrix(), GrAAType::kCoverage); test_path(ctx, rtc.get(), create_path_26(), SkMatrix(), GrAAType::kCoverage); test_path(ctx, rtc.get(), create_path_27(), SkMatrix(), GrAAType::kCoverage); test_path(ctx, rtc.get(), create_path_28(), SkMatrix(), GrAAType::kCoverage); test_path(ctx, rtc.get(), create_path_29()); }