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

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

Issue 186973004: Remove MCRec.fNext (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
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 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 /* This is the record we keep for each save/restore level in the stack. 206 /* This is the record we keep for each save/restore level in the stack.
207 Since a level optionally copies the matrix and/or stack, we have pointers 207 Since a level optionally copies the matrix and/or stack, we have pointers
208 for these fields. If the value is copied for this level, the copy is 208 for these fields. If the value is copied for this level, the copy is
209 stored in the ...Storage field, and the pointer points to that. If the 209 stored in the ...Storage field, and the pointer points to that. If the
210 value is not copied for this level, we ignore ...Storage, and just point 210 value is not copied for this level, we ignore ...Storage, and just point
211 at the corresponding value in the previous level in the stack. 211 at the corresponding value in the previous level in the stack.
212 */ 212 */
213 class SkCanvas::MCRec { 213 class SkCanvas::MCRec {
214 public: 214 public:
215 MCRec* fNext;
216 int fFlags; 215 int fFlags;
217 SkMatrix* fMatrix; // points to either fMatrixStorage or prev M CRec 216 SkMatrix* fMatrix; // points to either fMatrixStorage or prev M CRec
218 SkRasterClip* fRasterClip; // points to either fRegionStorage or prev M CRec 217 SkRasterClip* fRasterClip; // points to either fRegionStorage or prev M CRec
219 SkDrawFilter* fFilter; // the current filter (or null) 218 SkDrawFilter* fFilter; // the current filter (or null)
220 219
221 DeviceCM* fLayer; 220 DeviceCM* fLayer;
222 /* If there are any layers in the stack, this points to the top-most 221 /* If there are any layers in the stack, this points to the top-most
223 one that is at or below this level in the stack (so we know what 222 one that is at or below this level in the stack (so we know what
224 bitmap/device to draw into from this level. This value is NOT 223 bitmap/device to draw into from this level. This value is NOT
225 reference counted, since the real owner is either our fLayer field, 224 reference counted, since the real owner is either our fLayer field,
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 fDeviceCMDirty = false; 490 fDeviceCMDirty = false;
492 fSaveLayerCount = 0; 491 fSaveLayerCount = 0;
493 fCullCount = 0; 492 fCullCount = 0;
494 fMetaData = NULL; 493 fMetaData = NULL;
495 494
496 fMCRec = (MCRec*)fMCStack.push_back(); 495 fMCRec = (MCRec*)fMCStack.push_back();
497 new (fMCRec) MCRec(NULL, 0); 496 new (fMCRec) MCRec(NULL, 0);
498 497
499 fMCRec->fLayer = SkNEW_ARGS(DeviceCM, (NULL, 0, 0, NULL, NULL)); 498 fMCRec->fLayer = SkNEW_ARGS(DeviceCM, (NULL, 0, 0, NULL, NULL));
500 fMCRec->fTopLayer = fMCRec->fLayer; 499 fMCRec->fTopLayer = fMCRec->fLayer;
501 fMCRec->fNext = NULL;
502 500
503 fSurfaceBase = NULL; 501 fSurfaceBase = NULL;
504 502
505 return this->setRootDevice(device); 503 return this->setRootDevice(device);
506 } 504 }
507 505
508 SkCanvas::SkCanvas() 506 SkCanvas::SkCanvas()
509 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) 507 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage))
510 { 508 {
511 inc_canvas(); 509 inc_canvas();
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 } 733 }
736 734
737 /////////////////////////////////////////////////////////////////////////////// 735 ///////////////////////////////////////////////////////////////////////////////
738 736
739 int SkCanvas::internalSave(SaveFlags flags) { 737 int SkCanvas::internalSave(SaveFlags flags) {
740 int saveCount = this->getSaveCount(); // record this before the actual save 738 int saveCount = this->getSaveCount(); // record this before the actual save
741 739
742 MCRec* newTop = (MCRec*)fMCStack.push_back(); 740 MCRec* newTop = (MCRec*)fMCStack.push_back();
743 new (newTop) MCRec(fMCRec, flags); // balanced in restore() 741 new (newTop) MCRec(fMCRec, flags); // balanced in restore()
744 742
745 newTop->fNext = fMCRec;
746 fMCRec = newTop; 743 fMCRec = newTop;
747 744
748 if (SkCanvas::kClip_SaveFlag & flags) { 745 if (SkCanvas::kClip_SaveFlag & flags) {
749 fClipStack.save(); 746 fClipStack.save();
750 } 747 }
751 748
752 return saveCount; 749 return saveCount;
753 } 750 }
754 751
755 int SkCanvas::save(SaveFlags flags) { 752 int SkCanvas::save(SaveFlags flags) {
(...skipping 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 if (!bitmap.allocPixels(info)) { 2378 if (!bitmap.allocPixels(info)) {
2382 return NULL; 2379 return NULL;
2383 } 2380 }
2384 2381
2385 // should this functionality be moved into allocPixels()? 2382 // should this functionality be moved into allocPixels()?
2386 if (!bitmap.info().isOpaque()) { 2383 if (!bitmap.info().isOpaque()) {
2387 bitmap.eraseColor(0); 2384 bitmap.eraseColor(0);
2388 } 2385 }
2389 return SkNEW_ARGS(SkCanvas, (bitmap)); 2386 return SkNEW_ARGS(SkCanvas, (bitmap));
2390 } 2387 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698