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

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

Issue 560713002: Revert of Revert of allow canvas to force conservative clips (for speed) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | include/core/SkDevice.h » ('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 virtual SkCanvas* canvasForDrawIter(); 1258 virtual SkCanvas* canvasForDrawIter();
1259 1259
1260 // Clip rectangle bounds. Called internally by saveLayer. 1260 // Clip rectangle bounds. Called internally by saveLayer.
1261 // returns false if the entire rectangle is entirely clipped out 1261 // returns false if the entire rectangle is entirely clipped out
1262 // If non-NULL, The imageFilter parameter will be used to expand the clip 1262 // If non-NULL, The imageFilter parameter will be used to expand the clip
1263 // and offscreen bounds for any margin required by the filter DAG. 1263 // and offscreen bounds for any margin required by the filter DAG.
1264 bool clipRectBounds(const SkRect* bounds, SaveFlags flags, 1264 bool clipRectBounds(const SkRect* bounds, SaveFlags flags,
1265 SkIRect* intersection, 1265 SkIRect* intersection,
1266 const SkImageFilter* imageFilter = NULL); 1266 const SkImageFilter* imageFilter = NULL);
1267 1267
1268 // Called by child classes that override clipPath and clipRRect to only
1269 // track fast conservative clip bounds, rather than exact clips.
1270 void updateClipConservativelyUsingBounds(const SkRect&, SkRegion::Op,
1271 bool inverseFilled);
1272
1273 // notify our surface (if we have one) that we are about to draw, so it 1268 // notify our surface (if we have one) that we are about to draw, so it
1274 // can perform copy-on-write or invalidate any cached images 1269 // can perform copy-on-write or invalidate any cached images
1275 void predrawNotify(); 1270 void predrawNotify();
1276 1271
1277 virtual void onPushCull(const SkRect& cullRect); 1272 virtual void onPushCull(const SkRect& cullRect);
1278 virtual void onPopCull(); 1273 virtual void onPopCull();
1279 1274
1280 private: 1275 private:
1281 class MCRec; 1276 class MCRec;
1282 1277
(...skipping 19 matching lines...) Expand all
1302 1297
1303 bool fDeviceCMDirty; // cleared by updateDeviceCMCache() 1298 bool fDeviceCMDirty; // cleared by updateDeviceCMCache()
1304 void updateDeviceCMCache(); 1299 void updateDeviceCMCache();
1305 1300
1306 friend class SkDrawIter; // needs setupDrawForLayerDevice() 1301 friend class SkDrawIter; // needs setupDrawForLayerDevice()
1307 friend class AutoDrawLooper; 1302 friend class AutoDrawLooper;
1308 friend class SkLua; // needs top layer size and offset 1303 friend class SkLua; // needs top layer size and offset
1309 friend class SkDebugCanvas; // needs experimental fAllowSimplifyClip 1304 friend class SkDebugCanvas; // needs experimental fAllowSimplifyClip
1310 friend class SkDeferredDevice; // needs getTopDevice() 1305 friend class SkDeferredDevice; // needs getTopDevice()
1311 friend class SkSurface_Raster; // needs getDevice() 1306 friend class SkSurface_Raster; // needs getDevice()
1307 friend class SkRecorder; // InitFlags
1308 friend class SkNoSaveLayerCanvas; // InitFlags
1312 1309
1310 enum InitFlags {
1311 kDefault_InitFlags = 0,
1312 kConservativeRasterClip_InitFlag = 1 << 0,
1313 };
1314 SkCanvas(int width, int height, InitFlags flags);
1315 SkCanvas(SkBaseDevice*, InitFlags flags);
1316
1313 // needs gettotalclip() 1317 // needs gettotalclip()
1314 friend SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas*); 1318 friend SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas*);
1315 1319
1316 SkBaseDevice* createLayerDevice(const SkImageInfo&); 1320 SkBaseDevice* createLayerDevice(const SkImageInfo&);
1317 1321
1318 SkBaseDevice* init(SkBaseDevice*); 1322 SkBaseDevice* init(SkBaseDevice*, InitFlags);
1319 1323
1320 /** 1324 /**
1321 * DEPRECATED 1325 * DEPRECATED
1322 * 1326 *
1323 * Specify a device for this canvas to draw into. If it is not null, its 1327 * Specify a device for this canvas to draw into. If it is not null, its
1324 * reference count is incremented. If the canvas was already holding a 1328 * reference count is incremented. If the canvas was already holding a
1325 * device, its reference count is decremented. The new device is returned. 1329 * device, its reference count is decremented. The new device is returned.
1326 */ 1330 */
1327 SkBaseDevice* setRootDevice(SkBaseDevice* device); 1331 SkBaseDevice* setRootDevice(SkBaseDevice* device);
1328 1332
(...skipping 29 matching lines...) Expand all
1358 // only for canvasutils 1362 // only for canvasutils
1359 const SkRegion& internal_private_getTotalClip() const; 1363 const SkRegion& internal_private_getTotalClip() const;
1360 1364
1361 /* These maintain a cache of the clip bounds in local coordinates, 1365 /* These maintain a cache of the clip bounds in local coordinates,
1362 (converted to 2s-compliment if floats are slow). 1366 (converted to 2s-compliment if floats are slow).
1363 */ 1367 */
1364 mutable SkRect fCachedLocalClipBounds; 1368 mutable SkRect fCachedLocalClipBounds;
1365 mutable bool fCachedLocalClipBoundsDirty; 1369 mutable bool fCachedLocalClipBoundsDirty;
1366 bool fAllowSoftClip; 1370 bool fAllowSoftClip;
1367 bool fAllowSimplifyClip; 1371 bool fAllowSimplifyClip;
1372 bool fConservativeRasterClip;
1368 1373
1369 const SkRect& getLocalClipBounds() const { 1374 const SkRect& getLocalClipBounds() const {
1370 if (fCachedLocalClipBoundsDirty) { 1375 if (fCachedLocalClipBoundsDirty) {
1371 if (!this->getClipBounds(&fCachedLocalClipBounds)) { 1376 if (!this->getClipBounds(&fCachedLocalClipBounds)) {
1372 fCachedLocalClipBounds.setEmpty(); 1377 fCachedLocalClipBounds.setEmpty();
1373 } 1378 }
1374 fCachedLocalClipBoundsDirty = false; 1379 fCachedLocalClipBoundsDirty = false;
1375 } 1380 }
1376 return fCachedLocalClipBounds; 1381 return fCachedLocalClipBounds;
1377 } 1382 }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 1519
1515 class SkCanvasClipVisitor { 1520 class SkCanvasClipVisitor {
1516 public: 1521 public:
1517 virtual ~SkCanvasClipVisitor(); 1522 virtual ~SkCanvasClipVisitor();
1518 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; 1523 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0;
1519 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; 1524 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0;
1520 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; 1525 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0;
1521 }; 1526 };
1522 1527
1523 #endif 1528 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698