| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkDraw_DEFINED | 10 #ifndef SkDraw_DEFINED |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 void drawRect(const SkRect&, const SkPaint&) const; | 36 void drawRect(const SkRect&, const SkPaint&) const; |
| 37 /** | 37 /** |
| 38 * To save on mallocs, we allow a flag that tells us that srcPath is | 38 * To save on mallocs, we allow a flag that tells us that srcPath is |
| 39 * mutable, so that we don't have to make copies of it as we transform it. | 39 * mutable, so that we don't have to make copies of it as we transform it. |
| 40 * | 40 * |
| 41 * If prePathMatrix is not null, it should logically be applied before any | 41 * If prePathMatrix is not null, it should logically be applied before any |
| 42 * stroking or other effects. If there are no effects on the paint that | 42 * stroking or other effects. If there are no effects on the paint that |
| 43 * affect the geometry/rasterization, then the pre matrix can just be | 43 * affect the geometry/rasterization, then the pre matrix can just be |
| 44 * pre-concated with the current matrix. | 44 * pre-concated with the current matrix. |
| 45 */ | 45 */ |
| 46 void drawPath(const SkPath& path, const SkPaint& paint, | 46 void drawPath(const SkPath& srcPath, const SkPaint&, |
| 47 const SkMatrix* prePathMatrix, bool pathIsMutable) const { | 47 const SkMatrix* prePathMatrix, bool pathIsMutable) const; |
| 48 this->drawPath(path, paint, prePathMatrix, pathIsMutable, false); | |
| 49 } | |
| 50 | |
| 51 void drawPath(const SkPath& path, const SkPaint& paint) const { | |
| 52 this->drawPath(path, paint, NULL, false, false); | |
| 53 } | |
| 54 | |
| 55 void drawBitmap(const SkBitmap&, const SkMatrix&, const SkPaint&) const; | 48 void drawBitmap(const SkBitmap&, const SkMatrix&, const SkPaint&) const; |
| 56 void drawSprite(const SkBitmap&, int x, int y, const SkPaint&) const; | 49 void drawSprite(const SkBitmap&, int x, int y, const SkPaint&) const; |
| 57 void drawText(const char text[], size_t byteLength, SkScalar x, | 50 void drawText(const char text[], size_t byteLength, SkScalar x, |
| 58 SkScalar y, const SkPaint& paint) const; | 51 SkScalar y, const SkPaint& paint) const; |
| 59 void drawPosText(const char text[], size_t byteLength, | 52 void drawPosText(const char text[], size_t byteLength, |
| 60 const SkScalar pos[], SkScalar constY, | 53 const SkScalar pos[], SkScalar constY, |
| 61 int scalarsPerPosition, const SkPaint& paint) const; | 54 int scalarsPerPosition, const SkPaint& paint) const; |
| 62 void drawTextOnPath(const char text[], size_t byteLength, | 55 void drawTextOnPath(const char text[], size_t byteLength, |
| 63 const SkPath&, const SkMatrix*, const SkPaint&) const; | 56 const SkPath&, const SkMatrix*, const SkPaint&) const; |
| 64 #ifdef SK_BUILD_FOR_ANDROID | 57 #ifdef SK_BUILD_FOR_ANDROID |
| 65 void drawPosTextOnPath(const char text[], size_t byteLength, | 58 void drawPosTextOnPath(const char text[], size_t byteLength, |
| 66 const SkPoint pos[], const SkPaint& paint, | 59 const SkPoint pos[], const SkPaint& paint, |
| 67 const SkPath& path, const SkMatrix* matrix) const; | 60 const SkPath& path, const SkMatrix* matrix) const; |
| 68 #endif | 61 #endif |
| 69 void drawVertices(SkCanvas::VertexMode mode, int count, | 62 void drawVertices(SkCanvas::VertexMode mode, int count, |
| 70 const SkPoint vertices[], const SkPoint textures[], | 63 const SkPoint vertices[], const SkPoint textures[], |
| 71 const SkColor colors[], SkXfermode* xmode, | 64 const SkColor colors[], SkXfermode* xmode, |
| 72 const uint16_t indices[], int ptCount, | 65 const uint16_t indices[], int ptCount, |
| 73 const SkPaint& paint) const; | 66 const SkPaint& paint) const; |
| 74 | 67 |
| 75 /** | 68 void drawPath(const SkPath& src, const SkPaint& paint) const { |
| 76 * Overwrite the target with the path's coverage (i.e. its mask). | 69 this->drawPath(src, paint, NULL, false); |
| 77 * Will overwrite the entire device, so it need not be zero'd first. | |
| 78 * | |
| 79 * Only device A8 is supported right now. | |
| 80 */ | |
| 81 void drawPathCoverage(const SkPath& src, const SkPaint& paint) const { | |
| 82 this->drawPath(src, paint, NULL, false, true); | |
| 83 } | 70 } |
| 84 | 71 |
| 85 /** Helper function that creates a mask from a path and an optional maskfilt
er. | 72 /** Helper function that creates a mask from a path and an optional maskfilt
er. |
| 86 Note however, that the resulting mask will not have been actually filter
ed, | 73 Note however, that the resulting mask will not have been actually filter
ed, |
| 87 that must be done afterwards (by calling filterMask). The maskfilter is
provided | 74 that must be done afterwards (by calling filterMask). The maskfilter is
provided |
| 88 solely to assist in computing the mask's bounds (if the mode requests th
at). | 75 solely to assist in computing the mask's bounds (if the mode requests th
at). |
| 89 */ | 76 */ |
| 90 static bool DrawToMask(const SkPath& devPath, const SkIRect* clipBounds, | 77 static bool DrawToMask(const SkPath& devPath, const SkIRect* clipBounds, |
| 91 const SkMaskFilter*, const SkMatrix* filterMatrix, | 78 const SkMaskFilter*, const SkMatrix* filterMatrix, |
| 92 SkMask* mask, SkMask::CreateMode mode, | 79 SkMask* mask, SkMask::CreateMode mode, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 113 void drawText_asPaths(const char text[], size_t byteLength, | 100 void drawText_asPaths(const char text[], size_t byteLength, |
| 114 SkScalar x, SkScalar y, const SkPaint&) const; | 101 SkScalar x, SkScalar y, const SkPaint&) const; |
| 115 void drawPosText_asPaths(const char text[], size_t byteLength, | 102 void drawPosText_asPaths(const char text[], size_t byteLength, |
| 116 const SkScalar pos[], SkScalar constY, | 103 const SkScalar pos[], SkScalar constY, |
| 117 int scalarsPerPosition, const SkPaint&) const; | 104 int scalarsPerPosition, const SkPaint&) const; |
| 118 | 105 |
| 119 private: | 106 private: |
| 120 void drawDevMask(const SkMask& mask, const SkPaint&) const; | 107 void drawDevMask(const SkMask& mask, const SkPaint&) const; |
| 121 void drawBitmapAsMask(const SkBitmap&, const SkPaint&) const; | 108 void drawBitmapAsMask(const SkBitmap&, const SkPaint&) const; |
| 122 | 109 |
| 123 void drawPath(const SkPath&, const SkPaint&, const SkMatrix* preMatrix, | |
| 124 bool pathIsMutable, bool drawCoverage) const; | |
| 125 | |
| 126 /** | 110 /** |
| 127 * Return the current clip bounds, in local coordinates, with slop to accou
nt | 111 * Return the current clip bounds, in local coordinates, with slop to accou
nt |
| 128 * for antialiasing or hairlines (i.e. device-bounds outset by 1, and then | 112 * for antialiasing or hairlines (i.e. device-bounds outset by 1, and then |
| 129 * run through the inverse of the matrix). | 113 * run through the inverse of the matrix). |
| 130 * | 114 * |
| 131 * If the matrix cannot be inverted, or the current clip is empty, return | 115 * If the matrix cannot be inverted, or the current clip is empty, return |
| 132 * false and ignore bounds parameter. | 116 * false and ignore bounds parameter. |
| 133 */ | 117 */ |
| 134 bool SK_WARN_UNUSED_RESULT | 118 bool SK_WARN_UNUSED_RESULT |
| 135 computeConservativeLocalClipBounds(SkRect* bounds) const; | 119 computeConservativeLocalClipBounds(SkRect* bounds) const; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 148 SkDrawProcs* fProcs; // optional | 132 SkDrawProcs* fProcs; // optional |
| 149 | 133 |
| 150 #ifdef SK_DEBUG | 134 #ifdef SK_DEBUG |
| 151 void validate() const; | 135 void validate() const; |
| 152 #else | 136 #else |
| 153 void validate() const {} | 137 void validate() const {} |
| 154 #endif | 138 #endif |
| 155 }; | 139 }; |
| 156 | 140 |
| 157 #endif | 141 #endif |
| OLD | NEW |