Fix an issue where Pipe did not draw correctly
on all platforms.

Since parameters can be evaluated in any order,
we can't call buffer.read() inline for multiple
parameters. The fix is to read the stream (in
the correct order) before we call the function.
Review URL: https://codereview.appspot.com/6277046

git-svn-id: http://skia.googlecode.com/svn/trunk@4160 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp
index cc7361f..820d0a7 100644
--- a/src/pipe/SkGPipeRead.cpp
+++ b/src/pipe/SkGPipeRead.cpp
@@ -156,8 +156,9 @@
 
 static void clipRect_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
                         SkGPipeState* state) {
-    canvas->clipRect(*skip<SkRect>(reader),
-                     (SkRegion::Op)DrawOp_unpackData(op32), reader->readBool());
+    const SkRect* rect = skip<SkRect>(reader);
+    bool doAA = reader->readBool();
+    canvas->clipRect(*rect, (SkRegion::Op)DrawOp_unpackData(op32), doAA);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -364,10 +365,9 @@
     unsigned index = DrawOp_unpackData(op32);
     SkBitmap* bm = state->getBitmap(index);
     bool hasPaint = reader->readBool();
-    SkIRect center = SkIRect::MakeLTRB(reader->readInt(), reader->readInt(),
-                                       reader->readInt(), reader->readInt());
+    const SkIRect* center = skip<SkIRect>(reader);
     const SkRect* dst = skip<SkRect>(reader);
-    canvas->drawBitmapNine(*bm, center, *dst,
+    canvas->drawBitmapNine(*bm, *center, *dst,
                            hasPaint ? &state->paint() : NULL);
 }
 
@@ -377,14 +377,14 @@
     SkBitmap* bm = state->getBitmap(index);
     bool hasPaint = reader->readBool();
     bool hasSrc = reader->readBool();
-    SkIRect src; 
+    const SkIRect* src;
     if (hasSrc) {
-        src = SkIRect::MakeLTRB(reader->readInt(), reader->readInt(),
-                                reader->readInt(), reader->readInt());
+        src = skip<SkIRect>(reader);
+    } else {
+        src = NULL;
     }
     const SkRect* dst = skip<SkRect>(reader);
-    canvas->drawBitmapRect(*bm, hasSrc ? &src : NULL, *dst,
-                           hasPaint ? &state->paint() : NULL);
+    canvas->drawBitmapRect(*bm, src, *dst, hasPaint ? &state->paint() : NULL);
 }
 
 static void drawSprite_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
@@ -392,8 +392,8 @@
     unsigned index = DrawOp_unpackData(op32);
     SkBitmap* bm = state->getBitmap(index);
     bool hasPaint = reader->readBool();
-    canvas->drawSprite(*bm, reader->readInt(), reader->readInt(),
-                       hasPaint ? &state->paint() : NULL);
+    const SkIPoint* point = skip<SkIPoint>(reader);
+    canvas->drawSprite(*bm, point->fX, point->fY, hasPaint ? &state->paint() : NULL);
 }
 
 ///////////////////////////////////////////////////////////////////////////////