Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Unified Diff: src/core/SkDevice.cpp

Issue 424663006: SkCanvas interface for drawing a patch. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixed implicit casting in patch.cpp Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkPatch.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkPatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698