aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkDevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkDevice.cpp')
-rw-r--r--src/core/SkDevice.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 0ff094d73b..3a4090e2d3 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -88,11 +88,11 @@ void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
void SkBaseDevice::drawPatch(const SkDraw& draw, const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) {
SkPatchUtils::VertexData data;
-
+
SkISize lod = SkPatchUtils::GetLevelOfDetail(cubics, draw.fMatrix);
// It automatically adjusts lodX and lodY in case it exceeds the number of indices.
- // If it fails to generate the vertices, then we do not draw.
+ // If it fails to generate the vertices, then we do not draw.
if (SkPatchUtils::getVertexData(&data, cubics, colors, texCoords, lod.width(), lod.height())) {
this->drawVertices(draw, SkCanvas::kTriangles_VertexMode, data.fVertexCount, data.fPoints,
data.fTexCoords, data.fColors, xmode, data.fIndices, data.fIndexCount,
@@ -176,7 +176,7 @@ void SkBaseDevice::drawImageNine(const SkDraw& draw, const SkImage* image, const
void SkBaseDevice::drawBitmapNine(const SkDraw& draw, const SkBitmap& bitmap, const SkIRect& center,
const SkRect& dst, const SkPaint& paint) {
SkNinePatchIter iter(bitmap.width(), bitmap.height(), center, dst);
-
+
SkRect srcR, dstR;
while (iter.next(&srcR, &dstR)) {
this->drawBitmapRect(draw, bitmap, &srcR, dstR, paint, SkCanvas::kStrict_SrcRectConstraint);
@@ -192,7 +192,7 @@ void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkR
for (int i = 0; i < count; ++i) {
SkPoint quad[4];
xform[i].toQuad(tex[i].width(), tex[i].height(), quad);
-
+
SkMatrix localM;
localM.setRSXform(xform[i]);
localM.preTranslate(-tex[i].left(), -tex[i].top());
@@ -209,7 +209,7 @@ void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkR
if (colors) {
pnt.setColorFilter(SkColorFilter::MakeModeFilter(colors[i], mode));
}
-
+
path.rewind();
path.addPoly(quad, 4, true);
path.setConvexity(SkPath::kConvex_Convexity);
@@ -283,24 +283,24 @@ bool SkBaseDevice::peekPixels(SkPixmap* pmap) {
static void morphpoints(SkPoint dst[], const SkPoint src[], int count,
SkPathMeasure& meas, const SkMatrix& matrix) {
SkMatrix::MapXYProc proc = matrix.getMapXYProc();
-
+
for (int i = 0; i < count; i++) {
SkPoint pos;
SkVector tangent;
-
+
proc(matrix, src[i].fX, src[i].fY, &pos);
SkScalar sx = pos.fX;
SkScalar sy = pos.fY;
-
+
if (!meas.getPosTan(sx, &pos, &tangent)) {
// set to 0 if the measure failed, so that we just set dst == pos
tangent.set(0, 0);
}
-
+
/* This is the old way (that explains our approach but is way too slow
SkMatrix matrix;
SkPoint pt;
-
+
pt.set(sx, sy);
matrix.setSinCos(tangent.fY, tangent.fX);
matrix.preTranslate(-sx, 0);
@@ -313,7 +313,7 @@ static void morphpoints(SkPoint dst[], const SkPoint src[], int count,
}
/* TODO
-
+
Need differentially more subdivisions when the follow-path is curvy. Not sure how to
determine that, but we need it. I guess a cheap answer is let the caller tell us,
but that seems like a cop-out. Another answer is to get Rob Johnson to figure it out.
@@ -323,7 +323,7 @@ static void morphpath(SkPath* dst, const SkPath& src, SkPathMeasure& meas,
SkPath::Iter iter(src, false);
SkPoint srcP[4], dstP[3];
SkPath::Verb verb;
-
+
while ((verb = iter.next(srcP)) != SkPath::kDone_Verb) {
switch (verb) {
case SkPath::kMove_Verb:
@@ -359,16 +359,16 @@ void SkBaseDevice::drawTextOnPath(const SkDraw& draw, const void* text, size_t b
const SkPath& follow, const SkMatrix* matrix,
const SkPaint& paint) {
SkASSERT(byteLength == 0 || text != nullptr);
-
+
// nothing to draw
if (text == nullptr || byteLength == 0 || draw.fRC->isEmpty()) {
return;
}
-
+
SkTextToPathIter iter((const char*)text, byteLength, paint, true);
SkPathMeasure meas(follow, false);
SkScalar hOffset = 0;
-
+
// need to measure first
if (paint.getTextAlign() != SkPaint::kLeft_Align) {
SkScalar pathLen = meas.getLength();
@@ -377,19 +377,19 @@ void SkBaseDevice::drawTextOnPath(const SkDraw& draw, const void* text, size_t b
}
hOffset += pathLen;
}
-
+
const SkPath* iterPath;
SkScalar xpos;
SkMatrix scaledMatrix;
SkScalar scale = iter.getPathScale();
-
+
scaledMatrix.setScale(scale, scale);
-
+
while (iter.next(&iterPath, &xpos)) {
if (iterPath) {
SkPath tmp;
SkMatrix m(scaledMatrix);
-
+
tmp.setIsVolatile(true);
m.postTranslate(xpos + hOffset, 0);
if (matrix) {