| 247 | } |
| 248 | |
| 249 | void 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 | |
| 272 | void RenderContext::drawGlyphRunList(std::shared_ptr<GlyphRunList> glyphRunList, |
| 273 | const MCState& state, const Fill& fill, const Stroke* stroke) { |
nothing calls this directly
no test coverage detected