Bug 869178 - se SUkCanvas::drawBitmapRect instead of a bitmap SkShader; it's slightly faster r=snorp
☠☠ backed out by b25afb305360 ☠ ☠
authorGeorge Wright <gw@gwright.org.uk>
Thu, 15 Nov 2012 19:57:40 -0500
changeset 131005 f9a17848125a
parent 131004 c6904473984e
child 131006 f2d0107e85ec
push id24646
push usergwright@mozilla.com
push date2013-05-08 00:22 +0000
treeherdermozilla-central@f2d0107e85ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs869178
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 869178 - se SUkCanvas::drawBitmapRect instead of a bitmap SkShader; it's slightly faster r=snorp
gfx/2d/DrawTargetSkia.cpp
--- a/gfx/2d/DrawTargetSkia.cpp
+++ b/gfx/2d/DrawTargetSkia.cpp
@@ -270,31 +270,25 @@ DrawTargetSkia::DrawSurface(SourceSurfac
 
   if (aSource.IsEmpty()) {
     return;
   }
 
   MarkChanged();
 
   SkRect destRect = RectToSkRect(aDest);
-  SkRect sourceRect = RectToSkRect(aSource);
+  SkIRect sourceRect = RectToSkIRect(aSource);
 
-  SkMatrix matrix;
-  matrix.setRectToRect(sourceRect, destRect, SkMatrix::kFill_ScaleToFit);
-  
   const SkBitmap& bitmap = static_cast<SourceSurfaceSkia*>(aSurface)->GetBitmap();
  
   AutoPaintSetup paint(mCanvas.get(), aOptions);
-  SkShader *shader = SkShader::CreateBitmapShader(bitmap, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);
-  shader->setLocalMatrix(matrix);
-  SkSafeUnref(paint.mPaint.setShader(shader));
   if (aSurfOptions.mFilter != FILTER_LINEAR) {
     paint.mPaint.setFilterBitmap(false);
   }
-  mCanvas->drawRect(destRect, paint.mPaint);
+  mCanvas->drawBitmapRect(bitmap, &sourceRect, destRect, &paint.mPaint);
 }
 
 void
 DrawTargetSkia::DrawSurfaceWithShadow(SourceSurface *aSurface,
                                       const Point &aDest,
                                       const Color &aColor,
                                       const Point &aOffset,
                                       Float aSigma,