diff options
author | 2012-06-05 14:58:40 +0000 | |
---|---|---|
committer | 2012-06-05 14:58:40 +0000 | |
commit | 691703cdd4ab51b23c59798e7018dd7920a34be3 (patch) | |
tree | 4444a42e47eafea070026c4db7adef38603cce77 | |
parent | 088719ecdc89b399dd3a3a65f8cced262e50d951 (diff) |
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
-rw-r--r-- | src/pipe/SkGPipeRead.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp index cc7361f046..820d0a7ce6 100644 --- a/src/pipe/SkGPipeRead.cpp +++ b/src/pipe/SkGPipeRead.cpp @@ -156,8 +156,9 @@ static void clipRegion_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, 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 @@ static void drawBitmapNine_rp(SkCanvas* canvas, SkReader32* reader, 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 @@ static void drawBitmapRect_rp(SkCanvas* canvas, SkReader32* reader, 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 @@ static void drawSprite_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, 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); } /////////////////////////////////////////////////////////////////////////////// |