MCPcopy Create free account
hub / github.com/Tencent/tgfx / drawScreenTasks

Method drawScreenTasks

src/layers/DisplayList.cpp:795–816  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

793}
794
795void DisplayList::drawScreenTasks(std::vector<DrawTask> screenTasks, Surface* surface,
796 bool autoClear) const {
797 // Sort tasks by surface index to ensure they are drawn in batches.
798 std::sort(screenTasks.begin(), screenTasks.end(),
799 [](const DrawTask& a, const DrawTask& b) { return a.sourceIndex() < b.sourceIndex(); });
800 auto canvas = surface->getCanvas();
801 AutoCanvasRestore autoRestore(canvas);
802 Paint paint = {};
803 paint.setAntiAlias(false);
804 if (autoClear) {
805 paint.setBlendMode(BlendMode::Src);
806 }
807 static SamplingOptions sampling(FilterMode::Nearest, MipmapMode::None);
808 canvas->setMatrix(Matrix::MakeTrans(_contentOffset.x, _contentOffset.y));
809 for (auto& task : screenTasks) {
810 auto surfaceCache = surfaceCaches[task.sourceIndex()];
811 DEBUG_ASSERT(surfaceCache != nullptr);
812 auto image = surfaceCache->makeImageSnapshot();
813 canvas->drawImageRect(image, task.sourceRect(), task.tileRect(), sampling, &paint,
814 SrcRectConstraint::Strict);
815 }
816}
817
818void DisplayList::renderDirtyRegions(Canvas* canvas, std::vector<Rect> dirtyRegions) {
819 if (lastDirtyRegions.empty()) {

Callers

nothing calls this directly

Calls 9

sourceIndexMethod · 0.80
setAntiAliasMethod · 0.80
makeImageSnapshotMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
getCanvasMethod · 0.45
setBlendModeMethod · 0.45
setMatrixMethod · 0.45
drawImageRectMethod · 0.45

Tested by

no test coverage detected