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

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

Issue 933043006: Implement SkBaseDevice snapshot support Base URL: https://skia.googlesource.com/skia.git@skimage-filters-04-snapshot-devices
Patch Set: Created 5 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
« no previous file with comments | « include/core/SkBitmapDevice.h ('k') | 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 11 matching lines...) Expand all
22 class SkBaseDevice; 22 class SkBaseDevice;
23 class SkCanvasClipVisitor; 23 class SkCanvasClipVisitor;
24 class SkDraw; 24 class SkDraw;
25 class SkDrawable; 25 class SkDrawable;
26 class SkDrawFilter; 26 class SkDrawFilter;
27 class SkImage; 27 class SkImage;
28 class SkMetaData; 28 class SkMetaData;
29 class SkPicture; 29 class SkPicture;
30 class SkRRect; 30 class SkRRect;
31 class SkSurface; 31 class SkSurface;
32 class SkSurface_Base;
33 class SkTextBlob; 32 class SkTextBlob;
34 class GrContext; 33 class GrContext;
35 class GrRenderTarget; 34 class GrRenderTarget;
36 35
37 class SkCanvasState; 36 class SkCanvasState;
38 37
39 /** \class SkCanvas 38 /** \class SkCanvas
40 39
41 A Canvas encapsulates all of the state about drawing into a device (bitmap). 40 A Canvas encapsulates all of the state about drawing into a device (bitmap).
42 This includes a reference to the device itself, and a stack of matrix/clip 41 This includes a reference to the device itself, and a stack of matrix/clip
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 590
592 /** 591 /**
593 * Helper method for drawing a color in SRC mode, completely replacing all the pixels 592 * Helper method for drawing a color in SRC mode, completely replacing all the pixels
594 * in the current clip with this color. 593 * in the current clip with this color.
595 */ 594 */
596 void clear(SkColor color) { 595 void clear(SkColor color) {
597 this->drawColor(color, SkXfermode::kSrc_Mode); 596 this->drawColor(color, SkXfermode::kSrc_Mode);
598 } 597 }
599 598
600 /** 599 /**
601 * This makes the contents of the canvas undefined. Subsequent calls that 600 * This makes the contents of current layer of the canvas
602 * require reading the canvas contents will produce undefined results. Examp les 601 * undefined. Subsequent calls that require reading the canvas contents will
603 * include blending and readPixels. The actual implementation is backend- 602 * produce undefined results. Examples include blending and readPixels. The
604 * dependent and one legal implementation is to do nothing. Like clear(), th is 603 * actual implementation is backend- dependent and one legal implementation
605 * ignores the clip. 604 * is to do nothing. Like clear(), this ignores the clip.
606 * 605 *
607 * This function should only be called if the caller intends to subsequently 606 * This function should only be called if the caller intends to subsequently
608 * draw to the canvas. The canvas may do real work at discard() time in orde r 607 * draw to the current layer. The canvas may do real work at discard() time in order
609 * to optimize performance on subsequent draws. Thus, if you call this and t hen 608 * to optimize performance on subsequent draws. Thus, if you call this and t hen
610 * never draw to the canvas subsequently you may pay a perfomance penalty. 609 * never draw to the canvas subsequently you may pay a perfomance penalty.
611 */ 610 */
612 void discard() { this->onDiscard(); } 611 void discard() { this->onDiscard(); }
613 612
614 /** 613 /**
615 * Fill the entire canvas' bitmap (restricted to the current clip) with the 614 * Fill the entire canvas' bitmap (restricted to the current clip) with the
616 * specified paint. 615 * specified paint.
617 * @param paint The paint used to fill the canvas 616 * @param paint The paint used to fill the canvas
618 */ 617 */
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 virtual SkCanvas* canvasForDrawIter(); 1250 virtual SkCanvas* canvasForDrawIter();
1252 1251
1253 // Clip rectangle bounds. Called internally by saveLayer. 1252 // Clip rectangle bounds. Called internally by saveLayer.
1254 // returns false if the entire rectangle is entirely clipped out 1253 // returns false if the entire rectangle is entirely clipped out
1255 // If non-NULL, The imageFilter parameter will be used to expand the clip 1254 // If non-NULL, The imageFilter parameter will be used to expand the clip
1256 // and offscreen bounds for any margin required by the filter DAG. 1255 // and offscreen bounds for any margin required by the filter DAG.
1257 bool clipRectBounds(const SkRect* bounds, SaveFlags flags, 1256 bool clipRectBounds(const SkRect* bounds, SaveFlags flags,
1258 SkIRect* intersection, 1257 SkIRect* intersection,
1259 const SkImageFilter* imageFilter = NULL); 1258 const SkImageFilter* imageFilter = NULL);
1260 1259
1261 // notify our surface (if we have one) that we are about to draw, so it
1262 // can perform copy-on-write or invalidate any cached images
1263 void predrawNotify();
1264
1265 private: 1260 private:
1266 class MCRec; 1261 class MCRec;
1267 1262
1268 SkAutoTUnref<SkClipStack> fClipStack; 1263 SkAutoTUnref<SkClipStack> fClipStack;
1269 SkDeque fMCStack; 1264 SkDeque fMCStack;
1270 // points to top of stack 1265 // points to top of stack
1271 MCRec* fMCRec; 1266 MCRec* fMCRec;
1272 // the first N recs that can fit here mean we won't call malloc 1267 // the first N recs that can fit here mean we won't call malloc
1273 uint32_t fMCRecStorage[32]; 1268 uint32_t fMCRecStorage[32];
1274 1269
1275 const SkSurfaceProps fProps; 1270 const SkSurfaceProps fProps;
1276 1271
1277 int fSaveCount; // value returned by getSaveCount() 1272 int fSaveCount; // value returned by getSaveCount()
1278 1273
1279 SkMetaData* fMetaData; 1274 SkMetaData* fMetaData;
1280 1275
1281 SkSurface_Base* fSurfaceBase;
1282 SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; }
1283 void setSurfaceBase(SkSurface_Base* sb) {
1284 fSurfaceBase = sb;
1285 }
1286 friend class SkSurface_Base; 1276 friend class SkSurface_Base;
1287 friend class SkSurface_Gpu; 1277 friend class SkSurface_Gpu;
1288 1278
1289 bool fDeviceCMDirty; // cleared by updateDeviceCMCache() 1279 bool fDeviceCMDirty; // cleared by updateDeviceCMCache()
1290 void updateDeviceCMCache(); 1280 void updateDeviceCMCache();
1291 1281
1292 void doSave(); 1282 void doSave();
1293 void checkForDeferredSave(); 1283 void checkForDeferredSave();
1294 1284
1295 friend class SkDrawIter; // needs setupDrawForLayerDevice() 1285 friend class SkDrawIter; // needs setupDrawForLayerDevice()
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 1494
1505 class SkCanvasClipVisitor { 1495 class SkCanvasClipVisitor {
1506 public: 1496 public:
1507 virtual ~SkCanvasClipVisitor(); 1497 virtual ~SkCanvasClipVisitor();
1508 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; 1498 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0;
1509 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; 1499 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0;
1510 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; 1500 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0;
1511 }; 1501 };
1512 1502
1513 #endif 1503 #endif
OLDNEW
« no previous file with comments | « include/core/SkBitmapDevice.h ('k') | include/core/SkDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698