diff options
-rw-r--r-- | experimental/PdfViewer/SkTrackDevice.cpp | 1 | ||||
-rw-r--r-- | experimental/PdfViewer/SkTracker.cpp | 1 | ||||
-rw-r--r-- | experimental/SkiaExamples/SkExample.h | 1 | ||||
-rw-r--r-- | samplecode/SampleMipMap.cpp | 8 | ||||
-rw-r--r-- | src/core/SkBitmapProcState.cpp | 14 | ||||
-rw-r--r-- | src/core/SkMatrix.cpp | 4 | ||||
-rw-r--r-- | src/core/SkMatrixUtils.h | 6 | ||||
-rw-r--r-- | src/core/SkScaledImageCache.cpp | 18 | ||||
-rw-r--r-- | src/core/SkScaledImageCache.h | 4 | ||||
-rw-r--r-- | tests/ImageFilterTest.cpp | 2 | ||||
-rw-r--r-- | tests/MatrixTest.cpp | 8 | ||||
-rw-r--r-- | tests/PaintTest.cpp | 4 |
12 files changed, 34 insertions, 37 deletions
diff --git a/experimental/PdfViewer/SkTrackDevice.cpp b/experimental/PdfViewer/SkTrackDevice.cpp index 877b9cb415..b7f6d62603 100644 --- a/experimental/PdfViewer/SkTrackDevice.cpp +++ b/experimental/PdfViewer/SkTrackDevice.cpp @@ -1,3 +1,2 @@ #include "SkTrackDevice.h" - diff --git a/experimental/PdfViewer/SkTracker.cpp b/experimental/PdfViewer/SkTracker.cpp index 89f9012306..b7f56bd176 100644 --- a/experimental/PdfViewer/SkTracker.cpp +++ b/experimental/PdfViewer/SkTracker.cpp @@ -1,3 +1,2 @@ #include "SkTracker.h" - diff --git a/experimental/SkiaExamples/SkExample.h b/experimental/SkiaExamples/SkExample.h index 05b2ccd592..8efd309a07 100644 --- a/experimental/SkiaExamples/SkExample.h +++ b/experimental/SkiaExamples/SkExample.h @@ -79,4 +79,3 @@ private: }; #endif - diff --git a/samplecode/SampleMipMap.cpp b/samplecode/SampleMipMap.cpp index 73fc5e52a0..3cfeeb704e 100644 --- a/samplecode/SampleMipMap.cpp +++ b/samplecode/SampleMipMap.cpp @@ -69,7 +69,7 @@ protected: virtual void onDrawContent(SkCanvas* canvas) { this->init(); - + static const SkPaint::FilterLevel gLevel[] = { SkPaint::kNone_FilterLevel, SkPaint::kLow_FilterLevel, @@ -78,13 +78,13 @@ protected: }; SkPaint paint; - + for (size_t i = 0; i < SK_ARRAY_COUNT(gLevel); ++i) { SkScalar x = 10.0f + i * 100; SkScalar y = 10.0f; - + paint.setFilterLevel(gLevel[i]); - + canvas->drawBitmap(fBitmap, x, y, &paint); } this->inval(NULL); diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp index 6e52546938..b48f8384c9 100644 --- a/src/core/SkBitmapProcState.cpp +++ b/src/core/SkBitmapProcState.cpp @@ -95,13 +95,13 @@ static bool valid_for_filtering(unsigned dimension) { static SkScalar effective_matrix_scale_sqrd(const SkMatrix& mat) { SkPoint v1, v2; - + v1.fX = mat.getScaleX(); v1.fY = mat.getSkewY(); - + v2.fX = mat.getSkewX(); v2.fY = mat.getScaleY(); - + return SkMaxScalar(v1.lengthSqd(), v2.lengthSqd()); } @@ -166,7 +166,7 @@ void SkBitmapProcState::possiblyScaleImage() { // we failed to create fScaledBitmap, so just return and let // the scanline proc handle it. return; - + } fScaledCacheID = SkScaledImageCache::AddAndLock(fOrigBitmap, invScaleX, @@ -223,7 +223,7 @@ void SkBitmapProcState::possiblyScaleImage() { // want to reqeust mipmaps fFilterLevel = SkPaint::kMedium_FilterLevel; } - + SkASSERT(SkPaint::kMedium_FilterLevel == fFilterLevel); /** @@ -248,14 +248,14 @@ void SkBitmapProcState::possiblyScaleImage() { } else { SkASSERT(mip); } - + if (mip) { SkScalar levelScale = SkScalarInvert(SkScalarSqrt(scaleSqd)); SkMipMap::Level level; if (mip->extractLevel(levelScale, &level)) { SkScalar invScaleFixup = level.fScale; fInvMatrix.postScale(invScaleFixup, invScaleFixup); - + fScaledBitmap.setConfig(fOrigBitmap.config(), level.fWidth, level.fHeight, level.fRowBytes); diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp index 488bff7287..64edd67e87 100644 --- a/src/core/SkMatrix.cpp +++ b/src/core/SkMatrix.cpp @@ -1968,7 +1968,7 @@ bool SkTreatAsSprite(const SkMatrix& mat, int width, int height, } bool SkDecomposeUpper2x2(const SkMatrix& matrix, - SkScalar* rotation0, + SkScalar* rotation0, SkScalar* xScale, SkScalar* yScale, SkScalar* rotation1) { @@ -2014,7 +2014,7 @@ bool SkDecomposeUpper2x2(const SkMatrix& matrix, SkScalar arctan1 = SkScalarATan2(G, F); r0 = SK_ScalarHalf*(arctan0 - arctan1); r1 = SK_ScalarHalf*(arctan0 + arctan1); - + // simplify the results const SkScalar kHalfPI = SK_ScalarHalf*SK_ScalarPI; if (SkScalarNearlyEqual(SkScalarAbs(r0), kHalfPI)) { diff --git a/src/core/SkMatrixUtils.h b/src/core/SkMatrixUtils.h index ee952b6f58..37341f289e 100644 --- a/src/core/SkMatrixUtils.h +++ b/src/core/SkMatrixUtils.h @@ -40,15 +40,15 @@ static inline bool SkTreatAsSpriteFilter(const SkMatrix& matrix, return SkTreatAsSprite(matrix, width, height, kSkSubPixelBitsForBilerp); } -/** Decomposes the upper-left 2x2 of the matrix into a rotation, followed by a non-uniform scale, +/** Decomposes the upper-left 2x2 of the matrix into a rotation, followed by a non-uniform scale, followed by another rotation. Returns true if successful. If the scale factors are uniform, then rotation1 will be 0. If there is a reflection, yScale will be negative. Returns false if the matrix is degenerate. */ bool SkDecomposeUpper2x2(const SkMatrix& matrix, - SkScalar* rotation0, - SkScalar* xScale, SkScalar* yScale, + SkScalar* rotation0, + SkScalar* xScale, SkScalar* yScale, SkScalar* rotation1); #endif diff --git a/src/core/SkScaledImageCache.cpp b/src/core/SkScaledImageCache.cpp index e671359c68..b8590f5b65 100644 --- a/src/core/SkScaledImageCache.cpp +++ b/src/core/SkScaledImageCache.cpp @@ -113,17 +113,17 @@ struct SkScaledImageCache::Rec { fLockCount = 1; fMip = NULL; } - + Rec(const Key& key, const SkMipMap* mip) : fKey(key) { fLockCount = 1; fMip = mip; mip->ref(); } - + ~Rec() { SkSafeUnref(fMip); } - + size_t bytesUsed() const { return fMip ? fMip->getSize() : fBitmap.getSize(); } @@ -135,7 +135,7 @@ struct SkScaledImageCache::Rec { Key fKey; int32_t fLockCount; - + // we use either fBitmap or fMip, but not both SkBitmap fBitmap; const SkMipMap* fMip; @@ -165,7 +165,7 @@ SkScaledImageCache::Rec* SkScaledImageCache::findAndLock(const SkBitmap& orig, if (!key.init(orig, scaleX, scaleY)) { return NULL; } - + Rec* rec = fHead; while (rec != NULL) { if (rec->fKey == key) { @@ -220,11 +220,11 @@ SkScaledImageCache::ID* SkScaledImageCache::addAndLock(const SkBitmap& orig, if (!key.init(orig, scaleX, scaleY)) { return NULL; } - + Rec* rec = SkNEW_ARGS(Rec, (key, scaled)); this->addToHead(rec); SkASSERT(1 == rec->fLockCount); - + // We may (now) be overbudget, so see if we need to purge something. this->purgeAsNeeded(); return (ID*)rec; @@ -236,11 +236,11 @@ SkScaledImageCache::ID* SkScaledImageCache::addAndLockMip(const SkBitmap& orig, if (!key.init(orig, 0, 0)) { return NULL; } - + Rec* rec = SkNEW_ARGS(Rec, (key, mip)); this->addToHead(rec); SkASSERT(1 == rec->fLockCount); - + // We may (now) be overbudget, so see if we need to purge something. this->purgeAsNeeded(); return (ID*)rec; diff --git a/src/core/SkScaledImageCache.h b/src/core/SkScaledImageCache.h index f1f6c4fd7e..6ec62751f5 100644 --- a/src/core/SkScaledImageCache.h +++ b/src/core/SkScaledImageCache.h @@ -34,11 +34,11 @@ public: static ID* FindAndLock(const SkBitmap& original, SkScalar scaleX, SkScalar scaleY, SkBitmap* scaled); static ID* FindAndLockMip(const SkBitmap& original, SkMipMap const**); - + static ID* AddAndLock(const SkBitmap& original, SkScalar scaleX, SkScalar scaleY, const SkBitmap& scaled); static ID* AddAndLockMip(const SkBitmap& original, const SkMipMap*); - + static void Unlock(ID*); static size_t GetBytesUsed(); diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp index 6331020965..da1a719675 100644 --- a/tests/ImageFilterTest.cpp +++ b/tests/ImageFilterTest.cpp @@ -48,7 +48,7 @@ public: SkAutoTUnref<SkImageFilter> quarterBrightness(make_scale(0.5f, halfBrightness)); REPORTER_ASSERT(reporter, NULL == quarterBrightness->getInput(0)); } - + { // Check that a clipping color matrix followed by a grayscale does not concatenate into a single filter. SkAutoTUnref<SkImageFilter> doubleBrightness(make_scale(2.0f)); diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp index 0ca0296fcc..2f16d65661 100644 --- a/tests/MatrixTest.cpp +++ b/tests/MatrixTest.cpp @@ -347,7 +347,7 @@ static void test_matrix_is_similarity(skiatest::Reporter* reporter) { } // For test_matrix_decomposition, below. -static bool scalar_nearly_equal_relative(SkScalar a, SkScalar b, +static bool scalar_nearly_equal_relative(SkScalar a, SkScalar b, SkScalar tolerance = SK_ScalarNearlyZero) { // from Bruce Dawson SkScalar diff = SkScalarAbs(a - b); @@ -515,11 +515,11 @@ static void test_matrix_decomposition(skiatest::Reporter* reporter) { SkScalar s1 = SkScalarSinCos(rotation1, &c1); REPORTER_ASSERT(reporter, scalar_nearly_equal_relative(mat[SkMatrix::kMScaleX], scaleX*c0*c1 - scaleY*s0*s1)); - REPORTER_ASSERT(reporter, scalar_nearly_equal_relative(mat[SkMatrix::kMSkewX], + REPORTER_ASSERT(reporter, scalar_nearly_equal_relative(mat[SkMatrix::kMSkewX], -scaleX*s0*c1 - scaleY*c0*s1)); - REPORTER_ASSERT(reporter, scalar_nearly_equal_relative(mat[SkMatrix::kMSkewY], + REPORTER_ASSERT(reporter, scalar_nearly_equal_relative(mat[SkMatrix::kMSkewY], scaleX*c0*s1 + scaleY*s0*c1)); - REPORTER_ASSERT(reporter, scalar_nearly_equal_relative(mat[SkMatrix::kMScaleY], + REPORTER_ASSERT(reporter, scalar_nearly_equal_relative(mat[SkMatrix::kMScaleY], -scaleX*s0*s1 + scaleY*c0*c1)); } else { // if the matrix is degenerate, the basis vectors should be near-parallel or near-zero diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp index dc131f20e2..e25c7c3f08 100644 --- a/tests/PaintTest.cpp +++ b/tests/PaintTest.cpp @@ -111,10 +111,10 @@ static void test_cmap(skiatest::Reporter* reporter) { // temparary api for bicubic, just be sure we can set/clear it static void test_filterlevel(skiatest::Reporter* reporter) { SkPaint p0, p1; - + REPORTER_ASSERT(reporter, SkPaint::kNone_FilterLevel == p0.getFilterLevel()); - + static const SkPaint::FilterLevel gLevels[] = { SkPaint::kNone_FilterLevel, SkPaint::kLow_FilterLevel, |