Skip to content

Commit f8a08d2

Browse files
committed
[[ HiResPatterns ]] Prevent skia assertion failure when drawing hi-res patterns
1 parent 44da0bd commit f8a08d2

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

libgraphics/src/context.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2027,10 +2027,20 @@ static bool MCGContextApplyPaintSettingsToSkPaint(MCGContextRef self, MCGColor p
20272027
}
20282028
else if (p_pattern != NULL)
20292029
{
2030+
// IM-2014-05-13: [[ HiResPatterns ]] Need to check the combined context & pattern transform
2031+
// to prevent assertion failure when rendering with hi-dpi patterns
2032+
SkMatrix t_matrix;
2033+
t_matrix = self->layer->canvas->getTotalMatrix();
2034+
2035+
SkMatrix t_pattern_matrix;
2036+
MCGAffineTransformToSkMatrix(p_pattern->transform, t_pattern_matrix);
2037+
2038+
t_matrix.postConcat(t_pattern_matrix);
2039+
20302040
// MM-2014-03-12: [[ Bug 11892 ]] If we are not transforming the pattern, there's no need to apply any filtering.
20312041
// Was causing issues in Skia with non null blend modes.
20322042
SkMatrix::TypeMask t_transform_type;
2033-
t_transform_type = self -> layer -> canvas -> getTotalMatrix() . getType();
2043+
t_transform_type = t_matrix . getType();
20342044
if (t_transform_type != SkMatrix::kIdentity_Mask && t_transform_type != SkMatrix::kTranslate_Mask)
20352045
t_filter = p_pattern -> filter;
20362046
t_success = MCGPatternToSkShader(p_pattern, t_shader);

0 commit comments

Comments
 (0)