Index: src/core/SkDevice.cpp |
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp |
index e71c889451df139dd8e92ed28d9e4a2b57ebf084..e71500a962a79f025318bb72169c03cacea8fd22 100644 |
--- a/src/core/SkDevice.cpp |
+++ b/src/core/SkDevice.cpp |
@@ -6,7 +6,9 @@ |
*/ |
#include "SkDevice.h" |
+#include "SkDraw.h" |
#include "SkMetaData.h" |
+#include "SkPatchUtils.h" |
SkBaseDevice::SkBaseDevice() |
: fLeakyProperties(SkDeviceProperties::MakeDefault()) |
@@ -77,6 +79,17 @@ void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, |
this->drawPath(draw, path, paint, preMatrix, pathIsMutable); |
} |
+void SkBaseDevice::drawPatch(const SkDraw& draw, const SkPatch& patch, const SkPaint& paint) { |
+ SkPatch::VertexData data; |
+ |
+ SkISize lod = SkPatchUtils::GetLevelOfDetail(patch, draw.fMatrix); |
+ |
+ // It automatically adjusts lodX and lodY in case it exceeds the number of indices. |
+ patch.getVertexData(&data, lod.width(), lod.height()); |
+ this->drawVertices(draw, SkCanvas::kTriangles_VertexMode, data.fVertexCount, data.fPoints, |
+ data.fTexCoords, data.fColors, NULL, data.fIndices, data.fIndexCount, paint); |
+} |
+ |
bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowBytes, int x, int y) { |
#ifdef SK_DEBUG |
SkASSERT(info.width() > 0 && info.height() > 0); |