| 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" |
| 11 | 11 |
| 12 GrReplacements::ReplacementInfo* GrReplacements::push() { | 12 GrReplacements::ReplacementInfo* GrReplacements::push() { |
| 13 SkDEBUGCODE(this->validate()); | 13 SkDEBUGCODE(this->validate()); |
| 14 return fReplacements.push(); | 14 return fReplacements.push(); |
| 15 } | 15 } |
| 16 | 16 |
| 17 void GrReplacements::freeAll() { | 17 void GrReplacements::freeAll() { |
| 18 for (int i = 0; i < fReplacements.count(); ++i) { | 18 for (int i = 0; i < fReplacements.count(); ++i) { |
| 19 fReplacements[i].fImage->unref(); | 19 fReplacements[i].fImage->unref(); |
| 20 SkDELETE(fReplacements[i].fPaint); |
| 20 } | 21 } |
| 21 fReplacements.reset(); | 22 fReplacements.reset(); |
| 22 } | 23 } |
| 23 | 24 |
| 24 #ifdef SK_DEBUG | 25 #ifdef SK_DEBUG |
| 25 void GrReplacements::validate() const { | 26 void GrReplacements::validate() const { |
| 26 // Check that the ranges are monotonically increasing and non-overlapping | 27 // Check that the ranges are monotonically increasing and non-overlapping |
| 27 if (fReplacements.count() > 0) { | 28 if (fReplacements.count() > 0) { |
| 28 SkASSERT(fReplacements[0].fStart < fReplacements[0].fStop); | 29 SkASSERT(fReplacements[0].fStart < fReplacements[0].fStop); |
| 29 | 30 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 if (ri) { | 117 if (ri) { |
| 117 draw_replacement_bitmap(ri, canvas, initialMatrix); | 118 draw_replacement_bitmap(ri, canvas, initialMatrix); |
| 118 i = ri->fStop; | 119 i = ri->fStop; |
| 119 continue; | 120 continue; |
| 120 } | 121 } |
| 121 | 122 |
| 122 record.visit<void>(i, draw); | 123 record.visit<void>(i, draw); |
| 123 } | 124 } |
| 124 } | 125 } |
| 125 } | 126 } |
| OLD | NEW |