Bug 1263685 - Check if paint has a shader before modifying local matrix in DrawTargetSkia::MaskSurface. r=mchang, a=ritu
authorLee Salzman <lsalzman@mozilla.com>
Mon, 11 Apr 2016 22:16:57 -0400
changeset 323931 f45daad066f8ce75602ad61d800253d689edd9e2
parent 323930 527bc99e29e1e05c9c487b61e159bb1cbc2cb28e
child 323932 a9522d102bdf501da930a7b1cab4d9621bbe0a16
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmchang, ritu
bugs1263685
milestone47.0a2
Bug 1263685 - Check if paint has a shader before modifying local matrix in DrawTargetSkia::MaskSurface. r=mchang, a=ritu
gfx/2d/DrawTargetSkia.cpp
--- a/gfx/2d/DrawTargetSkia.cpp
+++ b/gfx/2d/DrawTargetSkia.cpp
@@ -660,17 +660,18 @@ DrawTargetSkia::MaskSurface(const Patter
 
   SkBitmap bitmap = GetBitmapForSurface(aMask);
   if (bitmap.colorType() != kAlpha_8_SkColorType &&
       !bitmap.extractAlpha(&bitmap)) {
     gfxDebug() << *this << ": MaskSurface() failed to extract alpha for mask";
     return;
   }
 
-  if (aOffset != Point(0, 0)) {
+  if (aOffset != Point(0, 0) &&
+      paint.mPaint.getShader()) {
     SkMatrix transform;
     transform.setTranslate(PointToSkPoint(-aOffset));
     SkShader* matrixShader = paint.mPaint.getShader()->newWithLocalMatrix(transform);
     SkSafeUnref(paint.mPaint.setShader(matrixShader));
   }
 
   mCanvas->drawBitmap(bitmap, aOffset.x, aOffset.y, &paint.mPaint);
 }