| OLD | NEW |
| 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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 void EXPERIMENTAL_optimize(const SkPicture* picture); | 966 void EXPERIMENTAL_optimize(const SkPicture* picture); |
| 967 | 967 |
| 968 /** Draw the picture into this canvas. This method effective brackets the | 968 /** Draw the picture into this canvas. This method effective brackets the |
| 969 playback of the picture's draw calls with save/restore, so the state | 969 playback of the picture's draw calls with save/restore, so the state |
| 970 of this canvas will be unchanged after this call. | 970 of this canvas will be unchanged after this call. |
| 971 @param picture The recorded drawing commands to playback into this | 971 @param picture The recorded drawing commands to playback into this |
| 972 canvas. | 972 canvas. |
| 973 */ | 973 */ |
| 974 void drawPicture(const SkPicture* picture); | 974 void drawPicture(const SkPicture* picture); |
| 975 | 975 |
| 976 /** |
| 977 * Draw the picture into this canvas. |
| 978 * |
| 979 * If matrix is non-null, apply that matrix to the CTM when drawing this pi
cture. This is |
| 980 * logically equivalent to |
| 981 * save/concat/drawPicture/restore |
| 982 * |
| 983 * If paint is non-null, draw the picture into a temporary buffer, and then
apply the paint's |
| 984 * alpha/colorfilter/imagefilter/xfermode to that buffer as it is drawn to
the canvas. |
| 985 * This is logically equivalent to |
| 986 * saveLayer(paint)/drawPicture/restore |
| 987 */ |
| 988 void drawPicture(const SkPicture*, const SkMatrix* matrix, const SkPaint* pa
int); |
| 989 |
| 976 enum VertexMode { | 990 enum VertexMode { |
| 977 kTriangles_VertexMode, | 991 kTriangles_VertexMode, |
| 978 kTriangleStrip_VertexMode, | 992 kTriangleStrip_VertexMode, |
| 979 kTriangleFan_VertexMode | 993 kTriangleFan_VertexMode |
| 980 }; | 994 }; |
| 981 | 995 |
| 982 /** Draw the array of vertices, interpreted as triangles (based on mode). | 996 /** Draw the array of vertices, interpreted as triangles (based on mode). |
| 983 | 997 |
| 984 If both textures and vertex-colors are NULL, it strokes hairlines with | 998 If both textures and vertex-colors are NULL, it strokes hairlines with |
| 985 the paint's color. This behavior is a useful debugging mode to visualize | 999 the paint's color. This behavior is a useful debugging mode to visualize |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 kSoft_ClipEdgeStyle | 1230 kSoft_ClipEdgeStyle |
| 1217 }; | 1231 }; |
| 1218 | 1232 |
| 1219 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e
dgeStyle); | 1233 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e
dgeStyle); |
| 1220 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl
e edgeStyle); | 1234 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl
e edgeStyle); |
| 1221 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e
dgeStyle); | 1235 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e
dgeStyle); |
| 1222 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op); | 1236 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op); |
| 1223 | 1237 |
| 1224 virtual void onDiscard(); | 1238 virtual void onDiscard(); |
| 1225 | 1239 |
| 1226 virtual void onDrawPicture(const SkPicture* picture); | |
| 1227 // temporary, until we can migrate existing overrides in chrome | 1240 // temporary, until we can migrate existing overrides in chrome |
| 1228 virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*
) {} | 1241 virtual void onDrawPicture(const SkPicture*) {} |
| 1242 virtual void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*
); |
| 1229 | 1243 |
| 1230 // Returns the canvas to be used by DrawIter. Default implementation | 1244 // Returns the canvas to be used by DrawIter. Default implementation |
| 1231 // returns this. Subclasses that encapsulate an indirect canvas may | 1245 // returns this. Subclasses that encapsulate an indirect canvas may |
| 1232 // need to overload this method. The impl must keep track of this, as it | 1246 // need to overload this method. The impl must keep track of this, as it |
| 1233 // is not released or deleted by the caller. | 1247 // is not released or deleted by the caller. |
| 1234 virtual SkCanvas* canvasForDrawIter(); | 1248 virtual SkCanvas* canvasForDrawIter(); |
| 1235 | 1249 |
| 1236 // Clip rectangle bounds. Called internally by saveLayer. | 1250 // Clip rectangle bounds. Called internally by saveLayer. |
| 1237 // returns false if the entire rectangle is entirely clipped out | 1251 // returns false if the entire rectangle is entirely clipped out |
| 1238 // If non-NULL, The imageFilter parameter will be used to expand the clip | 1252 // If non-NULL, The imageFilter parameter will be used to expand the clip |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 | 1498 |
| 1485 class SkCanvasClipVisitor { | 1499 class SkCanvasClipVisitor { |
| 1486 public: | 1500 public: |
| 1487 virtual ~SkCanvasClipVisitor(); | 1501 virtual ~SkCanvasClipVisitor(); |
| 1488 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1502 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
| 1489 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1503 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
| 1490 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1504 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
| 1491 }; | 1505 }; |
| 1492 | 1506 |
| 1493 #endif | 1507 #endif |
| OLD | NEW |