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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // also draws them with replaced layers. | 57 // also draws them with replaced layers. |
58 class ReplaceDraw : public SkRecords::Draw { | 58 class ReplaceDraw : public SkRecords::Draw { |
59 public: | 59 public: |
60 ReplaceDraw(SkCanvas* canvas, GrLayerCache* layerCache, | 60 ReplaceDraw(SkCanvas* canvas, GrLayerCache* layerCache, |
61 SkPicture const* const drawablePicts[], int drawableCount, | 61 SkPicture const* const drawablePicts[], int drawableCount, |
62 const SkPicture* topLevelPicture, | 62 const SkPicture* topLevelPicture, |
63 const SkBigPicture* picture, | 63 const SkBigPicture* picture, |
64 const SkMatrix& initialMatrix, | 64 const SkMatrix& initialMatrix, |
65 SkPicture::AbortCallback* callback, | 65 SkPicture::AbortCallback* callback, |
66 const int* opIndices, int numIndices) | 66 const int* opIndices, int numIndices) |
67 : INHERITED(canvas, drawablePicts, NULL, drawableCount) | 67 : INHERITED(canvas, drawablePicts, nullptr, drawableCount) |
68 , fCanvas(canvas) | 68 , fCanvas(canvas) |
69 , fLayerCache(layerCache) | 69 , fLayerCache(layerCache) |
70 , fTopLevelPicture(topLevelPicture) | 70 , fTopLevelPicture(topLevelPicture) |
71 , fPicture(picture) | 71 , fPicture(picture) |
72 , fInitialMatrix(initialMatrix) | 72 , fInitialMatrix(initialMatrix) |
73 , fCallback(callback) | 73 , fCallback(callback) |
74 , fIndex(0) | 74 , fIndex(0) |
75 , fNumReplaced(0) { | 75 , fNumReplaced(0) { |
76 fOpIndexStack.append(numIndices, opIndices); | 76 fOpIndexStack.append(numIndices, opIndices); |
77 } | 77 } |
78 | 78 |
79 int draw() { | 79 int draw() { |
80 const SkBBoxHierarchy* bbh = fPicture->bbh(); | 80 const SkBBoxHierarchy* bbh = fPicture->bbh(); |
81 const SkRecord* record = fPicture->record(); | 81 const SkRecord* record = fPicture->record(); |
82 if (NULL == record) { | 82 if (nullptr == record) { |
83 return 0; | 83 return 0; |
84 } | 84 } |
85 | 85 |
86 fNumReplaced = 0; | 86 fNumReplaced = 0; |
87 | 87 |
88 fOps.rewind(); | 88 fOps.rewind(); |
89 | 89 |
90 if (bbh) { | 90 if (bbh) { |
91 // Draw only ops that affect pixels in the canvas's current clip. | 91 // Draw only ops that affect pixels in the canvas's current clip. |
92 // The SkRecord and BBH were recorded in identity space. This canva
s | 92 // The SkRecord and BBH were recorded in identity space. This canva
s |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 int GrRecordReplaceDraw(const SkPicture* picture, | 212 int GrRecordReplaceDraw(const SkPicture* picture, |
213 SkCanvas* canvas, | 213 SkCanvas* canvas, |
214 GrLayerCache* layerCache, | 214 GrLayerCache* layerCache, |
215 const SkMatrix& initialMatrix, | 215 const SkMatrix& initialMatrix, |
216 SkPicture::AbortCallback* callback) { | 216 SkPicture::AbortCallback* callback) { |
217 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); | 217 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); |
218 | 218 |
219 if (const SkBigPicture* bp = picture->asSkBigPicture()) { | 219 if (const SkBigPicture* bp = picture->asSkBigPicture()) { |
220 // TODO: drawablePicts? | 220 // TODO: drawablePicts? |
221 ReplaceDraw draw(canvas, layerCache, NULL, 0, | 221 ReplaceDraw draw(canvas, layerCache, nullptr, 0, |
222 bp, bp, | 222 bp, bp, |
223 initialMatrix, callback, NULL, 0); | 223 initialMatrix, callback, nullptr, 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 |