Remove public version of SkMatrix::mapPointsWithStride.
Use private version already in SkMatrixPriv. Change-Id: I6e9546afdf2b072402f9deecec99a6d236e2c7f4 Reviewed-on: https://skia-review.googlesource.com/91400 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
cea2271970
commit
fa3783f17d
@ -82,7 +82,6 @@ improve performance. Matrix is not thread safe unless getType is called first.
|
|||||||
# isTranslate # Returns if transform is limited to translate. ##
|
# isTranslate # Returns if transform is limited to translate. ##
|
||||||
# mapHomogeneousPoints # Maps Point3 array. ##
|
# mapHomogeneousPoints # Maps Point3 array. ##
|
||||||
# mapPoints # Maps Point array. ##
|
# mapPoints # Maps Point array. ##
|
||||||
# mapPointsWithStride # Maps Point array with padding. ##
|
|
||||||
# mapRadius # Returns mean radius of mapped Circle. ##
|
# mapRadius # Returns mean radius of mapped Circle. ##
|
||||||
# mapRect # Returns bounds of mapped Rect. ##
|
# mapRect # Returns bounds of mapped Rect. ##
|
||||||
# mapRectScaleTranslate # Returns bounds of mapped Rect. ##
|
# mapRectScaleTranslate # Returns bounds of mapped Rect. ##
|
||||||
@ -3203,7 +3202,7 @@ src and dst may point to the same storage.
|
|||||||
}
|
}
|
||||||
##
|
##
|
||||||
|
|
||||||
#SeeAlso mapPointsWithStride mapXY mapHomogeneousPoints mapVectors
|
#SeeAlso mapXY mapHomogeneousPoints mapVectors
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@ -3257,56 +3256,7 @@ Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
|
|||||||
}
|
}
|
||||||
##
|
##
|
||||||
|
|
||||||
#SeeAlso mapPointsWithStride mapXY mapHomogeneousPoints mapVectors
|
#SeeAlso mapXY mapHomogeneousPoints mapVectors
|
||||||
|
|
||||||
##
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#Method void mapPointsWithStride(SkPoint pts[], size_t stride, int count) const
|
|
||||||
|
|
||||||
Maps count pts, skipping stride bytes to advance from one Point to the next.
|
|
||||||
Points are mapped by multiplying each Point by Matrix. Given:
|
|
||||||
|
|
||||||
#Code
|
|
||||||
#Literal
|
|
||||||
| A B C | | x |
|
|
||||||
Matrix = | D E F |, pt = | y |
|
|
||||||
| G H I | | 1 |
|
|
||||||
##
|
|
||||||
|
|
||||||
each resulting pts Point is computed as:
|
|
||||||
|
|
||||||
#Code
|
|
||||||
#Literal
|
|
||||||
|A B C| |x| Ax+By+C Dx+Ey+F
|
|
||||||
Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
|
|
||||||
|G H I| |1| Gx+Hy+I Gx+Hy+I
|
|
||||||
##
|
|
||||||
|
|
||||||
#Param pts storage for mapped Points ##
|
|
||||||
#Param stride size of record starting with Point, in bytes ##
|
|
||||||
#Param count number of Points to transform ##
|
|
||||||
|
|
||||||
#Example
|
|
||||||
SkMatrix matrix;
|
|
||||||
matrix.reset();
|
|
||||||
struct PointZ {
|
|
||||||
SkPoint fPt;
|
|
||||||
SkPoint fStationary;
|
|
||||||
} pts[] = {{{40, 70}, {40, 70}}, {{180, 70}, {180, 70}}, {{180, 220}, {180, 220}},
|
|
||||||
{{40, 220}, {40, 220}}};
|
|
||||||
constexpr int count = SK_ARRAY_COUNT(pts);
|
|
||||||
SkPaint paint;
|
|
||||||
paint.setARGB(77, 23, 99, 154);
|
|
||||||
for (int i = 0; i < 5; ++i) {
|
|
||||||
matrix.preRotate(10, 128, 128);
|
|
||||||
matrix.mapPointsWithStride(&pts[0].fPt, sizeof(PointZ), count);
|
|
||||||
canvas->drawPoints(SkCanvas::kPolygon_PointMode, count * 2, &pts[0].fPt, paint);
|
|
||||||
}
|
|
||||||
##
|
|
||||||
|
|
||||||
#SeeAlso mapPoints mapXY mapHomogeneousPoints mapVectors
|
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@ -3363,7 +3313,7 @@ Matrix * src = |D E F| |y| = |Ax+By+Cz Dx+Ey+Fz Gx+Hy+Iz|
|
|||||||
debugster(src);
|
debugster(src);
|
||||||
##
|
##
|
||||||
|
|
||||||
#SeeAlso mapPoints mapXY mapPointsWithStride mapVectors
|
#SeeAlso mapPoints mapXY mapVectors
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@ -3408,7 +3358,7 @@ Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
|
|||||||
canvas->drawPoints(SkCanvas::kPolygon_PointMode, SK_ARRAY_COUNT(lines), lines, paint);
|
canvas->drawPoints(SkCanvas::kPolygon_PointMode, SK_ARRAY_COUNT(lines), lines, paint);
|
||||||
##
|
##
|
||||||
|
|
||||||
#SeeAlso mapPoints mapPointsWithStride mapVectors
|
#SeeAlso mapPoints mapVectors
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@ -3457,7 +3407,7 @@ canvas->concat(matrix);
|
|||||||
canvas->drawBitmap(source, 0, 0);
|
canvas->drawBitmap(source, 0, 0);
|
||||||
##
|
##
|
||||||
|
|
||||||
#SeeAlso mapPoints mapPointsWithStride mapVectors
|
#SeeAlso mapPoints mapVectors
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@ -3519,7 +3469,7 @@ src and dst may point to the same storage.
|
|||||||
}
|
}
|
||||||
##
|
##
|
||||||
|
|
||||||
#SeeAlso mapVector mapPoints mapPointsWithStride mapXY
|
#SeeAlso mapVector mapPoints mapXY
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@ -3575,7 +3525,7 @@ Matrix * vec = |D E 0| |y| = |Ax+By Dx+Ey Gx+Hy+I| = ------- , -------
|
|||||||
}
|
}
|
||||||
##
|
##
|
||||||
|
|
||||||
#SeeAlso mapVector mapPoints mapPointsWithStride mapXY
|
#SeeAlso mapVector mapPoints mapXY
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@ -3624,7 +3574,7 @@ Matrix * vec = |D E 0| |dy| = |A*dx+B*dy D*dx+E*dy G*dx+H*dy+I| = ----------- ,
|
|||||||
}
|
}
|
||||||
##
|
##
|
||||||
|
|
||||||
#SeeAlso mapVectors mapPoints mapPointsWithStride mapXY
|
#SeeAlso mapVectors mapPoints mapXY
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
@ -3674,7 +3624,7 @@ Matrix * vec = |D E 0| |dy| = |A*dx+B*dy D*dx+E*dy G*dx+H*dy+I| = ----------- ,
|
|||||||
}
|
}
|
||||||
##
|
##
|
||||||
|
|
||||||
#SeeAlso mapVectors mapPoints mapPointsWithStride mapXY
|
#SeeAlso mapVectors mapPoints mapXY
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
|
@ -1272,32 +1272,6 @@ public:
|
|||||||
this->mapPoints(pts, pts, count);
|
this->mapPoints(pts, pts, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Maps count pts, skipping stride bytes to advance from one SkPoint to the next.
|
|
||||||
Points are mapped by multiplying each SkPoint by SkMatrix. Given:
|
|
||||||
|
|
||||||
| A B C | | x |
|
|
||||||
Matrix = | D E F |, pt = | y |
|
|
||||||
| G H I | | 1 |
|
|
||||||
|
|
||||||
each resulting pts SkPoint is computed as:
|
|
||||||
|
|
||||||
|A B C| |x| Ax+By+C Dx+Ey+F
|
|
||||||
Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
|
|
||||||
|G H I| |1| Gx+Hy+I Gx+Hy+I
|
|
||||||
|
|
||||||
@param pts storage for mapped points
|
|
||||||
@param stride size of record starting with SkPoint, in bytes
|
|
||||||
@param count number of points to transform
|
|
||||||
*/
|
|
||||||
void mapPointsWithStride(SkPoint pts[], size_t stride, int count) const {
|
|
||||||
SkASSERT(stride >= sizeof(SkPoint));
|
|
||||||
SkASSERT(0 == stride % sizeof(SkScalar));
|
|
||||||
for (int i = 0; i < count; ++i) {
|
|
||||||
this->mapPoints(pts, pts, 1);
|
|
||||||
pts = (SkPoint*)((intptr_t)pts + stride);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Maps src SkPoint3 array of length count to dst SkPoint3 array, which must of length count or
|
/** Maps src SkPoint3 array of length count to dst SkPoint3 array, which must of length count or
|
||||||
greater. SkPoint3 array is mapped by multiplying each SkPoint3 by SkMatrix. Given:
|
greater. SkPoint3 array is mapped by multiplying each SkPoint3 by SkMatrix. Given:
|
||||||
|
|
||||||
|
@ -63,6 +63,24 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Maps count pts, skipping stride bytes to advance from one SkPoint to the next.
|
||||||
|
Points are mapped by multiplying each SkPoint by SkMatrix. Given:
|
||||||
|
|
||||||
|
| A B C | | x |
|
||||||
|
Matrix = | D E F |, pt = | y |
|
||||||
|
| G H I | | 1 |
|
||||||
|
|
||||||
|
each resulting pts SkPoint is computed as:
|
||||||
|
|
||||||
|
|A B C| |x| Ax+By+C Dx+Ey+F
|
||||||
|
Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
|
||||||
|
|G H I| |1| Gx+Hy+I Gx+Hy+I
|
||||||
|
|
||||||
|
@param mx matrix used to map the points
|
||||||
|
@param pts storage for mapped points
|
||||||
|
@param stride size of record starting with SkPoint, in bytes
|
||||||
|
@param count number of points to transform
|
||||||
|
*/
|
||||||
static void MapPointsWithStride(const SkMatrix& mx, SkPoint pts[], size_t stride, int count) {
|
static void MapPointsWithStride(const SkMatrix& mx, SkPoint pts[], size_t stride, int count) {
|
||||||
SkASSERT(stride >= sizeof(SkPoint));
|
SkASSERT(stride >= sizeof(SkPoint));
|
||||||
SkASSERT(0 == stride % sizeof(SkScalar));
|
SkASSERT(0 == stride % sizeof(SkScalar));
|
||||||
@ -106,6 +124,7 @@ public:
|
|||||||
Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
|
Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
|
||||||
|G H I| |1| Gx+Hy+I Gx+Hy+I
|
|G H I| |1| Gx+Hy+I Gx+Hy+I
|
||||||
|
|
||||||
|
@param mx matrix used to map the points
|
||||||
@param dst storage for mapped points
|
@param dst storage for mapped points
|
||||||
@param src points to transform
|
@param src points to transform
|
||||||
@param stride size of record starting with SkPoint, in bytes
|
@param stride size of record starting with SkPoint, in bytes
|
||||||
|
@ -88,7 +88,7 @@ static void generate_aa_fill_rect_geometry(intptr_t verts,
|
|||||||
// create the rotated rect
|
// create the rotated rect
|
||||||
SkPointPriv::SetRectFan(fan0Pos, rect.fLeft, rect.fTop, rect.fRight, rect.fBottom,
|
SkPointPriv::SetRectFan(fan0Pos, rect.fLeft, rect.fTop, rect.fRight, rect.fBottom,
|
||||||
vertexStride);
|
vertexStride);
|
||||||
viewMatrix.mapPointsWithStride(fan0Pos, vertexStride, 4);
|
SkMatrixPriv::MapPointsWithStride(viewMatrix, fan0Pos, vertexStride, 4);
|
||||||
|
|
||||||
// Now create the inset points and then outset the original
|
// Now create the inset points and then outset the original
|
||||||
// rotated points
|
// rotated points
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "GrResourceProvider.h"
|
#include "GrResourceProvider.h"
|
||||||
#include "GrSimpleMeshDrawOpHelper.h"
|
#include "GrSimpleMeshDrawOpHelper.h"
|
||||||
#include "SkGeometry.h"
|
#include "SkGeometry.h"
|
||||||
|
#include "SkMatrixPriv.h"
|
||||||
#include "SkPoint3.h"
|
#include "SkPoint3.h"
|
||||||
#include "SkPointPriv.h"
|
#include "SkPointPriv.h"
|
||||||
#include "SkStroke.h"
|
#include "SkStroke.h"
|
||||||
@ -581,7 +582,8 @@ static void bloat_quad(const SkPoint qpts[3], const SkMatrix* toDevice,
|
|||||||
intersect_lines(a0.fPos, abN, c0.fPos, cbN, &b0.fPos);
|
intersect_lines(a0.fPos, abN, c0.fPos, cbN, &b0.fPos);
|
||||||
|
|
||||||
if (toSrc) {
|
if (toSrc) {
|
||||||
toSrc->mapPointsWithStride(&verts[0].fPos, sizeof(BezierVertex), kQuadNumVertices);
|
SkMatrixPriv::MapPointsWithStride(*toSrc, &verts[0].fPos, sizeof(BezierVertex),
|
||||||
|
kQuadNumVertices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -683,8 +685,7 @@ static void add_line(const SkPoint p[2],
|
|||||||
(*vert)[5].fCoverage = 0;
|
(*vert)[5].fCoverage = 0;
|
||||||
|
|
||||||
if (toSrc) {
|
if (toSrc) {
|
||||||
toSrc->mapPointsWithStride(&(*vert)->fPos,
|
SkMatrixPriv::MapPointsWithStride(*toSrc, &(*vert)->fPos, sizeof(LineVertex),
|
||||||
sizeof(LineVertex),
|
|
||||||
kLineSegNumVertices);
|
kLineSegNumVertices);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -286,8 +286,9 @@ void GrAtlasTextOp::onPrepareDraws(Target* target) {
|
|||||||
pos, pos, vertexStride, result.fGlyphsRegenerated * kVerticesPerGlyph);
|
pos, pos, vertexStride, result.fGlyphsRegenerated * kVerticesPerGlyph);
|
||||||
} else {
|
} else {
|
||||||
auto* pos = reinterpret_cast<SkPoint*>(currVertex);
|
auto* pos = reinterpret_cast<SkPoint*>(currVertex);
|
||||||
args.fViewMatrix.mapPointsWithStride(
|
SkMatrixPriv::MapPointsWithStride(
|
||||||
pos, vertexStride, result.fGlyphsRegenerated * kVerticesPerGlyph);
|
args.fViewMatrix, pos, vertexStride,
|
||||||
|
result.fGlyphsRegenerated * kVerticesPerGlyph);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
flushInfo.fGlyphsToFlush += result.fGlyphsRegenerated;
|
flushInfo.fGlyphsToFlush += result.fGlyphsRegenerated;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "GrProcessor.h"
|
#include "GrProcessor.h"
|
||||||
#include "GrStyle.h"
|
#include "GrStyle.h"
|
||||||
#include "SkGr.h"
|
#include "SkGr.h"
|
||||||
|
#include "SkMatrixPriv.h"
|
||||||
#include "SkPointPriv.h"
|
#include "SkPointPriv.h"
|
||||||
#include "glsl/GrGLSLFragmentShaderBuilder.h"
|
#include "glsl/GrGLSLFragmentShaderBuilder.h"
|
||||||
#include "glsl/GrGLSLGeometryProcessor.h"
|
#include "glsl/GrGLSLGeometryProcessor.h"
|
||||||
@ -181,7 +182,7 @@ void setup_dashed_rect_common(const SkRect& rect, const SkMatrix& matrix, T* ver
|
|||||||
vertices[idx + 2].fPos = SkPoint::Make(rect.fRight, rect.fTop);
|
vertices[idx + 2].fPos = SkPoint::Make(rect.fRight, rect.fTop);
|
||||||
vertices[idx + 3].fPos = SkPoint::Make(rect.fRight, rect.fBottom);
|
vertices[idx + 3].fPos = SkPoint::Make(rect.fRight, rect.fBottom);
|
||||||
|
|
||||||
matrix.mapPointsWithStride(&vertices[idx].fPos, sizeof(T), 4);
|
SkMatrixPriv::MapPointsWithStride(matrix, &vertices[idx].fPos, sizeof(T), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_dashed_rect(const SkRect& rect, void* vertices, int idx,
|
static void setup_dashed_rect(const SkRect& rect, void* vertices, int idx,
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "GrSimpleMeshDrawOpHelper.h"
|
#include "GrSimpleMeshDrawOpHelper.h"
|
||||||
#include "SkBitmap.h"
|
#include "SkBitmap.h"
|
||||||
#include "SkLatticeIter.h"
|
#include "SkLatticeIter.h"
|
||||||
|
#include "SkMatrixPriv.h"
|
||||||
#include "SkPointPriv.h"
|
#include "SkPointPriv.h"
|
||||||
#include "SkRect.h"
|
#include "SkRect.h"
|
||||||
|
|
||||||
@ -152,8 +153,8 @@ private:
|
|||||||
// If we didn't handle it above, apply the matrix here.
|
// If we didn't handle it above, apply the matrix here.
|
||||||
if (!isScaleTranslate) {
|
if (!isScaleTranslate) {
|
||||||
SkPoint* positions = reinterpret_cast<SkPoint*>(patchVerts);
|
SkPoint* positions = reinterpret_cast<SkPoint*>(patchVerts);
|
||||||
patch.fViewMatrix.mapPointsWithStride(
|
SkMatrixPriv::MapPointsWithStride(patch.fViewMatrix, positions, vertexStride,
|
||||||
positions, vertexStride, kVertsPerRect * patch.fIter->numRectsToDraw());
|
kVertsPerRect * patch.fIter->numRectsToDraw());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
helper.recordDraw(target, gp.get(), fHelper.makePipeline(target));
|
helper.recordDraw(target, gp.get(), fHelper.makePipeline(target));
|
||||||
|
Loading…
Reference in New Issue
Block a user