| 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkMultiPictureDraw.h" | 9 #include "SkMultiPictureDraw.h" |
| 10 #include "SkPicture.h" | 10 #include "SkPicture.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 const SkPaint* paint) { | 31 const SkPaint* paint) { |
| 32 if (NULL == canvas || NULL == picture) { | 32 if (NULL == canvas || NULL == picture) { |
| 33 SkDEBUGFAIL("parameters to SkMultiPictureDraw::add should be non-NULL"); | 33 SkDEBUGFAIL("parameters to SkMultiPictureDraw::add should be non-NULL"); |
| 34 return; | 34 return; |
| 35 } | 35 } |
| 36 | 36 |
| 37 DrawData* data = fDrawData.append(); | 37 DrawData* data = fDrawData.append(); |
| 38 | 38 |
| 39 data->picture = SkRef(picture); | 39 data->picture = SkRef(picture); |
| 40 data->canvas = SkRef(canvas); | 40 data->canvas = SkRef(canvas); |
| 41 if (NULL != matrix) { | 41 if (matrix) { |
| 42 data->matrix = *matrix; | 42 data->matrix = *matrix; |
| 43 } else { | 43 } else { |
| 44 data->matrix.setIdentity(); | 44 data->matrix.setIdentity(); |
| 45 } | 45 } |
| 46 if (NULL != paint) { | 46 if (paint) { |
| 47 data->paint = SkNEW_ARGS(SkPaint, (*paint)); | 47 data->paint = SkNEW_ARGS(SkPaint, (*paint)); |
| 48 } else { | 48 } else { |
| 49 data->paint = NULL; | 49 data->paint = NULL; |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 void SkMultiPictureDraw::draw() { | 53 void SkMultiPictureDraw::draw() { |
| 54 for (int i = 0; i < fDrawData.count(); ++i) { | 54 for (int i = 0; i < fDrawData.count(); ++i) { |
| 55 fDrawData[i].canvas->drawPicture(fDrawData[i].picture, | 55 fDrawData[i].canvas->drawPicture(fDrawData[i].picture, |
| 56 &fDrawData[i].matrix, | 56 &fDrawData[i].matrix, |
| 57 fDrawData[i].paint); | 57 fDrawData[i].paint); |
| 58 } | 58 } |
| 59 | 59 |
| 60 this->reset(); | 60 this->reset(); |
| 61 } | 61 } |
| 62 | 62 |
| OLD | NEW |