| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkRecordDraw.h" | 8 #include "SkRecordDraw.h" |
| 9 | 9 |
| 10 void SkRecordDraw(const SkRecord& record, SkCanvas* canvas) { | 10 void SkRecordDraw(const SkRecord& record, SkCanvas* canvas) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 template <> void Draw::draw(const NoOp&) {} | 31 template <> void Draw::draw(const NoOp&) {} |
| 32 | 32 |
| 33 #define DRAW(T, call) template <> void Draw::draw(const T& r) { fCanvas->call; } | 33 #define DRAW(T, call) template <> void Draw::draw(const T& r) { fCanvas->call; } |
| 34 DRAW(Restore, restore()); | 34 DRAW(Restore, restore()); |
| 35 DRAW(Save, save(r.flags)); | 35 DRAW(Save, save(r.flags)); |
| 36 DRAW(SaveLayer, saveLayer(r.bounds, r.paint, r.flags)); | 36 DRAW(SaveLayer, saveLayer(r.bounds, r.paint, r.flags)); |
| 37 DRAW(PopCull, popCull()); | 37 DRAW(PopCull, popCull()); |
| 38 DRAW(PushCull, pushCull(r.rect)); | 38 DRAW(PushCull, pushCull(r.rect)); |
| 39 DRAW(Clear, clear(r.color)); | 39 DRAW(Clear, clear(r.color)); |
| 40 DRAW(Concat, concat(r.matrix)); | 40 DRAW(Concat, concat(r.matrix)); |
| 41 DRAW(SetMatrix, setMatrix(r.matrix)); | 41 |
| 42 // We can't clobber the canvas' initial CTM when calling setMatrix. |
| 43 template <> void Draw::draw(const SetMatrix& r) { |
| 44 SkMatrix ctm; |
| 45 ctm.setConcat(fInitialCTM, r.matrix); |
| 46 fCanvas->setMatrix(ctm); |
| 47 } |
| 42 | 48 |
| 43 DRAW(ClipPath, clipPath(r.path, r.op, r.doAA)); | 49 DRAW(ClipPath, clipPath(r.path, r.op, r.doAA)); |
| 44 DRAW(ClipRRect, clipRRect(r.rrect, r.op, r.doAA)); | 50 DRAW(ClipRRect, clipRRect(r.rrect, r.op, r.doAA)); |
| 45 DRAW(ClipRect, clipRect(r.rect, r.op, r.doAA)); | 51 DRAW(ClipRect, clipRect(r.rect, r.op, r.doAA)); |
| 46 DRAW(ClipRegion, clipRegion(r.region, r.op)); | 52 DRAW(ClipRegion, clipRegion(r.region, r.op)); |
| 47 | 53 |
| 48 DRAW(DrawBitmap, drawBitmap(r.bitmap, r.left, r.top, r.paint)); | 54 DRAW(DrawBitmap, drawBitmap(r.bitmap, r.left, r.top, r.paint)); |
| 49 DRAW(DrawBitmapMatrix, drawBitmapMatrix(r.bitmap, r.matrix, r.paint)); | 55 DRAW(DrawBitmapMatrix, drawBitmapMatrix(r.bitmap, r.matrix, r.paint)); |
| 50 DRAW(DrawBitmapNine, drawBitmapNine(r.bitmap, r.center, r.dst, r.paint)); | 56 DRAW(DrawBitmapNine, drawBitmapNine(r.bitmap, r.center, r.dst, r.paint)); |
| 51 DRAW(DrawBitmapRectToRect, drawBitmapRectToRect(r.bitmap, r.src, r.dst, r.paint,
r.flags)); | 57 DRAW(DrawBitmapRectToRect, drawBitmapRectToRect(r.bitmap, r.src, r.dst, r.paint,
r.flags)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 62 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); | 68 DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint)); |
| 63 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, r.matrix, r.pa
int)); | 69 DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, r.matrix, r.pa
int)); |
| 64 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co
lors, | 70 DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co
lors, |
| 65 r.xmode.get(), r.indices, r.indexCount, r.paint)
); | 71 r.xmode.get(), r.indices, r.indexCount, r.paint)
); |
| 66 #undef DRAW | 72 #undef DRAW |
| 67 | 73 |
| 68 template <> void Draw::draw(const PairedPushCull& r) { this->draw(*r.base); } | 74 template <> void Draw::draw(const PairedPushCull& r) { this->draw(*r.base); } |
| 69 template <> void Draw::draw(const BoundedDrawPosTextH& r) { this->draw(*r.base);
} | 75 template <> void Draw::draw(const BoundedDrawPosTextH& r) { this->draw(*r.base);
} |
| 70 | 76 |
| 71 } // namespace SkRecords | 77 } // namespace SkRecords |
| OLD | NEW |