• Home
  • Raw
  • Download

Lines Matching +full:set +full:- +full:image

4  * Use of this source code is governed by a BSD-style license that can be
31 #include "src/gpu/ganesh/image/GrImageUtils.h"
32 #include "src/gpu/ganesh/image/SkImage_Ganesh.h"
33 #include "src/gpu/ganesh/image/SkSpecialImage_Ganesh.h"
34 #include "src/image/SkImage_Base.h"
51 …if (SkScalarAbs(SkScalarRoundToScalar(transformedRect.left()) - transformedRect.left()) < kColorBl… in has_aligned_samples()
52 …SkScalarAbs(SkScalarRoundToScalar(transformedRect.top()) - transformedRect.top()) < kColorBleedT… in has_aligned_samples()
53 SkScalarAbs(transformedRect.width() - srcRect.width()) < kColorBleedTolerance && in has_aligned_samples()
54 SkScalarAbs(transformedRect.height() - srcRect.height()) < kColorBleedTolerance) { in has_aligned_samples()
93 // sampling is axis-aligned in can_ignore_linear_filtering_subset()
106 // Helper functions for drawing an image with ganesh::SurfaceDrawContext
145 const GrColorInfo& dstInfo = sdc->colorInfo(); in draw_texture()
146 auto textureXform = GrColorSpaceXform::Make(srcColorInfo, sdc->colorInfo()); in draw_texture()
150 if (constraint != SkCanvas::kStrict_SrcRectConstraint && !proxy->isFunctionallyExact()) { in draw_texture()
155 SkRect safeBounds = proxy->getBoundsRect(); in draw_texture()
168 sdc->drawTextureQuad(clip, in draw_texture()
183 sdc->drawTexture(clip, in draw_texture()
215 void Device::drawEdgeAAImage(const SkImage* image, in drawEdgeAAImage() argument
228 const GrClip* clip = this->clip(); in drawEdgeAAImage()
231 auto ib = as_IB(image); in drawEdgeAAImage()
232 if (tm == SkTileMode::kClamp && !ib->isYUVA() && can_use_draw_texture(paint, sampling)) { in drawEdgeAAImage()
235 auto [view, ct] = skgpu::ganesh::AsView(rContext, image, skgpu::Mipmapped::kNo); in drawEdgeAAImage()
239 GrColorInfo info(image->imageInfo().colorInfo()); in drawEdgeAAImage()
261 bool canUseTextureCoordsAsLocalCoords = !use_shader(image->isAlphaOnly(), paint) && !mf; in drawEdgeAAImage()
279 // TODO: Just rely on image to handle this. in drawEdgeAAImage()
282 !ib->isYUVA()) { in drawEdgeAAImage()
285 if (can_ignore_linear_filtering_subset(src, combinedMatrix, sdc->numSamples())) { in drawEdgeAAImage()
302 rContext, image, sampling, tileModes, textureMatrix, subset, domain); in drawEdgeAAImage()
304 std::move(fp), image->imageInfo().colorInfo(), sdc->colorInfo()); in drawEdgeAAImage()
305 if (image->isAlphaOnly()) { in drawEdgeAAImage()
309 &sdc->colorInfo(), in drawEdgeAAImage()
310 sdc->surfaceProps(), in drawEdgeAAImage()
326 sdc->colorInfo(), in drawEdgeAAImage()
330 sdc->surfaceProps(), in drawEdgeAAImage()
336 // Can draw the image directly (any mask filter on the paint was converted to an FP already) in drawEdgeAAImage()
345 sdc->fillQuadWithEdgeAA(clip, std::move(grPaint), aaFlags, localToDevice, in drawEdgeAAImage()
349 sdc->fillRectWithEdgeAA(clip, std::move(grPaint), aaFlags, localToDevice, dst, in drawEdgeAAImage()
353 // Must draw the mask filter as a GrStyledShape. For now, this loses the per-edge AA in drawEdgeAAImage()
377 SkASSERT(special->isGaneshBacked()); in drawSpecial()
379 SkRect src = SkRect::Make(special->subset()); in drawSpecial()
380 SkRect dst = SkRect::MakeWH(special->width(), special->height()); in drawSpecial()
384 GrAA aa = fSurfaceDrawContext->chooseAA(paint); in drawSpecial()
388 GrSurfaceProxyView view = SkSpecialImages::AsView(this->recordingContext(), special); in drawSpecial()
399 // passes in 'fast'). Without exactify'ing the proxy, GrTextureEffect would re-introduce in drawSpecial()
401 view.proxy()->priv().exactify(); in drawSpecial()
404 SkImage_Ganesh image(sk_ref_sp(special->getContext()), in drawSpecial() local
405 special->uniqueID(), in drawSpecial()
407 special->colorInfo()); in drawSpecial()
409 // alpha-only texture+shader, or a high filter quality. in drawSpecial()
410 this->drawEdgeAAImage(&image, in drawSpecial()
423 void Device::drawImageQuadDirect(const SkImage* image, in drawImageQuadDirect() argument
435 auto mode = TiledTextureUtils::OptimizeSampleArea(SkISize::Make(image->width(), in drawImageQuadDirect()
436 image->height()), in drawImageQuadDirect()
443 if (src.contains(image->bounds())) { in drawImageQuadDirect()
446 // Depending on the nature of image, it can flow through more or less optimal pipelines in drawImageQuadDirect()
451 SkMatrix ctm = this->localToDevice(); in drawImageQuadDirect()
462 this->drawEdgeAAImage(image, in drawImageQuadDirect()
475 void Device::drawEdgeAAImageSet(const SkCanvas::ImageSetEntry set[], int count, in drawEdgeAAImageSet() argument
485 SkASSERT(!set[i].fHasClip || dstClips); in drawEdgeAAImageSet()
486 SkASSERT(set[i].fMatrixIndex < 0 || preViewMatrices); in drawEdgeAAImageSet()
489 if (set[i].fAlpha != 1.f) { in drawEdgeAAImageSet()
491 entryPaint.writable()->setAlphaf(paintAlpha * set[i].fAlpha); in drawEdgeAAImageSet()
493 this->drawImageQuadDirect( in drawEdgeAAImageSet()
494 set[i].fImage.get(), set[i].fSrcRect, set[i].fDstRect, in drawEdgeAAImageSet()
495 set[i].fHasClip ? dstClips + dstClipIndex : nullptr, in drawEdgeAAImageSet()
496 static_cast<SkCanvas::QuadAAFlags>(set[i].fAAFlags), in drawEdgeAAImageSet()
497 set[i].fMatrixIndex < 0 ? nullptr : preViewMatrices + set[i].fMatrixIndex, in drawEdgeAAImageSet()
499 dstClipIndex += 4 * set[i].fHasClip; in drawEdgeAAImageSet()
516 auto textureXform = GrColorSpaceXform::Make(set[base].fImage->imageInfo().colorInfo(), in drawEdgeAAImageSet()
517 fSurfaceDrawContext->colorInfo()); in drawEdgeAAImageSet()
518 fSurfaceDrawContext->drawTextureSet(this->clip(), in drawEdgeAAImageSet()
526 this->localToDevice(), in drawEdgeAAImageSet()
535 SkASSERT(!set[i].fHasClip || dstClips); in drawEdgeAAImageSet()
536 SkASSERT(set[i].fMatrixIndex < 0 || preViewMatrices); in drawEdgeAAImageSet()
540 const SkPoint* clip = set[i].fHasClip ? dstClips + dstClipIndex : nullptr; in drawEdgeAAImageSet()
541 dstClipIndex += 4 * set[i].fHasClip; in drawEdgeAAImageSet()
544 // non-sorted src rects. TODO: Decide this is OK or make sure we handle it. in drawEdgeAAImageSet()
545 if (!set[i].fSrcRect.isSorted()) { in drawEdgeAAImageSet()
551 const SkImage_Base* image = as_IB(set[i].fImage.get()); in drawEdgeAAImageSet() local
552 // Extract view from image, but skip YUV images so they get processed through in drawEdgeAAImageSet()
554 if (!image->isYUVA()) { in drawEdgeAAImageSet()
556 skgpu::ganesh::AsView(this->recordingContext(), image, skgpu::Mipmapped::kNo); in drawEdgeAAImageSet()
557 if (image->isAlphaOnly()) { in drawEdgeAAImageSet()
565 // This image can't go through the texture op, send through general image pipeline in drawEdgeAAImageSet()
569 if (set[i].fAlpha != 1.f) { in drawEdgeAAImageSet()
571 entryPaint.writable()->setAlphaf(paintAlpha * set[i].fAlpha); in drawEdgeAAImageSet()
573 this->drawImageQuadDirect( in drawEdgeAAImageSet()
574 image, set[i].fSrcRect, set[i].fDstRect, clip, in drawEdgeAAImageSet()
575 static_cast<SkCanvas::QuadAAFlags>(set[i].fAAFlags), in drawEdgeAAImageSet()
576 set[i].fMatrixIndex < 0 ? nullptr : preViewMatrices + set[i].fMatrixIndex, in drawEdgeAAImageSet()
582 textures[i].fSrcAlphaType = image->alphaType(); in drawEdgeAAImageSet()
583 textures[i].fSrcRect = set[i].fSrcRect; in drawEdgeAAImageSet()
584 textures[i].fDstRect = set[i].fDstRect; in drawEdgeAAImageSet()
587 set[i].fMatrixIndex < 0 ? nullptr : preViewMatrices + set[i].fMatrixIndex; in drawEdgeAAImageSet()
588 textures[i].fColor = texture_color(paint.getColor4f(), set[i].fAlpha, in drawEdgeAAImageSet()
589 SkColorTypeToGrColorType(image->colorType()), in drawEdgeAAImageSet()
590 fSurfaceDrawContext->colorInfo()); in drawEdgeAAImageSet()
591 textures[i].fAAFlags = SkToGrQuadAAFlags(set[i].fAAFlags); in drawEdgeAAImageSet()
598 set[i].fImage->alphaType() != set[base].fImage->alphaType() || in drawEdgeAAImageSet()
599 !SkColorSpace::Equals(set[i].fImage->colorSpace(), set[base].fImage->colorSpace()))) { in drawEdgeAAImageSet()
603 // set being accumulated so increment n, and increment p if proxies are different. in drawEdgeAAImageSet()
605 if (n == 1 || textures[i - 1].fProxyView.proxy() != textures[i].fProxyView.proxy()) { in drawEdgeAAImageSet()
607 // to i - 1). in drawEdgeAAImageSet()