diff options
author | djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-08 18:35:13 +0000 |
---|---|---|
committer | djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-03-08 18:35:13 +0000 |
commit | 4bd2bdbf04f21237337616aa931e34d7c8991edc (patch) | |
tree | ade3b197e460003914d462c1eeedc93c203f181c /include/core | |
parent | 184487c8083e4e3958f9efe6fb6a9b1d4865fdf5 (diff) |
Upstream changes from Android.
Review URL: https://codereview.chromium.org/12699002
git-svn-id: http://skia.googlecode.com/svn/trunk@8045 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkBitmap.h | 23 | ||||
-rw-r--r-- | include/core/SkPaint.h | 7 | ||||
-rw-r--r-- | include/core/SkRRect.h | 6 | ||||
-rw-r--r-- | include/core/SkThread_platform.h | 7 |
4 files changed, 34 insertions, 9 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index 9347bd93d8..124525e249 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -542,6 +542,20 @@ public: */ int extractMipLevel(SkBitmap* dst, SkFixed sx, SkFixed sy); +#ifdef SK_BUILD_FOR_ANDROID + bool hasHardwareMipMap() const { + return (fFlags & kHasHardwareMipMap_Flag) != 0; + } + + void setHasHardwareMipMap(bool hasHardwareMipMap) { + if (hasHardwareMipMap) { + fFlags |= kHasHardwareMipMap_Flag; + } else { + fFlags &= ~kHasHardwareMipMap_Flag; + } + } +#endif + bool extractAlpha(SkBitmap* dst) const { return this->extractAlpha(dst, NULL, NULL, NULL); } @@ -642,7 +656,14 @@ private: enum Flags { kImageIsOpaque_Flag = 0x01, kImageIsVolatile_Flag = 0x02, - kImageIsImmutable_Flag = 0x04 + kImageIsImmutable_Flag = 0x04, +#ifdef SK_BUILD_FOR_ANDROID + /* A hint for the renderer responsible for drawing this bitmap + * indicating that it should attempt to use mipmaps when this bitmap + * is drawn scaled down. + */ + kHasHardwareMipMap_Flag = 0x08, +#endif }; uint32_t fRowBytes; diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index 35ce3e60c4..36fb737d04 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -850,11 +850,12 @@ public: const SkPoint pos[], SkPath* path) const; #ifdef SK_BUILD_FOR_ANDROID - const SkGlyph& getUnicharMetrics(SkUnichar); - const SkGlyph& getGlyphMetrics(uint16_t); - const void* findImage(const SkGlyph&); + const SkGlyph& getUnicharMetrics(SkUnichar, const SkMatrix*); + const SkGlyph& getGlyphMetrics(uint16_t, const SkMatrix*); + const void* findImage(const SkGlyph&, const SkMatrix*); uint32_t getGenerationID() const; + void setGenerationID(uint32_t generationID); /** Returns the base glyph count for the strike associated with this paint */ diff --git a/include/core/SkRRect.h b/include/core/SkRRect.h index d6187f415a..fafe01924d 100644 --- a/include/core/SkRRect.h +++ b/include/core/SkRRect.h @@ -188,12 +188,14 @@ public: friend bool operator==(const SkRRect& a, const SkRRect& b) { return a.fRect == b.fRect && - SkScalarsEqual((SkScalar*) a.fRadii, (SkScalar*) b.fRadii, 8); + SkScalarsEqual(a.fRadii[0].asScalars(), + b.fRadii[0].asScalars(), 8); } friend bool operator!=(const SkRRect& a, const SkRRect& b) { return a.fRect != b.fRect || - !SkScalarsEqual((SkScalar*) a.fRadii, (SkScalar*) b.fRadii, 8); + !SkScalarsEqual(a.fRadii[0].asScalars(), + b.fRadii[0].asScalars(), 8); } /** diff --git a/include/core/SkThread_platform.h b/include/core/SkThread_platform.h index 535a5c7101..298e9cb16a 100644 --- a/include/core/SkThread_platform.h +++ b/include/core/SkThread_platform.h @@ -61,13 +61,14 @@ static inline __attribute__((always_inline)) void sk_membar_aquire__after_atomic #define sk_atomic_inc(addr) android_atomic_inc(addr) #define sk_atomic_add(addr, inc) android_atomic_add(inc, addr) #define sk_atomic_dec(addr) android_atomic_dec(addr) -void sk_membar_aquire__after_atomic_dec() { + +static inline __attribute__((always_inline)) void sk_membar_aquire__after_atomic_dec() { //HACK: Android is actually using full memory barriers. // Should this change, uncomment below. //int dummy; //android_atomic_aquire_store(0, &dummy); } -int32_t sk_atomic_conditional_inc(int32_t* addr) { +static inline __attribute__((always_inline)) int32_t sk_atomic_conditional_inc(int32_t* addr) { while (true) { int32_t value = *addr; if (value == 0) { @@ -78,7 +79,7 @@ int32_t sk_atomic_conditional_inc(int32_t* addr) { } } } -void sk_membar_aquire__after_atomic_conditional_inc() { +static inline __attribute__((always_inline)) void sk_membar_aquire__after_atomic_conditional_inc() { //HACK: Android is actually using full memory barriers. // Should this change, uncomment below. //int dummy; |