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