SkCanvas interface for drawing a patch.

Added function SkCanvas::drawPatch to the API. This function
receives the patch to draw and the paint.

Added function SkBaseDevice::drawPatch to the API. This function also receives the patch to draw and the paint.

Currently SkGpuDevice and SkBitmapDevice generate the mesh taking into
account the scale factor and call the corresponding device's drawVertices.

BUG=skia:
R=jvanverth@google.com, egdaniel@google.com, bsalomon@google.com

Author: dandov@google.com

Review URL: https://codereview.chromium.org/424663006
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index e71c889..e71500a 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 @@
     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);