Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: src/core/SkPictureStateTree.cpp

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkPictureShader.cpp ('k') | src/core/SkPoint.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkPictureStateTree.h" 9 #include "SkPictureStateTree.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 28 matching lines...) Expand all
39 fCurrentState.fNode->fFlags |= Node::kSave_Flag; 39 fCurrentState.fNode->fFlags |= Node::kSave_Flag;
40 } 40 }
41 41
42 void SkPictureStateTree::appendSaveLayer(size_t offset) { 42 void SkPictureStateTree::appendSaveLayer(size_t offset) {
43 *static_cast<Draw*>(fStateStack.push_back()) = fCurrentState; 43 *static_cast<Draw*>(fStateStack.push_back()) = fCurrentState;
44 this->appendNode(offset); 44 this->appendNode(offset);
45 fCurrentState.fNode->fFlags |= Node::kSaveLayer_Flag; 45 fCurrentState.fNode->fFlags |= Node::kSaveLayer_Flag;
46 } 46 }
47 47
48 void SkPictureStateTree::saveCollapsed() { 48 void SkPictureStateTree::saveCollapsed() {
49 SkASSERT(NULL != fLastRestoredNode); 49 SkASSERT(fLastRestoredNode);
50 SkASSERT(SkToBool(fLastRestoredNode->fFlags & \ 50 SkASSERT(SkToBool(fLastRestoredNode->fFlags & \
51 (Node::kSaveLayer_Flag | Node::kSave_Flag))); 51 (Node::kSaveLayer_Flag | Node::kSave_Flag)));
52 SkASSERT(fLastRestoredNode->fParent == fCurrentState.fNode); 52 SkASSERT(fLastRestoredNode->fParent == fCurrentState.fNode);
53 // The structure of the tree is not modified here. We just turn off 53 // The structure of the tree is not modified here. We just turn off
54 // the save or saveLayer flag to prevent the iterator from making state 54 // the save or saveLayer flag to prevent the iterator from making state
55 // changing calls on the playback canvas when traversing a save or 55 // changing calls on the playback canvas when traversing a save or
56 // saveLayerNode node. 56 // saveLayerNode node.
57 fLastRestoredNode->fFlags = 0; 57 fLastRestoredNode->fFlags = 0;
58 } 58 }
59 59
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 fCanvas = canvas; 95 fCanvas = canvas;
96 fCurrentNode = root; 96 fCurrentNode = root;
97 fPlaybackMatrix = canvas->getTotalMatrix(); 97 fPlaybackMatrix = canvas->getTotalMatrix();
98 fCurrentMatrix = NULL; 98 fCurrentMatrix = NULL;
99 fPlaybackIndex = 0; 99 fPlaybackIndex = 0;
100 fSave = false; 100 fSave = false;
101 fValid = true; 101 fValid = true;
102 } 102 }
103 103
104 void SkPictureStateTree::Iterator::setCurrentMatrix(const SkMatrix* matrix) { 104 void SkPictureStateTree::Iterator::setCurrentMatrix(const SkMatrix* matrix) {
105 SkASSERT(NULL != matrix); 105 SkASSERT(matrix);
106 106
107 if (matrix == fCurrentMatrix) { 107 if (matrix == fCurrentMatrix) {
108 return; 108 return;
109 } 109 }
110 110
111 // The matrix is in recording space, but we also inherit 111 // The matrix is in recording space, but we also inherit
112 // a playback matrix from out target canvas. 112 // a playback matrix from out target canvas.
113 SkMatrix m = *matrix; 113 SkMatrix m = *matrix;
114 m.postConcat(fPlaybackMatrix); 114 m.postConcat(fPlaybackMatrix);
115 fCanvas->setMatrix(m); 115 fCanvas->setMatrix(m);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 } 210 }
211 211
212 // If we got this far, the clip/saveLayer state is all set, so we can procee d to set the matrix 212 // If we got this far, the clip/saveLayer state is all set, so we can procee d to set the matrix
213 // for the draw, and return its offset. 213 // for the draw, and return its offset.
214 this->setCurrentMatrix(draw->fMatrix); 214 this->setCurrentMatrix(draw->fMatrix);
215 215
216 ++fPlaybackIndex; 216 ++fPlaybackIndex;
217 return draw->fOffset; 217 return draw->fOffset;
218 } 218 }
OLDNEW
« no previous file with comments | « src/core/SkPictureShader.cpp ('k') | src/core/SkPoint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698