Lines Matching refs:paint

83  *  - paint is not fill
84 * - paint would blur or otherwise change the coverage of the rect
86 bool SkCanvas::wouldOverwriteEntireSurface(const SkRect* rect, const SkPaint* paint,
125 if (paint) {
126 SkPaint::Style paintStyle = paint->getStyle();
131 if (paint->getMaskFilter() || paint->getPathEffect() || paint->getImageFilter()) {
135 return SkPaintPriv::Overwrites(paint, (SkPaintPriv::ShaderOverrideOpacity)overrideOpacity);
175 bool SkCanvas::predrawNotify(const SkRect* rect, const SkPaint* paint,
184 if (this->wouldOverwriteEntireSurface(rect, paint, overrideOpacity)) {
199 const SkPaint& paint)
202 , fPaint(paint)
205 // Any image filter should have been pulled out and stored in 'imageFilter' so that 'paint'
262 // the paint to compose the image filter's color filter into the paint's color filter slot.
263 // Returns true if the paint has been modified.
264 // Requires the paint to have an image filter and the copy-on-write be initialized.
265 static bool image_to_color_filter(SkPaint* paint) {
266 SkASSERT(SkToBool(paint) && paint->getImageFilter());
269 if (!paint->getImageFilter()->asAColorFilter(&imgCFPtr)) {
274 SkColorFilter* paintCF = paint->getColorFilter();
276 // The paint has both a colorfilter(paintCF) and an imagefilter-that-is-a-colorfilter(imgCF)
281 paint->setColorFilter(std::move(imgCF));
282 paint->setImageFilter(nullptr);
291 * 1. SaveLayer (with a paint containing the current imagefilter and xfermode)
293 * Remove the imagefilter and the xfermode from the paint that we (AutoDrawLooper)
299 * draw onto the previous layer using the xfermode from the original paint.
304 // paint. It's used to determine the size of the offscreen layer for filters.
307 // Draw functions should use layer->paint() instead of the passed-in paint.
309 const SkPaint& paint,
311 : fPaint(paint)
317 // The draw paint has an image filter that couldn't be simplified to an equivalent
323 // Remove the restorePaint fields from our "working" paint
329 // Make rawBounds include all paint outsets except for those due to image filters.
353 const SkPaint& paint() const { return fPaint; }
365 const SkPaint& paint,
371 if (!this->predrawNotify(rawBounds, &paint, overrideOpacity)) {
379 return skstd::optional<AutoLayerForImageFilter>(canvas, paint, rawBounds);
651 int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint) {
652 return this->saveLayer(SaveLayerRec(bounds, paint, 0));
823 SkPaint paint;
824 paint.setAntiAlias(true);
826 return SkTreatAsSprite(matrix, size, sampling, paint);
832 const SkPaint& paint,
926 sk_sp<SkBaseDevice> intermediateDevice(src->onCreateDevice(info, &paint));
951 dst->drawFilteredImage(mapping, filterInput.get(), filter, sampling, paint);
953 dst->drawSpecial(filterInput.get(), mapping.deviceMatrix(), sampling, paint);
961 // - when that is met, the image filter's CF is composed around any CF that was on the draw's paint
965 // - any extracted CF is composed inside the restore paint's CF because image filters are evaluated
966 // before the color filter of a restore paint for layers.
968 // Assumes that 'filter', and thus its inputs, will remain owned by the caller. Modifies 'paint'
974 static const SkImageFilter* optimize_layer_filter(const SkImageFilter* filter, SkPaint* paint,
976 SkASSERT(paint);
980 if (paint->getAlphaf() < 1.f) {
981 // The paint's alpha is applied after the image filter but before the paint's color
985 SkColorFilters::Blend(/* src */ paint->getColor(), SkBlendMode::kDstIn),
987 paint->setAlphaf(1.f);
991 // it with any original color filter on the paint.
996 paint->setColorFilter(SkColorFilters::Compose(paint->refColorFilter(), std::move(inner)));
1007 // If there is a backdrop filter, or if the restore paint has a color filter that affects
1032 // Build up the paint for restoring the layer, taking only the pieces of rec.fPaint that are
1089 // Use the original paint as a hint so that it includes the image filter
1190 SkPaint paint;
1191 paint.setBlendMode(SkBlendMode::kClear);
1192 this->drawClippedToSaveBehind(paint);
1217 SkPaint paint;
1218 paint.setBlendMode(SkBlendMode::kDstOver);
1222 paint);
1638 bool SkCanvas::internalQuickReject(const SkRect& bounds, const SkPaint& paint,
1640 if (!bounds.isFinite() || paint.nothingToDraw()) {
1644 if (paint.canComputeFastBounds()) {
1646 return this->quickReject(paint.computeFastBounds(tmp, &tmp));
1735 const SkPaint& paint) {
1741 this->drawRRect(outer, paint);
1754 this->onDrawDRRect(outer, inner, paint);
1757 void SkCanvas::drawPaint(const SkPaint& paint) {
1759 this->onDrawPaint(paint);
1762 void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) {
1766 this->onDrawRect(r.makeSorted(), paint);
1769 void SkCanvas::drawClippedToSaveBehind(const SkPaint& paint) {
1771 this->onDrawBehind(paint);
1774 void SkCanvas::drawRegion(const SkRegion& region, const SkPaint& paint) {
1781 return this->drawIRect(region.getBounds(), paint);
1784 this->onDrawRegion(region, paint);
1787 void SkCanvas::drawOval(const SkRect& r, const SkPaint& paint) {
1791 this->onDrawOval(r.makeSorted(), paint);
1794 void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
1796 this->onDrawRRect(rrect, paint);
1799 void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint) {
1801 this->onDrawPoints(mode, count, pts, paint);
1805 const SkPaint& paint) {
1806 this->drawVertices(vertices.get(), mode, paint);
1809 void SkCanvas::drawVertices(const SkVertices* vertices, SkBlendMode mode, const SkPaint& paint) {
1818 if (paint.getShader() && !vertices->priv().hasTexCoords()) {
1819 SkPaint noShaderPaint(paint);
1826 this->onDrawVerticesObject(vertices, mode, paint);
1829 void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
1831 this->onDrawPath(path, paint);
1844 static SkPaint clean_paint_for_lattice(const SkPaint* paint) {
1846 if (paint) {
1847 cleaned = *paint;
1855 SkFilterMode filter, const SkPaint* paint) {
1868 this->drawImageLattice(image, lat, dst, filter, paint);
1872 SkFilterMode filter, const SkPaint* paint) {
1887 SkPaint latticePaint = clean_paint_for_lattice(paint);
1891 SkSamplingOptions(filter), paint, kStrict_SrcRectConstraint);
1898 const SkPaint* paint) {
1906 this->onDrawAtlas2(atlas, xform, tex, colors, count, mode, sampling, cull, paint);
1942 const SkPaint* paint,
1945 this->onDrawEdgeAAImageSet2(imageSet, cnt, dstClips, preViewMatrices, sampling, paint,
1959 void SkCanvas::onDrawPaint(const SkPaint& paint) {
1960 this->internalDrawPaint(paint);
1963 void SkCanvas::internalDrawPaint(const SkPaint& paint) {
1966 if (paint.nothingToDraw() || this->isClipEmpty()) {
1970 auto layer = this->aboutToDraw(this, paint, nullptr, CheckForOverwrite::kYes);
1972 this->topDevice()->drawPaint(layer->paint());
1977 const SkPaint& paint) {
1978 if ((long)count <= 0 || paint.nothingToDraw()) {
1991 // Enforce paint style matches implicit behavior of drawPoints
1992 SkPaint strokePaint = paint;
2000 this->topDevice()->drawPoints(mode, count, pts, layer->paint());
2004 void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) {
2006 if (this->internalQuickReject(r, paint)) {
2010 auto layer = this->aboutToDraw(this, paint, &r, CheckForOverwrite::kYes);
2012 this->topDevice()->drawRect(r, layer->paint());
2016 void SkCanvas::onDrawRegion(const SkRegion& region, const SkPaint& paint) {
2018 if (this->internalQuickReject(bounds, paint)) {
2022 auto layer = this->aboutToDraw(this, paint, &bounds);
2024 this->topDevice()->drawRegion(region, layer->paint());
2028 void SkCanvas::onDrawBehind(const SkPaint& paint) {
2053 // as a clip. We use a clip instead of just drawing a rect in case the paint has an image
2064 auto layer = this->aboutToDraw(this, paint);
2066 this->topDevice()->drawPaint(layer->paint());
2072 void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) {
2074 if (this->internalQuickReject(oval, paint)) {
2078 auto layer = this->aboutToDraw(this, paint, &oval);
2080 this->topDevice()->drawOval(oval, layer->paint());
2086 const SkPaint& paint) {
2088 if (this->internalQuickReject(oval, paint)) {
2092 auto layer = this->aboutToDraw(this, paint, &oval);
2094 this->topDevice()->drawArc(oval, startAngle, sweepAngle, useCenter, layer->paint());
2098 void SkCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
2104 this->SkCanvas::drawRect(bounds, paint);
2108 this->SkCanvas::drawOval(bounds, paint);
2112 if (this->internalQuickReject(bounds, paint)) {
2116 auto layer = this->aboutToDraw(this, paint, &bounds);
2118 this->topDevice()->drawRRect(rrect, layer->paint());
2122 void SkCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) {
2124 if (this->internalQuickReject(bounds, paint)) {
2128 auto layer = this->aboutToDraw(this, paint, &bounds);
2130 this->topDevice()->drawDRRect(outer, inner, layer->paint());
2134 void SkCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
2140 if (!path.isInverseFillType() && this->internalQuickReject(pathBounds, paint)) {
2144 this->internalDrawPaint(paint);
2148 auto layer = this->aboutToDraw(this, paint, &pathBounds);
2150 this->topDevice()->drawPath(path, layer->paint());
2155 const SkSamplingOptions& sampling, const SkPaint& paint) {
2156 if (!paint.getImageFilter()) {
2161 if (!SkTreatAsSprite(ctm, SkISize::Make(w, h), sampling, paint)) {
2165 // The other paint effects need to be applied before the image filter, but the sprite draw
2167 if (paint.getAlphaf() < 1.f || paint.getColorFilter() || paint.getMaskFilter()) {
2184 // Clean-up the paint to match the drawing semantics for drawImage et al. (skbug.com/7804).
2185 static SkPaint clean_paint_for_drawImage(const SkPaint* paint) {
2187 if (paint) {
2188 cleaned = *paint;
2196 // so canonicalize the paint before checking quick reject.
2197 static SkPaint clean_paint_for_drawVertices(SkPaint paint) {
2198 paint.setStyle(SkPaint::kFill_Style);
2199 paint.setMaskFilter(nullptr);
2200 paint.setPathEffect(nullptr);
2201 return paint;
2205 const SkSamplingOptions& sampling, const SkPaint* paint) {
2206 SkPaint realPaint = clean_paint_for_drawImage(paint);
2244 layer->paint(), kStrict_SrcRectConstraint);
2249 const SkSamplingOptions& sampling, const SkPaint* paint,
2251 SkPaint realPaint = clean_paint_for_drawImage(paint);
2261 this->topDevice()->drawImageRect(image, &src, dst, sampling, layer->paint(), constraint);
2266 SkFilterMode filter, const SkPaint* paint) {
2267 SkPaint realPaint = clean_paint_for_drawImage(paint);
2275 this->topDevice()->drawImageLattice(image, lattice, dst, filter, layer->paint());
2280 const SkSamplingOptions& sampling, const SkPaint* paint) {
2283 this->onDrawImage2(image, x, y, sampling, paint);
2287 const SkSamplingOptions& sampling, const SkPaint* paint,
2293 this->onDrawImageRect2(image, src, dst, sampling, paint, constraint);
2297 const SkSamplingOptions& sampling, const SkPaint* paint) {
2300 paint, kFast_SrcRectConstraint);
2304 const SkPaint& paint) {
2306 this->onDrawGlyphRunList(glyphRunList, paint);
2309 void SkCanvas::onDrawGlyphRunList(const SkGlyphRunList& glyphRunList, const SkPaint& paint) {
2311 if (this->internalQuickReject(bounds, paint)) {
2314 auto layer = this->aboutToDraw(this, paint, &bounds);
2316 this->topDevice()->drawGlyphRunList(glyphRunList, layer->paint());
2322 SkScalar x, SkScalar y, const SkFont& font, const SkPaint& paint) {
2328 font, paint, text, byteLength, {x, y}, encoding);
2330 this->onDrawGlyphRunList(glyphRunList, paint);
2337 SkPoint origin, const SkFont& font, const SkPaint& paint) {
2350 glyphRun.sourceBounds(paint).makeOffset(origin),
2353 this->onDrawGlyphRunList(glyphRunList, paint);
2357 SkPoint origin, const SkFont& font, const SkPaint& paint) {
2370 glyphRun.sourceBounds(paint).makeOffset(origin),
2373 this->onDrawGlyphRunList(glyphRunList, paint);
2377 SkPoint origin, const SkFont& font, const SkPaint& paint) {
2393 glyphRun.sourceBounds(paint).makeOffset(origin),
2396 this->onDrawGlyphRunList(glyphRunList, paint);
2400 const SkPaint& paint) {
2417 this->onDrawTextBlob(blob, x, y, paint);
2421 const SkPaint& paint) {
2422 SkPaint simplePaint = clean_paint_for_drawVertices(paint);
2431 this->topDevice()->drawVertices(vertices, bmode, layer->paint());
2437 const SkPaint& paint) {
2443 this->onDrawPatch(cubics, colors, texCoords, bmode, paint);
2448 const SkPaint& paint) {
2450 SkPaint simplePaint = clean_paint_for_drawVertices(paint);
2462 this->topDevice()->drawPatch(cubics, colors, texCoords, bmode, layer->paint());
2501 const SkPaint* paint) {
2503 SkPaint realPaint = clean_paint_for_drawVertices(clean_paint_for_drawImage(paint));
2512 this->topDevice()->drawAtlas(xform, tex, colors, count, bmode, layer->paint());
2528 SkPaint paint{color};
2529 paint.setBlendMode(mode);
2530 if (this->internalQuickReject(r, paint)) {
2541 const SkSamplingOptions& sampling, const SkPaint* paint,
2548 SkPaint realPaint = clean_paint_for_drawImage(paint);
2579 layer->paint(), constraint);
2589 SkPaint paint;
2590 paint.setColor(c);
2591 paint.setBlendMode(mode);
2592 this->drawPaint(paint);
2595 void SkCanvas::drawPoint(SkScalar x, SkScalar y, const SkPaint& paint) {
2597 this->drawPoints(kPoints_PointMode, 1, &pt, paint);
2600 void SkCanvas::drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint& paint) {
2604 this->drawPoints(kLines_PointMode, 2, pts, paint);
2607 void SkCanvas::drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint& paint) {
2614 this->drawOval(r, paint);
2618 const SkPaint& paint) {
2622 this->drawRRect(rrect, paint);
2624 this->drawRect(r, paint);
2630 const SkPaint& paint) {
2635 this->onDrawArc(oval, startAngle, sweepAngle, useCenter, paint);
2640 void SkCanvas::drawPicture(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint) {}
2644 const SkPaint* paint) {}
2647 void SkCanvas::drawPicture(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint) {
2655 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect());
2658 this->onDrawPicture(picture, matrix, paint);
2663 const SkPaint* paint) {
2664 if (this->internalQuickReject(picture->cullRect(), paint ? *paint : SkPaint{}, matrix)) {
2668 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect());