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 "GrRecordReplaceDraw.h" | 8 #include "GrRecordReplaceDraw.h" |
9 #include "SkImage.h" | 9 #include "SkImage.h" |
10 #include "SkRecordDraw.h" | 10 #include "SkRecordDraw.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 return NULL; | 51 return NULL; |
52 } | 52 } |
53 | 53 |
54 static inline void draw_replacement_bitmap(const GrReplacements::ReplacementInfo
* ri, | 54 static inline void draw_replacement_bitmap(const GrReplacements::ReplacementInfo
* ri, |
55 SkCanvas* canvas, | 55 SkCanvas* canvas, |
56 const SkMatrix& initialMatrix) { | 56 const SkMatrix& initialMatrix) { |
57 SkRect src = SkRect::Make(ri->fSrcRect); | 57 SkRect src = SkRect::Make(ri->fSrcRect); |
58 SkRect dst = SkRect::MakeXYWH(SkIntToScalar(ri->fPos.fX), | 58 SkRect dst = SkRect::MakeXYWH(SkIntToScalar(ri->fPos.fX), |
59 SkIntToScalar(ri->fPos.fY), | 59 SkIntToScalar(ri->fPos.fY), |
60 SkIntToScalar(ri->fSrcRect.width()), | 60 SkIntToScalar(ri->fSrcRect.width()), |
61 SkIntToScalar(ri->fSrcRect.height())); | 61 SkIntToScalar(ri->fSrcRect.height())); |
62 | 62 |
63 canvas->save(); | 63 canvas->save(); |
64 canvas->setMatrix(initialMatrix); | 64 canvas->setMatrix(initialMatrix); |
65 ri->fImage->draw(canvas, &src, dst, ri->fPaint); | 65 canvas->drawImageRect(ri->fImage, &src, dst, ri->fPaint); |
66 canvas->restore(); | 66 canvas->restore(); |
67 } | 67 } |
68 | 68 |
69 void GrRecordReplaceDraw(const SkRecord& record, | 69 void GrRecordReplaceDraw(const SkRecord& record, |
70 SkCanvas* canvas, | 70 SkCanvas* canvas, |
71 const SkBBoxHierarchy* bbh, | 71 const SkBBoxHierarchy* bbh, |
72 const GrReplacements* replacements, | 72 const GrReplacements* replacements, |
73 SkDrawPictureCallback* callback) { | 73 SkDrawPictureCallback* callback) { |
74 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); | 74 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); |
75 | 75 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 if (ri) { | 117 if (ri) { |
118 draw_replacement_bitmap(ri, canvas, initialMatrix); | 118 draw_replacement_bitmap(ri, canvas, initialMatrix); |
119 i = ri->fStop; | 119 i = ri->fStop; |
120 continue; | 120 continue; |
121 } | 121 } |
122 | 122 |
123 record.visit<void>(i, draw); | 123 record.visit<void>(i, draw); |
124 } | 124 } |
125 } | 125 } |
126 } | 126 } |
OLD | NEW |