#define REALBIG SkFloatToScalar(30.5f)
class BlurRectBench: public SkBenchmark {
+ int fLoopCount;
SkScalar fRadius;
SkString fName;
public:
BlurRectBench(void *param, SkScalar rad) : INHERITED(param) {
fRadius = rad;
+
+ if (fRadius > SkIntToScalar(25)) {
+ fLoopCount = 100;
+ } else if (fRadius > SkIntToScalar(5)) {
+ fLoopCount = 1000;
+ } else {
+ fLoopCount = 10000;
+ }
}
protected:
SkScalar pad = fRadius*3/2 + SK_Scalar1;
SkRect r = SkRect::MakeWH(2 * pad + SK_Scalar1, 2 * pad + SK_Scalar1);
- int loop_count;
-
- if (fRadius > SkIntToScalar(25)) {
- loop_count = 100;
- } else if (fRadius > SkIntToScalar(5)) {
- loop_count = 1000;
- } else {
- loop_count = 10000;
- }
-
preBenchSetup(r);
- for (int i = 0; i < SkBENCHLOOP(loop_count); i++) {
+ for (int i = 0; i < SkBENCHLOOP(fLoopCount); i++) {
makeBlurryRect(r);
}
}
'-llog',
],
'cflags': [
+ '-Wall',
'-fno-exceptions',
'-fno-rtti',
+ '-fstrict-aliasing',
'-fuse-ld=gold',
],
'conditions': [
},
},
}],
+ [ 'skia_os == "android"', {
+ 'cflags!': [
+ '-Wall',
+ '-Werror',
+ ],
+ }],
],
},
],
['OS=="android"', {
'cflags!': [
'-fno-rtti', # supresses warnings about invalid option of non-C++ code
+ '-Wall',
+ '-Werror',
],
}],
],
}],
[ 'skia_os == "android"', {
'sources': [
- '../src/utils/android/ashmem.c',
+ '../src/utils/android/ashmem.cpp',
],
}],
],
},
},
}],
+ [ 'skia_os == "android"', {
+ 'cflags!': [
+ '-Wall',
+ '-Werror',
+ ],
+ }],
],
},
],
extern const uint32_t gIEEEInfinity;
extern const uint32_t gIEEENegativeInfinity;
-#define SK_FloatNaN (*reinterpret_cast<const float*>(&gIEEENotANumber))
-#define SK_FloatInfinity (*reinterpret_cast<const float*>(&gIEEEInfinity))
-#define SK_FloatNegativeInfinity (*reinterpret_cast<const float*>(&gIEEENegativeInfinity))
+#define SK_FloatNaN (*SkTCast<const float*>(&gIEEENotANumber))
+#define SK_FloatInfinity (*SkTCast<const float*>(&gIEEEInfinity))
+#define SK_FloatNegativeInfinity (*SkTCast<const float*>(&gIEEENegativeInfinity))
#endif
*/
float nextF() {
unsigned int floatint = 0x3f800000 | (this->nextU() >> 9);
- float f = *(float*)(&floatint) - 1.0f;
+ float f = *SkTCast<float*>(&floatint) - 1.0f;
return f;
}
{ 2*SK_Scalar1, 0 },
{ 0, 2*SK_Scalar1 } };
SkMatrix m1, m2;
- bool success;
- success = m1.setPolyToPoly(src, dst, 3);
+ (void) m1.setPolyToPoly(src, dst, 3);
m2.reset();
m2.set(SkMatrix::kMScaleX, dst[1].fX - dst[0].fX);
SkFloatToScalar(158), SkFloatToScalar(604.5f), SkFloatToScalar(158), SkFloatToScalar(-177.5f)
};
- success = m2.setPolyToPoly((const SkPoint*)src1, (SkPoint*)dst1, 4);
+ (void) m2.setPolyToPoly((const SkPoint*)src1, (SkPoint*)dst1, 4);
{
const SkPoint src[] = {
Data lastAdvance = kInvalidAdvance;
int repeatedAdvances = 0;
int wildCardsInRun = 0;
- int leadingWildCards = 0;
int trailingWildCards = 0;
uint32_t subsetIndex = 0;
}
repeatedAdvances = 0;
wildCardsInRun = trailingWildCards;
- leadingWildCards = trailingWildCards;
trailingWildCards = 0;
} else {
if (lastAdvance == 0 &&
}
repeatedAdvances = 0;
wildCardsInRun = trailingWildCards;
- leadingWildCards = trailingWildCards;
trailingWildCards = 0;
}
curRange->fAdvance.append(1, &advance);
// marks fTopBot[] as unrecorded
void setTopBotUnwritten() {
- this->fTopBot[0] = this->fTopBot[1] = SK_ScalarNaN; // initial to sentinel values
+ this->fTopBot[0] = SK_ScalarNaN; // initial to sentinel values
}
// From here down is the data we look at in the search/sort. We always begin
copyHeight = height - frame->ImageDesc.Top;
}
- int srcPad, dstPad;
- dstPad = width - copyWidth;
- srcPad = frame->ImageDesc.Width - copyWidth;
for (; copyHeight > 0; copyHeight--) {
copyLine(dst, src, cmap, transparent, copyWidth);
src += frame->ImageDesc.Width;
/* now build fx/fx+dx/fx+2dx/fx+3dx */
SkFixed fx1, fx2, fx3;
- int32x2_t lower, upper;
int32x4_t lbase, hbase;
uint16_t *dst16 = (uint16_t *)dst;
/* now build fx/fx+dx/fx+2dx/fx+3dx */
SkFixed fx1, fx2, fx3;
- int32x2_t lower, upper;
int32x4_t lbase, hbase;
int16_t *dst16 = (int16_t *)xy;
*/
do {
- int16x4_t xlo, xhi, ylo, yhi;
- int16x4_t x2lo, x2hi, y2lo, y2hi;
+ int16x4_t xhi, yhi;
+ int16x4_t x2hi, y2hi;
/* vld4 does the de-interleaving for us */
{
: "=w" (t_xlo), "=w" (t_xhi), "=w" (t_ylo), "=w" (t_yhi)
: "r" (mysrc)
);
- xlo = t_xlo;
xhi = t_xhi;
- ylo = t_ylo;
yhi = t_yhi;
}
: "=w" (t_xlo), "=w" (t_xhi), "=w" (t_ylo), "=w" (t_yhi)
: "r" (mysrc+16)
);
- x2lo = t_xlo;
x2hi = t_xhi;
- y2lo = t_ylo;
y2hi = t_yhi;
}
#endif
if (count >= 4) {
- int32x4_t wide_dx, wide_one;
- int32x4_t wide_fx, wide_fx1, wide_i, wide_lo;
+ int32x4_t wide_one, wide_fx, wide_fx1, wide_i, wide_lo;
#if 0
/* verification hooks -- see below */
SkFixed debug_fx = fx;
wide_fx = vsetq_lane_s32(fx+dx+dx, wide_fx, 2);
wide_fx = vsetq_lane_s32(fx+dx+dx+dx, wide_fx, 3);
- wide_dx = vdupq_n_s32(dx);
wide_one = vdupq_n_s32(one);
while (count >= 4) {
unsigned maxY = s.fBitmap->height() - 1;
if (count >= 4) {
- int32x4_t wide_one, wide_i, wide_lo;
- int32x4_t wide_dx, wide_fx, wide_onex, wide_fx1;
- int32x4_t wide_dy, wide_fy, wide_oney, wide_fy1;
+ int32x4_t wide_i, wide_lo;
+ int32x4_t wide_fx, wide_onex, wide_fx1;
+ int32x4_t wide_fy, wide_oney, wide_fy1;
#undef AFFINE_DEBUG
#if defined(AFFINE_DEBUG)
wide_fx = vsetq_lane_s32(fx+dx, wide_fx, 1);
wide_fx = vsetq_lane_s32(fx+dx+dx, wide_fx, 2);
wide_fx = vsetq_lane_s32(fx+dx+dx+dx, wide_fx, 3);
- wide_dx = vdupq_n_s32(dx);
wide_fy = vdupq_n_s32(fy);
wide_fy = vsetq_lane_s32(fy+dy, wide_fy, 1);
wide_fy = vsetq_lane_s32(fy+dy+dy, wide_fy, 2);
wide_fy = vsetq_lane_s32(fy+dy+dy+dy, wide_fy, 3);
- wide_dy = vdupq_n_s32(dy);
wide_onex = vdupq_n_s32(oneX);
wide_oney = vdupq_n_s32(oneY);
const SkFixed* SK_RESTRICT srcXY = iter.getXY();
if (count >= 4) {
- int32x4_t wide_one, wide_i, wide_lo;
+ int32x4_t wide_i, wide_lo;
int32x4_t wide_fx1;
int32x4_t wide_fy1;
int32x4_t wide_x, wide_y;
/* now build fx/fx+dx/fx+2dx/fx+3dx */
SkFixed fx1, fx2, fx3;
- int32x2_t lower, upper;
int32x4_t lbase, hbase;
int16_t *dst16 = (int16_t *)xy;
int maxX = s.fBitmap->width() - 1;
int maxY = s.fBitmap->height() - 1;
-#if 1
+#if 0
int ocount = count;
uint32_t *oxy = xy;
SkFixed bfx = fx, bfy=fy, bdx=dx, bdy=dy;
SkFixed dy4 = dy*4;
/* now build fx/fx+dx/fx+2dx/fx+3dx */
- int32x2_t lower, upper;
int32x4_t xbase, ybase;
int16_t *dst16 = (int16_t *)xy;
SkASSERT(255 == alpha);
if (count >= 8) {
- uint16_t* SK_RESTRICT keep_dst;
+ uint16_t* SK_RESTRICT keep_dst = 0;
asm volatile (
"ands ip, %[count], #7 \n\t"
}
else
{ // handle count < 8
- uint16_t* SK_RESTRICT keep_dst;
+ uint16_t* SK_RESTRICT keep_dst = 0;
asm volatile (
"vmov.u8 d31, #1<<7 \n\t"
d = vld1_u8(dstart);
while (count >= UNROLL) {
- uint8x8_t sr, sg, sb, sa;
- uint16x8_t dr, dg, db, da;
+ uint8x8_t sr, sg, sb;
+ uint16x8_t dr, dg, db;
uint16x8_t dst8;
/* source is in ABGR ordering (R == lsb) */
: "=w" (d0), "=w" (d1), "=w" (d2), "=w" (d3)
: "r" (src)
);
- sr = d0; sg = d1; sb = d2; sa = d3;
+ sr = d0; sg = d1; sb = d2;
}
/* XXX: if we want to prefetch, hide it in the above asm()
* using the gcc __builtin_prefetch(), the prefetch will
// The Family tag has an optional "order" attribute with an integer value >= 0
// If this attribute does not exist, the default value is -1
for (int i = 0; atts[i] != NULL; i += 2) {
- const char* attribute = atts[i];
const char* valueString = atts[i+1];
int value;
int len = sscanf(valueString, "%d", &value);
static char** gDefaultNames = NULL;
static uint32_t *gFallbackFonts;
+#if SK_DEBUG_FONTS
static void dump_globals() {
SkDebugf("gDefaultNormal=%p id=%u refCnt=%d", gDefaultNormal,
gDefaultNormal ? gDefaultNormal->uniqueID() : 0,
}
}
+#endif
/* Load info from a configuration file that populates the system/fallback font structures
}
SkTDArray<FontInitRec> fontInfo;
- bool firstInFamily = false;
for (int i = 0; i < fontFamilies.count(); ++i) {
FontFamily *family = fontFamilies[i];
- firstInFamily = true;
for (int j = 0; j < family->fFileNames.count(); ++j) {
FontInitRec fontInfoRecord;
fontInfoRecord.fFileName = family->fFileNames[j];
// now terminate our fallback list with the sentinel value
gFallbackFonts[fallbackCount] = 0;
-// SkDEBUGCODE(dump_globals());
+#if SK_DEBUG_FONTS
+ SkDEBUGCODE(dump_globals());
+#endif
}
static size_t find_uniqueID(const char* filename) {
+++ /dev/null
-/*
- * Copyright 2008 The Android Open Source Project
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/*
- * Implementation of the user-space ashmem API for devices, which have our
- * ashmem-enabled kernel. See ashmem-sim.c for the "fake" tmp-based version,
- * used by the simulator.
- */
-
-#include <android/ashmem.h>
-
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-
-#include <linux/ashmem.h>
-
-#define ASHMEM_DEVICE "/dev/ashmem"
-
-/*
- * ashmem_create_region - creates a new ashmem region and returns the file
- * descriptor, or <0 on error
- *
- * `name' is an optional label to give the region (visible in /proc/pid/maps)
- * `size' is the size of the region, in page-aligned bytes
- */
-int ashmem_create_region(const char *name, size_t size)
-{
- int fd, ret;
-
- fd = open(ASHMEM_DEVICE, O_RDWR);
- if (fd < 0)
- return fd;
-
- if (name) {
- char buf[ASHMEM_NAME_LEN];
-
- strlcpy(buf, name, sizeof(buf));
- ret = ioctl(fd, ASHMEM_SET_NAME, buf);
- if (ret < 0)
- goto error;
- }
-
- ret = ioctl(fd, ASHMEM_SET_SIZE, size);
- if (ret < 0)
- goto error;
-
- return fd;
-
-error:
- close(fd);
- return ret;
-}
-
-int ashmem_set_prot_region(int fd, int prot)
-{
- return ioctl(fd, ASHMEM_SET_PROT_MASK, prot);
-}
-
-int ashmem_pin_region(int fd, size_t offset, size_t len)
-{
- struct ashmem_pin pin = { offset, len };
- return ioctl(fd, ASHMEM_PIN, &pin);
-}
-
-int ashmem_unpin_region(int fd, size_t offset, size_t len)
-{
- struct ashmem_pin pin = { offset, len };
- return ioctl(fd, ASHMEM_UNPIN, &pin);
-}
-
-int ashmem_get_size_region(int fd)
-{
- return ioctl(fd, ASHMEM_GET_SIZE, NULL);
-}
--- /dev/null
+/*
+ * Copyright 2008 The Android Open Source Project
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/*
+ * Implementation of the user-space ashmem API for devices, which have our
+ * ashmem-enabled kernel. See ashmem-sim.c for the "fake" tmp-based version,
+ * used by the simulator.
+ */
+
+#include <android/ashmem.h>
+
+#include <unistd.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+
+#include <linux/ashmem.h>
+
+#define ASHMEM_DEVICE "/dev/ashmem"
+
+/*
+ * ashmem_create_region - creates a new ashmem region and returns the file
+ * descriptor, or <0 on error
+ *
+ * `name' is an optional label to give the region (visible in /proc/pid/maps)
+ * `size' is the size of the region, in page-aligned bytes
+ */
+int ashmem_create_region(const char *name, size_t size)
+{
+ int fd, ret;
+
+ fd = open(ASHMEM_DEVICE, O_RDWR);
+ if (fd < 0)
+ return fd;
+
+ if (name) {
+ char buf[ASHMEM_NAME_LEN];
+
+ strlcpy(buf, name, sizeof(buf));
+ ret = ioctl(fd, ASHMEM_SET_NAME, buf);
+ if (ret < 0)
+ goto error;
+ }
+
+ ret = ioctl(fd, ASHMEM_SET_SIZE, size);
+ if (ret < 0)
+ goto error;
+
+ return fd;
+
+error:
+ close(fd);
+ return ret;
+}
+
+int ashmem_set_prot_region(int fd, int prot)
+{
+ return ioctl(fd, ASHMEM_SET_PROT_MASK, prot);
+}
+
+int ashmem_pin_region(int fd, size_t offset, size_t len)
+{
+ struct ashmem_pin pin = { offset, len };
+ return ioctl(fd, ASHMEM_PIN, &pin);
+}
+
+int ashmem_unpin_region(int fd, size_t offset, size_t len)
+{
+ struct ashmem_pin pin = { offset, len };
+ return ioctl(fd, ASHMEM_UNPIN, &pin);
+}
+
+int ashmem_get_size_region(int fd)
+{
+ return ioctl(fd, ASHMEM_GET_SIZE, NULL);
+}
#ifdef SK_BUILD_FOR_ANDROID
// the copy constructor should preserve the Generation ID
- int32_t paintGenID = paint.getGenerationID();
- int32_t copiedPaintGenID = copiedPaint.getGenerationID();
+ uint32_t paintGenID = paint.getGenerationID();
+ uint32_t copiedPaintGenID = copiedPaint.getGenerationID();
REPORTER_ASSERT(reporter, paintGenID == copiedPaintGenID);
REPORTER_ASSERT(reporter, !memcmp(&paint, &copiedPaint, sizeof(paint)));
#endif
*/
// This test is specific to the GPU backend.
-#if SK_SUPPORT_GPU
+#if SK_SUPPORT_GPU && !defined(SK_BUILD_FOR_ANDROID)
#include "Test.h"
#include "SkGpuDevice.h"
}
}
-#ifndef SK_BUILD_FOR_ANDROID
#include "TestClassDef.h"
DEFINE_GPUTESTCLASS("ReadWriteAlpha", ReadWriteAlphaTestClass, ReadWriteAlphaTest)
#endif
-#endif