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

Side by Side Diff: include/core/SkCanvas.h

Issue 1060583007: reduce alloc overhead for SkCanvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | src/core/SkCanvas.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 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 #ifndef SkCanvas_DEFINED 8 #ifndef SkCanvas_DEFINED
9 #define SkCanvas_DEFINED 9 #define SkCanvas_DEFINED
10 10
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 @return The current matrix on the canvas. 1082 @return The current matrix on the canvas.
1083 */ 1083 */
1084 const SkMatrix& getTotalMatrix() const; 1084 const SkMatrix& getTotalMatrix() const;
1085 1085
1086 /** Return the clip stack. The clip stack stores all the individual 1086 /** Return the clip stack. The clip stack stores all the individual
1087 * clips organized by the save/restore frame in which they were 1087 * clips organized by the save/restore frame in which they were
1088 * added. 1088 * added.
1089 * @return the current clip stack ("list" of individual clip elements) 1089 * @return the current clip stack ("list" of individual clip elements)
1090 */ 1090 */
1091 const SkClipStack* getClipStack() const { 1091 const SkClipStack* getClipStack() const {
1092 return fClipStack; 1092 return &fClipStack;
1093 } 1093 }
1094 1094
1095 typedef SkCanvasClipVisitor ClipVisitor; 1095 typedef SkCanvasClipVisitor ClipVisitor;
1096 /** 1096 /**
1097 * Replays the clip operations, back to front, that have been applied to 1097 * Replays the clip operations, back to front, that have been applied to
1098 * the canvas, calling the appropriate method on the visitor for each 1098 * the canvas, calling the appropriate method on the visitor for each
1099 * clip. All clips have already been transformed into device space. 1099 * clip. All clips have already been transformed into device space.
1100 */ 1100 */
1101 void replayClips(ClipVisitor*) const; 1101 void replayClips(ClipVisitor*) const;
1102 1102
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 SkIRect* intersection, 1244 SkIRect* intersection,
1245 const SkImageFilter* imageFilter = NULL); 1245 const SkImageFilter* imageFilter = NULL);
1246 1246
1247 // notify our surface (if we have one) that we are about to draw, so it 1247 // notify our surface (if we have one) that we are about to draw, so it
1248 // can perform copy-on-write or invalidate any cached images 1248 // can perform copy-on-write or invalidate any cached images
1249 void predrawNotify(); 1249 void predrawNotify();
1250 1250
1251 private: 1251 private:
1252 class MCRec; 1252 class MCRec;
1253 1253
1254 SkAutoTUnref<SkClipStack> fClipStack; 1254 SkClipStack fClipStack;
1255 SkDeque fMCStack; 1255 SkDeque fMCStack;
1256 // points to top of stack 1256 // points to top of stack
1257 MCRec* fMCRec; 1257 MCRec* fMCRec;
1258 // the first N recs that can fit here mean we won't call malloc 1258 // the first N recs that can fit here mean we won't call malloc
1259 uint32_t fMCRecStorage[32]; 1259 enum {
1260 kMCRecSize = 128, // most recent measurement
1261 kMCRecCount = 8, // common depth for save/restores
1262 };
1263 intptr_t fMCRecStorage[kMCRecSize * kMCRecCount / sizeof(intptr_t)];
1264 // for our base DeviceCM
1265 intptr_t fBaseLayerStorage[kMCRecSize / sizeof(intptr_t)];
1260 1266
1261 const SkSurfaceProps fProps; 1267 const SkSurfaceProps fProps;
1262 1268
1263 int fSaveCount; // value returned by getSaveCount() 1269 int fSaveCount; // value returned by getSaveCount()
1264 1270
1265 SkMetaData* fMetaData; 1271 SkMetaData* fMetaData;
1266 1272
1267 SkSurface_Base* fSurfaceBase; 1273 SkSurface_Base* fSurfaceBase;
1268 SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; } 1274 SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; }
1269 void setSurfaceBase(SkSurface_Base* sb) { 1275 void setSurfaceBase(SkSurface_Base* sb) {
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 1496
1491 class SkCanvasClipVisitor { 1497 class SkCanvasClipVisitor {
1492 public: 1498 public:
1493 virtual ~SkCanvasClipVisitor(); 1499 virtual ~SkCanvasClipVisitor();
1494 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; 1500 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0;
1495 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; 1501 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0;
1496 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; 1502 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0;
1497 }; 1503 };
1498 1504
1499 #endif 1505 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698