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

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

Issue 767333002: Defer saves() until they're needed (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update tests Created 6 years 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 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 1258
1259 SkClipStack fClipStack; 1259 SkClipStack fClipStack;
1260 SkDeque fMCStack; 1260 SkDeque fMCStack;
1261 // points to top of stack 1261 // points to top of stack
1262 MCRec* fMCRec; 1262 MCRec* fMCRec;
1263 // the first N recs that can fit here mean we won't call malloc 1263 // the first N recs that can fit here mean we won't call malloc
1264 uint32_t fMCRecStorage[32]; 1264 uint32_t fMCRecStorage[32];
1265 1265
1266 const SkSurfaceProps fProps; 1266 const SkSurfaceProps fProps;
1267 1267
1268 int fSaveCount; // value returned by getSaveCount()
1268 int fSaveLayerCount; // number of successful saveLayer calls 1269 int fSaveLayerCount; // number of successful saveLayer calls
1269 int fCullCount; // number of active culls 1270 int fCullCount; // number of active culls
1270 1271
1271 SkMetaData* fMetaData; 1272 SkMetaData* fMetaData;
1272 1273
1273 SkSurface_Base* fSurfaceBase; 1274 SkSurface_Base* fSurfaceBase;
1274 SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; } 1275 SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; }
1275 void setSurfaceBase(SkSurface_Base* sb) { 1276 void setSurfaceBase(SkSurface_Base* sb) {
1276 fSurfaceBase = sb; 1277 fSurfaceBase = sb;
1277 } 1278 }
1278 friend class SkSurface_Base; 1279 friend class SkSurface_Base;
1279 friend class SkSurface_Gpu; 1280 friend class SkSurface_Gpu;
1280 1281
1281 bool fDeviceCMDirty; // cleared by updateDeviceCMCache() 1282 bool fDeviceCMDirty; // cleared by updateDeviceCMCache()
1282 void updateDeviceCMCache(); 1283 void updateDeviceCMCache();
1283 1284
1285 void doSave();
1286 void checkForDeferredSave();
1287
1284 friend class SkDrawIter; // needs setupDrawForLayerDevice() 1288 friend class SkDrawIter; // needs setupDrawForLayerDevice()
1285 friend class AutoDrawLooper; 1289 friend class AutoDrawLooper;
1286 friend class SkLua; // needs top layer size and offset 1290 friend class SkLua; // needs top layer size and offset
1287 friend class SkDebugCanvas; // needs experimental fAllowSimplifyClip 1291 friend class SkDebugCanvas; // needs experimental fAllowSimplifyClip
1288 friend class SkDeferredDevice; // needs getTopDevice() 1292 friend class SkDeferredDevice; // needs getTopDevice()
1289 friend class SkSurface_Raster; // needs getDevice() 1293 friend class SkSurface_Raster; // needs getDevice()
1290 friend class SkRecorder; // InitFlags 1294 friend class SkRecorder; // InitFlags
1291 friend class SkNoSaveLayerCanvas; // InitFlags 1295 friend class SkNoSaveLayerCanvas; // InitFlags
1292 friend class SkPictureImageFilter; // SkCanvas(SkBaseDevice*, SkSurfaceProp s*, InitFlags) 1296 friend class SkPictureImageFilter; // SkCanvas(SkBaseDevice*, SkSurfaceProp s*, InitFlags)
1293 1297
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 1331
1328 // internal methods are not virtual, so they can safely be called by other 1332 // internal methods are not virtual, so they can safely be called by other
1329 // canvas apis, without confusing subclasses (like SkPictureRecording) 1333 // canvas apis, without confusing subclasses (like SkPictureRecording)
1330 void internalDrawBitmap(const SkBitmap&, const SkMatrix& m, const SkPaint* p aint); 1334 void internalDrawBitmap(const SkBitmap&, const SkMatrix& m, const SkPaint* p aint);
1331 void internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, 1335 void internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
1332 const SkRect& dst, const SkPaint* paint, 1336 const SkRect& dst, const SkPaint* paint,
1333 DrawBitmapRectFlags flags); 1337 DrawBitmapRectFlags flags);
1334 void internalDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, 1338 void internalDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
1335 const SkRect& dst, const SkPaint* paint); 1339 const SkRect& dst, const SkPaint* paint);
1336 void internalDrawPaint(const SkPaint& paint); 1340 void internalDrawPaint(const SkPaint& paint);
1337 int internalSaveLayer(const SkRect* bounds, const SkPaint* paint, 1341 void internalSaveLayer(const SkRect* bounds, const SkPaint* paint,
1338 SaveFlags, bool justForImageFilter, SaveLayerStrategy strategy); 1342 SaveFlags, bool justForImageFilter, SaveLayerStrategy strategy);
1339 void internalDrawDevice(SkBaseDevice*, int x, int y, const SkPaint*); 1343 void internalDrawDevice(SkBaseDevice*, int x, int y, const SkPaint*);
1340 1344
1341 // shared by save() and saveLayer() 1345 // shared by save() and saveLayer()
1342 int internalSave(); 1346 void internalSave();
1343 void internalRestore(); 1347 void internalRestore();
1344 static void DrawRect(const SkDraw& draw, const SkPaint& paint, 1348 static void DrawRect(const SkDraw& draw, const SkPaint& paint,
1345 const SkRect& r, SkScalar textSize); 1349 const SkRect& r, SkScalar textSize);
1346 static void DrawTextDecorations(const SkDraw& draw, const SkPaint& paint, 1350 static void DrawTextDecorations(const SkDraw& draw, const SkPaint& paint,
1347 const char text[], size_t byteLength, 1351 const char text[], size_t byteLength,
1348 SkScalar x, SkScalar y); 1352 SkScalar x, SkScalar y);
1349 1353
1350 // only for canvasutils 1354 // only for canvasutils
1351 const SkRegion& internal_private_getTotalClip() const; 1355 const SkRegion& internal_private_getTotalClip() const;
1352 1356
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 1511
1508 class SkCanvasClipVisitor { 1512 class SkCanvasClipVisitor {
1509 public: 1513 public:
1510 virtual ~SkCanvasClipVisitor(); 1514 virtual ~SkCanvasClipVisitor();
1511 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; 1515 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0;
1512 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; 1516 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0;
1513 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; 1517 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0;
1514 }; 1518 };
1515 1519
1516 #endif 1520 #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