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 |
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 "SkPatchUtils.h" | |
reed1
2014/08/12 13:33:02
Does SkCanvas.h need this header?
dandov
2014/08/12 15:23:30
Removed header from SkCanvas.h and add it where it
| |
16 #include "SkRefCnt.h" | 17 #include "SkRefCnt.h" |
17 #include "SkPatch.h" | |
18 #include "SkPath.h" | 18 #include "SkPath.h" |
19 #include "SkRegion.h" | 19 #include "SkRegion.h" |
20 #include "SkXfermode.h" | 20 #include "SkXfermode.h" |
21 | 21 |
22 #ifdef SK_SUPPORT_LEGACY_DRAWTEXT_VIRTUAL | 22 #ifdef SK_SUPPORT_LEGACY_DRAWTEXT_VIRTUAL |
23 #define SK_LEGACY_DRAWTEXT_VIRTUAL virtual | 23 #define SK_LEGACY_DRAWTEXT_VIRTUAL virtual |
24 #else | 24 #else |
25 #define SK_LEGACY_DRAWTEXT_VIRTUAL | 25 #define SK_LEGACY_DRAWTEXT_VIRTUAL |
26 #endif | 26 #endif |
27 | 27 |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1015 vertex (texs, colors) array. | 1015 vertex (texs, colors) array. |
1016 @param indexCount number of entries in the indices array (if not null) | 1016 @param indexCount number of entries in the indices array (if not null) |
1017 @param paint Specifies the shader/texture if present. | 1017 @param paint Specifies the shader/texture if present. |
1018 */ | 1018 */ |
1019 virtual void drawVertices(VertexMode vmode, int vertexCount, | 1019 virtual void drawVertices(VertexMode vmode, int vertexCount, |
1020 const SkPoint vertices[], const SkPoint texs[], | 1020 const SkPoint vertices[], const SkPoint texs[], |
1021 const SkColor colors[], SkXfermode* xmode, | 1021 const SkColor colors[], SkXfermode* xmode, |
1022 const uint16_t indices[], int indexCount, | 1022 const uint16_t indices[], int indexCount, |
1023 const SkPaint& paint); | 1023 const SkPaint& paint); |
1024 | 1024 |
1025 /** | 1025 /** |
1026 Draw a cubic coons patch | |
1026 | 1027 |
1027 Draw a SkPatch | 1028 @param cubic specifies the 4 bounding cubic bezier curves of a patch with c lockwise order |
1028 | 1029 starting at the top left corner. |
1029 @param patch specifies the 4 bounding cubic bezier curves of a patch. | 1030 @param colors specifies the colors for the corners which will be bilerp acr oss the patch, |
1031 their order is clockwise starting at the top left corner. | |
1032 @param texCoords specifies the texture coordinates that will be bilerp acro ss the patch, | |
1033 their order is the same as the colors. | |
1034 @param xmode specifies how are the colors and the textures combined if both of them are | |
1035 present. | |
1030 @param paint Specifies the shader/texture if present. | 1036 @param paint Specifies the shader/texture if present. |
1031 */ | 1037 */ |
1032 virtual void drawPatch(const SkPatch& patch, const SkPaint& paint); | 1038 void drawPatch(const SkPoint cubics[12], const SkColor colors[4], |
1039 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint); | |
1033 | 1040 |
1034 /** Send a blob of data to the canvas. | 1041 /** Send a blob of data to the canvas. |
1035 For canvases that draw, this call is effectively a no-op, as the data | 1042 For canvases that draw, this call is effectively a no-op, as the data |
1036 is not parsed, but just ignored. However, this call exists for | 1043 is not parsed, but just ignored. However, this call exists for |
1037 subclasses like SkPicture's recording canvas, that can store the data | 1044 subclasses like SkPicture's recording canvas, that can store the data |
1038 and then play it back later (via another call to drawData). | 1045 and then play it back later (via another call to drawData). |
1039 */ | 1046 */ |
1040 virtual void drawData(const void* data, size_t length) { | 1047 virtual void drawData(const void* data, size_t length) { |
1041 // do nothing. Subclasses may do something with the data | 1048 // do nothing. Subclasses may do something with the data |
1042 } | 1049 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1217 virtual void onDrawPosText(const void* text, size_t byteLength, | 1224 virtual void onDrawPosText(const void* text, size_t byteLength, |
1218 const SkPoint pos[], const SkPaint& paint); | 1225 const SkPoint pos[], const SkPaint& paint); |
1219 | 1226 |
1220 virtual void onDrawPosTextH(const void* text, size_t byteLength, | 1227 virtual void onDrawPosTextH(const void* text, size_t byteLength, |
1221 const SkScalar xpos[], SkScalar constY, | 1228 const SkScalar xpos[], SkScalar constY, |
1222 const SkPaint& paint); | 1229 const SkPaint& paint); |
1223 | 1230 |
1224 virtual void onDrawTextOnPath(const void* text, size_t byteLength, | 1231 virtual void onDrawTextOnPath(const void* text, size_t byteLength, |
1225 const SkPath& path, const SkMatrix* matrix, | 1232 const SkPath& path, const SkMatrix* matrix, |
1226 const SkPaint& paint); | 1233 const SkPaint& paint); |
1234 | |
1235 virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], | |
1236 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint); | |
1227 | 1237 |
1228 enum ClipEdgeStyle { | 1238 enum ClipEdgeStyle { |
1229 kHard_ClipEdgeStyle, | 1239 kHard_ClipEdgeStyle, |
1230 kSoft_ClipEdgeStyle | 1240 kSoft_ClipEdgeStyle |
1231 }; | 1241 }; |
1232 | 1242 |
1233 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle); | 1243 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle); |
1234 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle); | 1244 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle); |
1235 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle); | 1245 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle); |
1236 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op); | 1246 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op); |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1496 | 1506 |
1497 class SkCanvasClipVisitor { | 1507 class SkCanvasClipVisitor { |
1498 public: | 1508 public: |
1499 virtual ~SkCanvasClipVisitor(); | 1509 virtual ~SkCanvasClipVisitor(); |
1500 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1510 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1501 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1511 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1502 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1512 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1503 }; | 1513 }; |
1504 | 1514 |
1505 #endif | 1515 #endif |
OLD | NEW |