Revert of change mapRectScaleTranslate to pass args/ret by value (patchset #1 id:1 of https://codereview.chromium.org/2137853002/ )

Reason for revert:
Triggered a compiler bug on Android?

FAILED: /usr/bin/ccache /b/work/skia/platform_tools/android/bin/../toolchains/arm-r11c-14/bin/arm-linux-androideabi-g++ -MMD -MF obj/src/core/core.SkMatrix.o.d -DSK_INTERNAL -DSK_GAMMA_APPLY_TO_A8 -DQT_NO_KEYWORDS -DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0 -DSK_SUPPORT_GPU=1 -DSK_FORCE_DISTANCE_FIELD_TEXT=0 -DSK_HAS_GIF_LIBRARY -DSK_HAS_JPEG_LIBRARY -DSK_HAS_PNG_LIBRARY -DSK_HAS_WEBP_LIBRARY -DSK_TEST_QCMS -DSK_IS_BOT -DSK_CODEC_DECODES_RAW -DSK_ARM_HAS_NEON -DSK_BUILD_FOR_ANDROID -DSK_GAMMA_EXPONENT=1.4 -DSK_GAMMA_CONTRAST=0.0 -DSKIA_DLL -DSKIA_IMPLEMENTATION=1 -DSK_SUPPORT_LEGACY_CLIPTOLAYERFLAG -DNDEBUG -I../../../include/c -I../../../include/config -I../../../include/core -I../../../include/pathops -I../../../include/ports -I../../../include/private -I../../../include/utils -I../../../include/images -I../../../src/core -I../../../src/sfnt -I../../../src/image -I../../../src/opts -I../../../src/utils -I../../../include/gpu -I../../../src/gpu -I../../../platform_tools/android/third_party/cpufeatures -fPIC -g -fno-exceptions -fstrict-aliasing -Wall -Wextra -Winit-self -Wpointer-arith -Wsign-compare -Wvla -Wno-unused-parameter -Werror -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=softfp -fuse-ld=gold -O2 -std=c++11 -fno-rtti -fno-threadsafe-statics -Wnon-virtual-dtor  -c ../../../src/core/SkMatrix.cpp -o obj/src/core/core.SkMatrix.o
../../../src/core/SkMatrix.cpp: In member function 'SkRect SkMatrix::mapRectScaleTranslate(SkRect) const':
../../../src/core/SkMatrix.cpp:1120:1: error: unrecognizable insn:
 }
 ^
(insn 32 31 33 2 (set (reg:V4SF 115 [ D.83077 ])
        (unspec:V4SF [
                (mem/c:V4SF (reg/f:SI 104 virtual-incoming-args) [0 MEM[(const __builtin_neon_sf[4] *)&src]+0 S16 A32])
            ] UNSPEC_VLD1)) /b/work/skia/platform_tools/android/toolchains/arm-r11c-14/lib/gcc/arm-linux-androideabi/4.9/include/arm_neon.h:8693 -1
     (nil))
../../../src/core/SkMatrix.cpp:1120:1: internal compiler error: in extract_insn, at recog.c:2202
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://source.android.com/source/report-bugs.html> for instructions.

Original issue's description:
> change mapRectScaleTranslate to pass args/ret by value
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2137853002
>
> TBR=mtklein
>
> Committed: https://skia.googlesource.com/skia/+/14dce6ed5934d7a6e1fac79f8e76e12f5670aae2

TBR=msarett@google.com,mtklein@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review-Url: https://codereview.chromium.org/2139523002
This commit is contained in:
reed 2016-07-10 11:45:34 -07:00 committed by Commit bot
parent 14dce6ed59
commit 6092b6e0e5
6 changed files with 17 additions and 15 deletions

View File

@ -320,7 +320,7 @@ public:
SkRect dst;
if (fScaleTrans) {
for (int i = 0; i < MEGA_LOOP; ++i) {
dst = fM.mapRectScaleTranslate(fR);
fM.mapRectScaleTranslate(&dst, fR);
}
} else {
for (int i = 0; i < MEGA_LOOP; ++i) {

View File

@ -565,7 +565,7 @@ public:
* Maps a rect to another rect, asserting (in debug mode) that the matrix only contains
* scale and translate elements. If it contains other elements, the results are undefined.
*/
SkRect mapRectScaleTranslate(SkRect src) const;
void mapRectScaleTranslate(SkRect* dst, const SkRect& src) const;
/** Return the mean radius of a circle after it has been mapped by
this matrix. NOTE: in perspective this value assumes the circle

View File

@ -75,11 +75,13 @@ bool SkCanvas::wouldOverwriteEntireSurface(const SkRect* rect, const SkPaint* pa
}
if (rect) {
const SkMatrix& ctm = this->getTotalMatrix();
if (!ctm.isScaleTranslate()) {
if (!this->getTotalMatrix().isScaleTranslate()) {
return false; // conservative
}
if (!ctm.mapRectScaleTranslate(*rect).contains(bounds)) {
SkRect devRect;
this->getTotalMatrix().mapRectScaleTranslate(&devRect, *rect);
if (!devRect.contains(bounds)) {
return false;
}
}
@ -1542,7 +1544,8 @@ void SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
// Check if we can quick-accept the clip call (and do nothing)
//
if (SkRegion::kIntersect_Op == op && !doAA && fMCRec->fMatrix.isScaleTranslate()) {
SkRect devR = fMCRec->fMatrix.mapRectScaleTranslate(rect);
SkRect devR;
fMCRec->fMatrix.mapRectScaleTranslate(&devR, rect);
// NOTE: this check is CTM specific, since we might round differently with a different
// CTM. Thus this is only 100% reliable if there is not global CTM scale to be
// applied later (i.e. if this is going into a picture).
@ -1582,7 +1585,7 @@ void SkCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edg
const bool isScaleTrans = fMCRec->fMatrix.isScaleTranslate();
SkRect devR;
if (isScaleTrans) {
devR = fMCRec->fMatrix.mapRectScaleTranslate(rect);
fMCRec->fMatrix.mapRectScaleTranslate(&devR, rect);
}
#ifndef SK_SUPPORT_PRECHECK_CLIPRECT

View File

@ -1097,7 +1097,8 @@ void SkMatrix::mapVectors(SkPoint dst[], const SkPoint src[], int count) const {
}
}
SkRect SkMatrix::mapRectScaleTranslate(SkRect src) const {
void SkMatrix::mapRectScaleTranslate(SkRect* dst, const SkRect& src) const {
SkASSERT(dst);
SkASSERT(this->isScaleTranslate());
SkScalar sx = fMat[kMScaleX];
@ -1114,16 +1115,14 @@ SkRect SkMatrix::mapRectScaleTranslate(SkRect src) const {
Sk4f max = Sk4f::Max(ltrb, rblt);
// We can extract either pair [0,1] or [2,3] from min and max and be correct, but on
// ARM this sequence generates the fastest (a single instruction).
SkRect dst;
Sk4f(min[0], min[1], max[0], max[1]).store(&dst.fLeft);
return dst;
Sk4f(min[2], min[3], max[0], max[1]).store(&dst->fLeft);
}
bool SkMatrix::mapRect(SkRect* dst, const SkRect& src) const {
SkASSERT(dst);
if (this->isScaleTranslate()) {
*dst = this->mapRectScaleTranslate(src);
this->mapRectScaleTranslate(dst, src);
return true;
} else {
SkPoint quad[4];

View File

@ -200,7 +200,7 @@ void SkDeferredCanvas::flush_check(SkRect* bounds, const SkPaint* paint, unsigne
if (canScale) {
SkMatrix m;
rec.getConcat(&m);
*bounds = m.mapRectScaleTranslate(*bounds);
m.mapRectScaleTranslate(bounds, *bounds);
} else {
goto STOP;
}

View File

@ -978,7 +978,7 @@ DEF_TEST(Matrix_maprects, r) {
mat.mapPoints((SkPoint*)&dst[0].fLeft, (SkPoint*)&src.fLeft, 2);
dst[0].sort();
mat.mapRect(&dst[1], src);
dst[2] = mat.mapRectScaleTranslate(src);
mat.mapRectScaleTranslate(&dst[2], src);
REPORTER_ASSERT(r, dst[0] == dst[1]);
REPORTER_ASSERT(r, dst[0] == dst[2]);