Bug 1082598 - Part 5: Fix NPAPI for Skia update. r=jrmuizel
authorLee Salzman <lsalzman@mozilla.com>
Fri, 18 Dec 2015 13:53:25 -0500
changeset 277045 09810f69f7881512087f54447bdb0fa9bba2a6c1
parent 277044 0bcb6057f789d293a3dc40fda81f6e6d77c5e819
child 277046 16923db5df3750dfd2f131ea66fdfdbd5f30bcf0
push id16724
push usercbook@mozilla.com
push dateMon, 21 Dec 2015 11:00:52 +0000
treeherderfx-team@3f3f0361567c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1082598
milestone46.0a1
Bug 1082598 - Part 5: Fix NPAPI for Skia update. r=jrmuizel
other-licenses/skia-npapi/ANPCanvas.cpp
other-licenses/skia-npapi/ANPTypeface.cpp
--- a/other-licenses/skia-npapi/ANPCanvas.cpp
+++ b/other-licenses/skia-npapi/ANPCanvas.cpp
@@ -148,23 +148,28 @@ static void anp_drawBitmap(ANPCanvas* ca
                                  paint);
 }
 
 static void anp_drawBitmapRect(ANPCanvas* canvas, const ANPBitmap* bitmap,
                               const ANPRectI* src, const ANPRectF* dst,
                                const ANPPaint* paint) {
     SkBitmap    bm;
     SkRect      dstR;
-    SkIRect     srcR, *srcPtr = NULL;
+    SkIRect     srcR;
 
     if (src) {
-        srcPtr = SkANP::SetRect(&srcR, *src);
+        canvas->skcanvas->drawBitmapRect(*SkANP::SetBitmap(&bm, *bitmap),
+                                         *SkANP::SetRect(&srcR, *src),
+                                         *SkANP::SetRect(&dstR, *dst),
+                                         paint);
+    } else {
+        canvas->skcanvas->drawBitmapRect(*SkANP::SetBitmap(&bm, *bitmap),
+                                         *SkANP::SetRect(&dstR, *dst),
+                                         paint);
     }
-    canvas->skcanvas->drawBitmapRect(*SkANP::SetBitmap(&bm, *bitmap), srcPtr,
-                           *SkANP::SetRect(&dstR, *dst), paint);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 
 #define ASSIGN(obj, name)   (obj)->name = anp_##name
 
 void InitCanvasInterface(ANPCanvasInterfaceV0* i) {
     ASSIGN(i, newCanvas);
--- a/other-licenses/skia-npapi/ANPTypeface.cpp
+++ b/other-licenses/skia-npapi/ANPTypeface.cpp
@@ -22,16 +22,17 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 // must include config.h first for webkit to fiddle with new/delete
 #include "SkANP.h"
 #include "SkFontHost.h"
 #include "SkStream.h"
+#include <stdlib.h>
 
 static ANPTypeface* anp_createFromName(const char name[], ANPTypefaceStyle s) {
     SkTypeface* tf = SkTypeface::CreateFromName(name,
                                         static_cast<SkTypeface::Style>(s));
     return reinterpret_cast<ANPTypeface*>(tf);
 }
 
 static ANPTypeface* anp_createFromTypeface(const ANPTypeface* family,