Bug 1311244 Part 1 - Use nsPoint type for center in nsCSSClipPathInstance. r=dbaron

|center| should be of nsPoint type since all the arguments of
ComputeObjectAnchorPoint() uses nsPoint and nsSize. We should only convert
center to Point (which is an an UnknownUnits type) for APIs requiring Point
type.

MozReview-Commit-ID: EDrQGPUZp6m

--HG--
extra : rebase_source : a5494f969dcb08c139af076e95584502f46f0b9e
This commit is contained in:
Ting-Yu Lin 2017-01-06 16:35:00 +08:00
Родитель 7c122b0aa7
Коммит a080cb68d1
1 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -133,7 +133,7 @@ nsCSSClipPathInstance::CreateClipPathCircle(DrawTarget* aDrawTarget,
nsImageRenderer::ComputeObjectAnchorPoint(basicShape->GetPosition(), nsImageRenderer::ComputeObjectAnchorPoint(basicShape->GetPosition(),
size, size, size, size,
&topLeft, &anchor); &topLeft, &anchor);
Point center = Point(anchor.x + aRefBox.x, anchor.y + aRefBox.y); nsPoint center(anchor.x + aRefBox.x, anchor.y + aRefBox.y);
const nsTArray<nsStyleCoord>& coords = basicShape->Coordinates(); const nsTArray<nsStyleCoord>& coords = basicShape->Coordinates();
MOZ_ASSERT(coords.Length() == 1, "wrong number of arguments"); MOZ_ASSERT(coords.Length() == 1, "wrong number of arguments");
@ -162,7 +162,8 @@ nsCSSClipPathInstance::CreateClipPathCircle(DrawTarget* aDrawTarget,
nscoord appUnitsPerDevPixel = nscoord appUnitsPerDevPixel =
mTargetFrame->PresContext()->AppUnitsPerDevPixel(); mTargetFrame->PresContext()->AppUnitsPerDevPixel();
builder->Arc(center / appUnitsPerDevPixel, r / appUnitsPerDevPixel, builder->Arc(Point(center.x, center.y) / appUnitsPerDevPixel,
r / appUnitsPerDevPixel,
0, Float(2 * M_PI)); 0, Float(2 * M_PI));
builder->Close(); builder->Close();
return builder->Finish(); return builder->Finish();
@ -181,7 +182,7 @@ nsCSSClipPathInstance::CreateClipPathEllipse(DrawTarget* aDrawTarget,
nsImageRenderer::ComputeObjectAnchorPoint(basicShape->GetPosition(), nsImageRenderer::ComputeObjectAnchorPoint(basicShape->GetPosition(),
size, size, size, size,
&topLeft, &anchor); &topLeft, &anchor);
Point center = Point(anchor.x + aRefBox.x, anchor.y + aRefBox.y); nsPoint center(anchor.x + aRefBox.x, anchor.y + aRefBox.y);
const nsTArray<nsStyleCoord>& coords = basicShape->Coordinates(); const nsTArray<nsStyleCoord>& coords = basicShape->Coordinates();
MOZ_ASSERT(coords.Length() == 2, "wrong number of arguments"); MOZ_ASSERT(coords.Length() == 2, "wrong number of arguments");
@ -202,7 +203,7 @@ nsCSSClipPathInstance::CreateClipPathEllipse(DrawTarget* aDrawTarget,
nscoord appUnitsPerDevPixel = nscoord appUnitsPerDevPixel =
mTargetFrame->PresContext()->AppUnitsPerDevPixel(); mTargetFrame->PresContext()->AppUnitsPerDevPixel();
EllipseToBezier(builder.get(), EllipseToBezier(builder.get(),
center / appUnitsPerDevPixel, Point(center.x, center.y) / appUnitsPerDevPixel,
Size(rx, ry) / appUnitsPerDevPixel); Size(rx, ry) / appUnitsPerDevPixel);
builder->Close(); builder->Close();
return builder->Finish(); return builder->Finish();