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

Method drawImageRect

src/gpu/RenderContext.cpp:249–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247}
248
249void RenderContext::drawImageRect(std::shared_ptr<Image> image, const Rect& srcRect,
250 const Rect& dstRect, const SamplingOptions& sampling,
251 const MCState& state, const Fill& fill,
252 SrcRectConstraint constraint) {
253 DEBUG_ASSERT(image != nullptr);
254 DEBUG_ASSERT(image->isAlphaOnly() || fill.shader == nullptr);
255 auto compositor = getOpsCompositor();
256 if (compositor == nullptr) {
257 return;
258 }
259 auto samplingOptions = sampling;
260 if (constraint == SrcRectConstraint::Strict ||
261 (samplingOptions.mipmapMode != MipmapMode::None && !state.matrix.hasNonIdentityScale())) {
262 // Mipmaps perform sampling at different scales, which could cause samples to go outside the
263 // strict region. So we disable mipmaps for strict constraints.
264
265 // There is no scaling for the source image, so we can disable mipmaps to save memory.
266 samplingOptions.mipmapMode = MipmapMode::None;
267 }
268 compositor->fillImageRect(std::move(image), srcRect, dstRect, samplingOptions, state, fill,
269 constraint);
270}
271
272void RenderContext::drawGlyphRunList(std::shared_ptr<GlyphRunList> glyphRunList,
273 const MCState& state, const Fill& fill, const Stroke* stroke) {

Callers

nothing calls this directly

Calls 3

hasNonIdentityScaleMethod · 0.80
fillImageRectMethod · 0.80
isAlphaOnlyMethod · 0.45

Tested by

no test coverage detected