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

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

Issue 211683002: Add discard API to SkCanvas, plumb it to glDiscardFramebuffer() (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: move to ToT 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 | « gyp/core.gypi ('k') | include/gpu/GrColor.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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 * canvas.clipRect(hugeRect, kReplace_Op); 590 * canvas.clipRect(hugeRect, kReplace_Op);
591 * paint.setColor(color); 591 * paint.setColor(color);
592 * paint.setXfermodeMode(kSrc_Mode); 592 * paint.setXfermodeMode(kSrc_Mode);
593 * canvas.drawPaint(paint); 593 * canvas.drawPaint(paint);
594 * canvas.restore(); 594 * canvas.restore();
595 * though it is almost always much more efficient. 595 * though it is almost always much more efficient.
596 */ 596 */
597 virtual void clear(SkColor); 597 virtual void clear(SkColor);
598 598
599 /** 599 /**
600 * This makes the contents of the canvas undefined. Subsequent calls that
601 * require reading the canvas contents will produce undefined results. Examp les
602 * include blending and readPixels. The actual implementation is backend-
603 * dependent and one legal implementation is to do nothing. Like clear(), th is
604 * ignores the clip.
605 *
606 * This function should only be called if the caller intends to subsequently
607 * draw to the canvas. The canvas may do real work at discard() time in orde r
608 * to optimize performance on subsequent draws. Thus, if you call this and t hen
609 * never draw to the canvas subsequently you may pay a perfomance penalty.
610 */
611 void discard() { this->onDiscard(); }
612
613 /**
600 * 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
601 * specified paint. 615 * specified paint.
602 * @param paint The paint used to fill the canvas 616 * @param paint The paint used to fill the canvas
603 */ 617 */
604 virtual void drawPaint(const SkPaint& paint); 618 virtual void drawPaint(const SkPaint& paint);
605 619
606 enum PointMode { 620 enum PointMode {
607 /** drawPoints draws each point separately */ 621 /** drawPoints draws each point separately */
608 kPoints_PointMode, 622 kPoints_PointMode,
609 /** drawPoints draws each pair of points as a line segment */ 623 /** drawPoints draws each pair of points as a line segment */
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 enum ClipEdgeStyle { 1183 enum ClipEdgeStyle {
1170 kHard_ClipEdgeStyle, 1184 kHard_ClipEdgeStyle,
1171 kSoft_ClipEdgeStyle 1185 kSoft_ClipEdgeStyle
1172 }; 1186 };
1173 1187
1174 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle); 1188 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle);
1175 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle); 1189 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle);
1176 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle); 1190 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle);
1177 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op); 1191 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op);
1178 1192
1193 virtual void onDiscard();
1194
1179 // Returns the canvas to be used by DrawIter. Default implementation 1195 // Returns the canvas to be used by DrawIter. Default implementation
1180 // returns this. Subclasses that encapsulate an indirect canvas may 1196 // returns this. Subclasses that encapsulate an indirect canvas may
1181 // need to overload this method. The impl must keep track of this, as it 1197 // need to overload this method. The impl must keep track of this, as it
1182 // is not released or deleted by the caller. 1198 // is not released or deleted by the caller.
1183 virtual SkCanvas* canvasForDrawIter(); 1199 virtual SkCanvas* canvasForDrawIter();
1184 1200
1185 // Clip rectangle bounds. Called internally by saveLayer. 1201 // Clip rectangle bounds. Called internally by saveLayer.
1186 // returns false if the entire rectangle is entirely clipped out 1202 // returns false if the entire rectangle is entirely clipped out
1187 // If non-NULL, The imageFilter parameter will be used to expand the clip 1203 // If non-NULL, The imageFilter parameter will be used to expand the clip
1188 // and offscreen bounds for any margin required by the filter DAG. 1204 // and offscreen bounds for any margin required by the filter DAG.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 bool asROBitmap(SkBitmap*) const; 1429 bool asROBitmap(SkBitmap*) const;
1414 1430
1415 private: 1431 private:
1416 SkBitmap fBitmap; // used if peekPixels() fails 1432 SkBitmap fBitmap; // used if peekPixels() fails
1417 const void* fAddr; // NULL on failure 1433 const void* fAddr; // NULL on failure
1418 SkImageInfo fInfo; 1434 SkImageInfo fInfo;
1419 size_t fRowBytes; 1435 size_t fRowBytes;
1420 }; 1436 };
1421 1437
1422 #endif 1438 #endif
OLDNEW
« no previous file with comments | « gyp/core.gypi ('k') | include/gpu/GrColor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698