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

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

Issue 313613004: Alter SkCanvas::drawPicture (devirtualize, take const SkPicture, take pointer) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add staging entry point for Chromium and Android Created 6 years, 6 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 | « gyp/skia_for_chromium_defines.gypi ('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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 SK_LEGACY_DRAWTEXT_VIRTUAL void drawTextOnPath(const void* text, size_t byte Length, 962 SK_LEGACY_DRAWTEXT_VIRTUAL void drawTextOnPath(const void* text, size_t byte Length,
963 const SkPath& path, const SkMatrix* matrix, 963 const SkPath& path, const SkMatrix* matrix,
964 const SkPaint& paint); 964 const SkPaint& paint);
965 965
966 /** PRIVATE / EXPERIMENTAL -- do not call 966 /** PRIVATE / EXPERIMENTAL -- do not call
967 Perform back-end analysis/optimization of a picture. This may attach 967 Perform back-end analysis/optimization of a picture. This may attach
968 optimization data to the picture which can be used by a later 968 optimization data to the picture which can be used by a later
969 drawPicture call. 969 drawPicture call.
970 @param picture The recorded drawing commands to analyze/optimize 970 @param picture The recorded drawing commands to analyze/optimize
971 */ 971 */
972 void EXPERIMENTAL_optimize(SkPicture* picture); 972 void EXPERIMENTAL_optimize(const SkPicture* picture);
973 973
974 /** PRIVATE / EXPERIMENTAL -- do not call 974 /** PRIVATE / EXPERIMENTAL -- do not call
975 Purge all the discardable optimization information associated with 975 Purge all the discardable optimization information associated with
976 'picture'. If NULL is passed in, purge all discardable information. 976 'picture'. If NULL is passed in, purge all discardable information.
977 */ 977 */
978 void EXPERIMENTAL_purge(SkPicture* picture); 978 void EXPERIMENTAL_purge(const SkPicture* picture);
979 979
980 /** Draw the picture into this canvas. This method effective brackets the 980 /** Draw the picture into this canvas. This method effective brackets the
981 playback of the picture's draw calls with save/restore, so the state 981 playback of the picture's draw calls with save/restore, so the state
982 of this canvas will be unchanged after this call. 982 of this canvas will be unchanged after this call.
983 @param picture The recorded drawing commands to playback into this 983 @param picture The recorded drawing commands to playback into this
984 canvas. 984 canvas.
985 */ 985 */
986 virtual void drawPicture(SkPicture& picture); 986 void drawPicture(const SkPicture* picture);
mtklein 2014/06/03 22:23:23 How come these aren't all const SkPicture&?
robertphillips 2014/06/03 23:17:21 It seems/seemed at bit odd to pass by reference so
987
988 #ifdef SK_SUPPORT_LEGACY_DRAWPICTURE_API
989 virtual void drawPicture(SkPicture& picture) {
990 this->drawPicture(&picture);
991 }
992 #endif
987 993
988 enum VertexMode { 994 enum VertexMode {
989 kTriangles_VertexMode, 995 kTriangles_VertexMode,
990 kTriangleStrip_VertexMode, 996 kTriangleStrip_VertexMode,
991 kTriangleFan_VertexMode 997 kTriangleFan_VertexMode
992 }; 998 };
993 999
994 /** Draw the array of vertices, interpreted as triangles (based on mode). 1000 /** Draw the array of vertices, interpreted as triangles (based on mode).
995 1001
996 If both textures and vertex-colors are NULL, it strokes hairlines with 1002 If both textures and vertex-colors are NULL, it strokes hairlines with
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 kSoft_ClipEdgeStyle 1241 kSoft_ClipEdgeStyle
1236 }; 1242 };
1237 1243
1238 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle); 1244 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle);
1239 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle); 1245 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle);
1240 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle); 1246 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle);
1241 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op); 1247 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op);
1242 1248
1243 virtual void onDiscard(); 1249 virtual void onDiscard();
1244 1250
1251 virtual void onDrawPicture(const SkPicture* picture);
1252
1245 // Returns the canvas to be used by DrawIter. Default implementation 1253 // Returns the canvas to be used by DrawIter. Default implementation
1246 // returns this. Subclasses that encapsulate an indirect canvas may 1254 // returns this. Subclasses that encapsulate an indirect canvas may
1247 // need to overload this method. The impl must keep track of this, as it 1255 // need to overload this method. The impl must keep track of this, as it
1248 // is not released or deleted by the caller. 1256 // is not released or deleted by the caller.
1249 virtual SkCanvas* canvasForDrawIter(); 1257 virtual SkCanvas* canvasForDrawIter();
1250 1258
1251 // Clip rectangle bounds. Called internally by saveLayer. 1259 // Clip rectangle bounds. Called internally by saveLayer.
1252 // returns false if the entire rectangle is entirely clipped out 1260 // returns false if the entire rectangle is entirely clipped out
1253 // If non-NULL, The imageFilter parameter will be used to expand the clip 1261 // If non-NULL, The imageFilter parameter will be used to expand the clip
1254 // and offscreen bounds for any margin required by the filter DAG. 1262 // and offscreen bounds for any margin required by the filter DAG.
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 } 1499 }
1492 1500
1493 static inline SkCanvas::SaveFlags& operator|=(SkCanvas::SaveFlags& lhs, 1501 static inline SkCanvas::SaveFlags& operator|=(SkCanvas::SaveFlags& lhs,
1494 const SkCanvas::SaveFlags rhs) { 1502 const SkCanvas::SaveFlags rhs) {
1495 lhs = lhs | rhs; 1503 lhs = lhs | rhs;
1496 return lhs; 1504 return lhs;
1497 } 1505 }
1498 1506
1499 1507
1500 #endif 1508 #endif
OLDNEW
« no previous file with comments | « gyp/skia_for_chromium_defines.gypi ('k') | include/core/SkDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698