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

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

Issue 247983003: Revert of make drawText calls non-virtual, to ease SkFont and TextBlob (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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/skia_for_chromium_defines.gypi ('k') | include/utils/SkDeferredCanvas.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
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkDeque.h" 13 #include "SkDeque.h"
14 #include "SkClipStack.h" 14 #include "SkClipStack.h"
15 #include "SkPaint.h" 15 #include "SkPaint.h"
16 #include "SkRefCnt.h" 16 #include "SkRefCnt.h"
17 #include "SkPath.h" 17 #include "SkPath.h"
18 #include "SkRegion.h" 18 #include "SkRegion.h"
19 #include "SkXfermode.h" 19 #include "SkXfermode.h"
20 20
21 // if not defined, we always assume ClipToLayer for saveLayer() 21 // if not defined, we always assume ClipToLayer for saveLayer()
22 //#define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG 22 //#define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
23 23
24 24
25 //#define SK_SUPPORT_LEGACY_GETCLIPTYPE 25 //#define SK_SUPPORT_LEGACY_GETCLIPTYPE
26 //#define SK_SUPPORT_LEGACY_GETTOTALCLIP 26 //#define SK_SUPPORT_LEGACY_GETTOTALCLIP
27 //#define SK_SUPPORT_LEGACY_GETTOPDEVICE 27 //#define SK_SUPPORT_LEGACY_GETTOPDEVICE
28 28
29 //#define SK_SUPPORT_LEGACY_DRAWTEXT_VIRTUAL
30 #ifdef SK_SUPPORT_LEGACY_DRAWTEXT_VIRTUAL
31 #define SK_LEGACY_DRAWTEXT_VIRTUAL virtual
32 #else
33 #define SK_LEGACY_DRAWTEXT_VIRTUAL
34 #endif
35
36 class SkBounder; 29 class SkBounder;
37 class SkBaseDevice; 30 class SkBaseDevice;
38 class SkDraw; 31 class SkDraw;
39 class SkDrawFilter; 32 class SkDrawFilter;
40 class SkMetaData; 33 class SkMetaData;
41 class SkPicture; 34 class SkPicture;
42 class SkRRect; 35 class SkRRect;
43 class SkSurface; 36 class SkSurface;
44 class SkSurface_Base; 37 class SkSurface_Base;
45 class GrContext; 38 class GrContext;
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 const SkPaint* paint = NULL); 861 const SkPaint* paint = NULL);
869 862
870 /** Draw the text, with origin at (x,y), using the specified paint. 863 /** Draw the text, with origin at (x,y), using the specified paint.
871 The origin is interpreted based on the Align setting in the paint. 864 The origin is interpreted based on the Align setting in the paint.
872 @param text The text to be drawn 865 @param text The text to be drawn
873 @param byteLength The number of bytes to read from the text parameter 866 @param byteLength The number of bytes to read from the text parameter
874 @param x The x-coordinate of the origin of the text being drawn 867 @param x The x-coordinate of the origin of the text being drawn
875 @param y The y-coordinate of the origin of the text being drawn 868 @param y The y-coordinate of the origin of the text being drawn
876 @param paint The paint used for the text (e.g. color, size, style) 869 @param paint The paint used for the text (e.g. color, size, style)
877 */ 870 */
878 SK_LEGACY_DRAWTEXT_VIRTUAL void drawText(const void* text, size_t byteLength , SkScalar x, 871 virtual void drawText(const void* text, size_t byteLength, SkScalar x,
879 SkScalar y, const SkPaint& paint); 872 SkScalar y, const SkPaint& paint);
880 873
881 /** Draw the text, with each character/glyph origin specified by the pos[] 874 /** Draw the text, with each character/glyph origin specified by the pos[]
882 array. The origin is interpreted by the Align setting in the paint. 875 array. The origin is interpreted by the Align setting in the paint.
883 @param text The text to be drawn 876 @param text The text to be drawn
884 @param byteLength The number of bytes to read from the text parameter 877 @param byteLength The number of bytes to read from the text parameter
885 @param pos Array of positions, used to position each character 878 @param pos Array of positions, used to position each character
886 @param paint The paint used for the text (e.g. color, size, style) 879 @param paint The paint used for the text (e.g. color, size, style)
887 */ 880 */
888 SK_LEGACY_DRAWTEXT_VIRTUAL void drawPosText(const void* text, size_t byteLen gth, 881 virtual void drawPosText(const void* text, size_t byteLength,
889 const SkPoint pos[], const SkPaint& paint); 882 const SkPoint pos[], const SkPaint& paint);
890 883
891 /** Draw the text, with each character/glyph origin specified by the x 884 /** Draw the text, with each character/glyph origin specified by the x
892 coordinate taken from the xpos[] array, and the y from the constY param. 885 coordinate taken from the xpos[] array, and the y from the constY param.
893 The origin is interpreted by the Align setting in the paint. 886 The origin is interpreted by the Align setting in the paint.
894 @param text The text to be drawn 887 @param text The text to be drawn
895 @param byteLength The number of bytes to read from the text parameter 888 @param byteLength The number of bytes to read from the text parameter
896 @param xpos Array of x-positions, used to position each character 889 @param xpos Array of x-positions, used to position each character
897 @param constY The shared Y coordinate for all of the positions 890 @param constY The shared Y coordinate for all of the positions
898 @param paint The paint used for the text (e.g. color, size, style) 891 @param paint The paint used for the text (e.g. color, size, style)
899 */ 892 */
900 SK_LEGACY_DRAWTEXT_VIRTUAL void drawPosTextH(const void* text, size_t byteLe ngth, 893 virtual void drawPosTextH(const void* text, size_t byteLength,
901 const SkScalar xpos[], SkScalar constY, 894 const SkScalar xpos[], SkScalar constY,
902 const SkPaint& paint); 895 const SkPaint& paint);
903 896
904 /** Draw the text, with origin at (x,y), using the specified paint, along 897 /** Draw the text, with origin at (x,y), using the specified paint, along
905 the specified path. The paint's Align setting determins where along the 898 the specified path. The paint's Align setting determins where along the
906 path to start the text. 899 path to start the text.
907 @param text The text to be drawn 900 @param text The text to be drawn
908 @param byteLength The number of bytes to read from the text parameter 901 @param byteLength The number of bytes to read from the text parameter
909 @param path The path the text should follow for its baseline 902 @param path The path the text should follow for its baseline
910 @param hOffset The distance along the path to add to the text's 903 @param hOffset The distance along the path to add to the text's
911 starting position 904 starting position
912 @param vOffset The distance above(-) or below(+) the path to 905 @param vOffset The distance above(-) or below(+) the path to
913 position the text 906 position the text
914 @param paint The paint used for the text 907 @param paint The paint used for the text
915 */ 908 */
916 void drawTextOnPathHV(const void* text, size_t byteLength, 909 void drawTextOnPathHV(const void* text, size_t byteLength,
917 const SkPath& path, SkScalar hOffset, 910 const SkPath& path, SkScalar hOffset,
918 SkScalar vOffset, const SkPaint& paint); 911 SkScalar vOffset, const SkPaint& paint);
919 912
920 /** Draw the text, with origin at (x,y), using the specified paint, along 913 /** Draw the text, with origin at (x,y), using the specified paint, along
921 the specified path. The paint's Align setting determins where along the 914 the specified path. The paint's Align setting determins where along the
922 path to start the text. 915 path to start the text.
923 @param text The text to be drawn 916 @param text The text to be drawn
924 @param byteLength The number of bytes to read from the text parameter 917 @param byteLength The number of bytes to read from the text parameter
925 @param path The path the text should follow for its baseline 918 @param path The path the text should follow for its baseline
926 @param matrix (may be null) Applied to the text before it is 919 @param matrix (may be null) Applied to the text before it is
927 mapped onto the path 920 mapped onto the path
928 @param paint The paint used for the text 921 @param paint The paint used for the text
929 */ 922 */
930 SK_LEGACY_DRAWTEXT_VIRTUAL void drawTextOnPath(const void* text, size_t byte Length, 923 virtual void drawTextOnPath(const void* text, size_t byteLength,
931 const SkPath& path, const SkMatrix* matrix, 924 const SkPath& path, const SkMatrix* matrix,
932 const SkPaint& paint); 925 const SkPaint& paint);
933 926
934 /** PRIVATE / EXPERIMENTAL -- do not call 927 /** PRIVATE / EXPERIMENTAL -- do not call
935 Perform back-end analysis/optimization of a picture. This may attach 928 Perform back-end analysis/optimization of a picture. This may attach
936 optimization data to the picture which can be used by a later 929 optimization data to the picture which can be used by a later
937 drawPicture call. 930 drawPicture call.
938 @param picture The recorded drawing commands to analyze/optimize 931 @param picture The recorded drawing commands to analyze/optimize
939 */ 932 */
940 void EXPERIMENTAL_optimize(SkPicture* picture); 933 void EXPERIMENTAL_optimize(SkPicture* picture);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 }; 1179 };
1187 virtual void willSave(SaveFlags); 1180 virtual void willSave(SaveFlags);
1188 virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveF lags); 1181 virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveF lags);
1189 virtual void willRestore(); 1182 virtual void willRestore();
1190 1183
1191 virtual void didConcat(const SkMatrix&); 1184 virtual void didConcat(const SkMatrix&);
1192 virtual void didSetMatrix(const SkMatrix&); 1185 virtual void didSetMatrix(const SkMatrix&);
1193 1186
1194 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); 1187 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&);
1195 1188
1196 #ifndef SK_SUPPORT_LEGACY_DRAWTEXT_VIRTUAL
1197 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x,
1198 SkScalar y, const SkPaint& paint);
1199
1200 virtual void onDrawPosText(const void* text, size_t byteLength,
1201 const SkPoint pos[], const SkPaint& paint);
1202
1203 virtual void onDrawPosTextH(const void* text, size_t byteLength,
1204 const SkScalar xpos[], SkScalar constY,
1205 const SkPaint& paint);
1206
1207 virtual void onDrawTextOnPath(const void* text, size_t byteLength,
1208 const SkPath& path, const SkMatrix* matrix,
1209 const SkPaint& paint);
1210 #endif
1211
1212 enum ClipEdgeStyle { 1189 enum ClipEdgeStyle {
1213 kHard_ClipEdgeStyle, 1190 kHard_ClipEdgeStyle,
1214 kSoft_ClipEdgeStyle 1191 kSoft_ClipEdgeStyle
1215 }; 1192 };
1216 1193
1217 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle); 1194 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle);
1218 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle); 1195 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle);
1219 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle); 1196 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle);
1220 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op); 1197 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op);
1221 1198
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 bool asROBitmap(SkBitmap*) const; 1435 bool asROBitmap(SkBitmap*) const;
1459 1436
1460 private: 1437 private:
1461 SkBitmap fBitmap; // used if peekPixels() fails 1438 SkBitmap fBitmap; // used if peekPixels() fails
1462 const void* fAddr; // NULL on failure 1439 const void* fAddr; // NULL on failure
1463 SkImageInfo fInfo; 1440 SkImageInfo fInfo;
1464 size_t fRowBytes; 1441 size_t fRowBytes;
1465 }; 1442 };
1466 1443
1467 #endif 1444 #endif
OLDNEW
« no previous file with comments | « gyp/skia_for_chromium_defines.gypi ('k') | include/utils/SkDeferredCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698