Add more parameters to GrTextContext::canDraw
Updates canDraw to accept all the same Skia/Gr objects as the drawText
functions, since that information may very well be relevant in
determining whether a context can draw.
Also moves the onDrawTextBlob implementation directly into
drawTextBlob.
BUG=skia:
Review URL: https://codereview.chromium.org/1010113004
diff --git a/src/gpu/GrStencilAndCoverTextContext.cpp b/src/gpu/GrStencilAndCoverTextContext.cpp
index db41c02..172a856 100644
--- a/src/gpu/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/GrStencilAndCoverTextContext.cpp
@@ -42,27 +42,31 @@
GrStencilAndCoverTextContext::~GrStencilAndCoverTextContext() {
}
-bool GrStencilAndCoverTextContext::canDraw(const SkPaint& paint, const SkMatrix& viewMatrix) {
- if (paint.getRasterizer()) {
+bool GrStencilAndCoverTextContext::canDraw(const GrRenderTarget* rt,
+ const GrClip& clip,
+ const GrPaint& paint,
+ const SkPaint& skPaint,
+ const SkMatrix& viewMatrix) {
+ if (skPaint.getRasterizer()) {
return false;
}
- if (paint.getMaskFilter()) {
+ if (skPaint.getMaskFilter()) {
return false;
}
- if (paint.getPathEffect()) {
+ if (skPaint.getPathEffect()) {
return false;
}
// No hairlines unless we can map the 1 px width to the object space.
- if (paint.getStyle() == SkPaint::kStroke_Style
- && paint.getStrokeWidth() == 0
+ if (skPaint.getStyle() == SkPaint::kStroke_Style
+ && skPaint.getStrokeWidth() == 0
&& viewMatrix.hasPerspective()) {
return false;
}
// No color bitmap fonts.
SkScalerContext::Rec rec;
- SkScalerContext::MakeRec(paint, &fDeviceProperties, NULL, &rec);
+ SkScalerContext::MakeRec(skPaint, &fDeviceProperties, NULL, &rec);
return rec.getFormat() != SkMask::kARGB32_Format;
}