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 "GrContext.h" | 8 #include "GrContext.h" |
9 #include "GrLayerCache.h" | 9 #include "GrLayerCache.h" |
10 #include "GrRecordReplaceDraw.h" | 10 #include "GrRecordReplaceDraw.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 &bm); | 36 &bm); |
37 | 37 |
38 if (layer->isAtlased()) { | 38 if (layer->isAtlased()) { |
39 const SkRect src = SkRect::Make(layer->rect()); | 39 const SkRect src = SkRect::Make(layer->rect()); |
40 const SkRect dst = SkRect::Make(layer->srcIR()); | 40 const SkRect dst = SkRect::Make(layer->srcIR()); |
41 | 41 |
42 SkASSERT(layer->offset().isZero()); | 42 SkASSERT(layer->offset().isZero()); |
43 | 43 |
44 canvas->save(); | 44 canvas->save(); |
45 canvas->setMatrix(SkMatrix::I()); | 45 canvas->setMatrix(SkMatrix::I()); |
46 canvas->drawBitmapRectToRect(bm, &src, dst, layer->paint()); | 46 canvas->drawBitmapRect(bm, &src, dst, layer->paint(), SkCanvas::kStrict_
SrcRectConstraint); |
47 canvas->restore(); | 47 canvas->restore(); |
48 } else { | 48 } else { |
49 canvas->drawSprite(bm, | 49 canvas->drawSprite(bm, |
50 layer->srcIR().fLeft + layer->offset().fX, | 50 layer->srcIR().fLeft + layer->offset().fX, |
51 layer->srcIR().fTop + layer->offset().fY, | 51 layer->srcIR().fTop + layer->offset().fY, |
52 layer->paint()); | 52 layer->paint()); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 // Used by GrRecordReplaceDraw. It intercepts nested drawPicture calls and | 56 // Used by GrRecordReplaceDraw. It intercepts nested drawPicture calls and |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 ReplaceDraw draw(canvas, layerCache, NULL, 0, | 221 ReplaceDraw draw(canvas, layerCache, NULL, 0, |
222 bp, bp, | 222 bp, bp, |
223 initialMatrix, callback, NULL, 0); | 223 initialMatrix, callback, NULL, 0); |
224 return draw.draw(); | 224 return draw.draw(); |
225 } else { | 225 } else { |
226 // TODO: can we assume / assert this doesn't happen? | 226 // TODO: can we assume / assert this doesn't happen? |
227 picture->playback(canvas, callback); | 227 picture->playback(canvas, callback); |
228 return 0; | 228 return 0; |
229 } | 229 } |
230 } | 230 } |
OLD | NEW |