diff options
author | Android Chromium Automerger <chromium-automerger@android> | 2013-12-11 12:52:54 +0000 |
---|---|---|
committer | Android Chromium Automerger <chromium-automerger@android> | 2013-12-11 12:52:54 +0000 |
commit | c14afa6348ca0b1971a96707c4712d9b0928012b (patch) | |
tree | 352b5391f42111c85b56c45ae372e51334e3d115 | |
parent | 4c9cd2dca651afa7717687d832d78ecff44ac79d (diff) | |
parent | 0b2c5475b3d54085ac1cec8e0adae91d1b48dc86 (diff) | |
download | include-c14afa6348ca0b1971a96707c4712d9b0928012b.tar.gz |
Merge third_party/skia/include from https://chromium.googlesource.com/external/skia/include.git at 0b2c5475b3d54085ac1cec8e0adae91d1b48dc86
This commit was generated by merge_from_chromium.py.
Change-Id: I8365579598548ea9e7ad37595fed928167a1fbc3
-rw-r--r-- | core/SkBitmap.h | 7 | ||||
-rw-r--r-- | core/SkFlattenableBuffers.h | 6 | ||||
-rw-r--r-- | core/SkImage.h | 1 | ||||
-rw-r--r-- | core/SkImageDecoder.h | 27 | ||||
-rw-r--r-- | core/SkImageInfo.h | 23 | ||||
-rw-r--r-- | core/SkMatrix.h | 8 | ||||
-rw-r--r-- | core/SkPixelRef.h | 14 | ||||
-rw-r--r-- | effects/SkBitmapSource.h | 2 | ||||
-rw-r--r-- | gpu/SkGrPixelRef.h | 3 |
9 files changed, 61 insertions, 30 deletions
diff --git a/core/SkBitmap.h b/core/SkBitmap.h index cd85b6a..c0e299a 100644 --- a/core/SkBitmap.h +++ b/core/SkBitmap.h @@ -250,6 +250,13 @@ public: bool setConfig(const SkImageInfo& info, size_t rowBytes = 0); + /** + * If the bitmap's config can be represented as SkImageInfo, return true, + * and if info is not-null, set it to the bitmap's info. If it cannot be + * represented as SkImageInfo, return false and ignore the info parameter. + */ + bool asImageInfo(SkImageInfo* info) const; + /** Use this to assign a new pixel address for an existing bitmap. This will automatically release any pixelref previously installed. Only call this if you are handling ownership/lifetime of the pixel memory. diff --git a/core/SkFlattenableBuffers.h b/core/SkFlattenableBuffers.h index 575dec8..00cb77a 100644 --- a/core/SkFlattenableBuffers.h +++ b/core/SkFlattenableBuffers.h @@ -154,6 +154,12 @@ public: */ virtual bool validate(bool isValid); + /** This function returns true by default + * If isValidating() is true, it will return false if the internal error flag is set. + * Otherwise, it will return true. + */ + virtual bool isValid() const { return true; } + private: template <typename T> T* readFlattenableT(); uint32_t fFlags; diff --git a/core/SkImage.h b/core/SkImage.h index accfc0d..0bff589 100644 --- a/core/SkImage.h +++ b/core/SkImage.h @@ -41,6 +41,7 @@ public: typedef SkColorType ColorType; static const SkColorType kAlpha_8_ColorType = kAlpha_8_SkColorType; + static const SkColorType kARGB_4444_ColorType = kARGB_4444_SkColorType; static const SkColorType kRGB_565_ColorType = kRGB_565_SkColorType; static const SkColorType kRGBA_8888_ColorType = kRGBA_8888_SkColorType; static const SkColorType kBGRA_8888_ColorType = kBGRA_8888_SkColorType; diff --git a/core/SkImageDecoder.h b/core/SkImageDecoder.h index 43950ad..7241458 100644 --- a/core/SkImageDecoder.h +++ b/core/SkImageDecoder.h @@ -349,33 +349,6 @@ public: size_t fRowBytes; }; - /** - * Decode memory. - * @param info Output parameter. Returns info about the encoded image. - * @param target Contains the address of pixel memory to decode into - * (which must be large enough to hold the width in info) and - * the row bytes to use. If NULL, returns info and does not - * decode pixels. - * @return bool Whether the function succeeded. - * - * Sample usage: - * <code> - * // Determine the image's info: width/height/config - * SkImageInfo info; - * bool success = DecodeMemoryToTarget(src, size, &info, NULL); - * if (!success) return; - * // Allocate space for the result: - * SkBitmapFactory::Target target; - * target.fAddr = malloc/other allocation - * target.fRowBytes = ... - * // Now decode the actual pixels into target. &info is optional, - * // and could be NULL - * success = DecodeMemoryToTarget(src, size, &info, &target); - * </code> - */ - static bool DecodeMemoryToTarget(const void* buffer, size_t size, SkImageInfo* info, - const Target* target); - /** Decode the image stored in the specified SkStreamRewindable, and store the result in bitmap. Return true for success or false on failure. diff --git a/core/SkImageInfo.h b/core/SkImageInfo.h index c22249b..1165479 100644 --- a/core/SkImageInfo.h +++ b/core/SkImageInfo.h @@ -10,6 +10,9 @@ #include "SkTypes.h" +class SkFlattenableWriteBuffer; +class SkFlattenableReadBuffer; + /** * Describes how to interpret the alpha compoent of a pixel. */ @@ -63,11 +66,12 @@ static inline bool SkAlphaTypeIsOpaque(SkAlphaType at) { enum SkColorType { kAlpha_8_SkColorType, kRGB_565_SkColorType, + kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kBGRA_8888_SkColorType, - kIndex8_SkColorType, + kIndex_8_SkColorType, - kLastEnum_SkColorType = kIndex8_SkColorType, + kLastEnum_SkColorType = kIndex_8_SkColorType, #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) kPMColor_SkColorType = kBGRA_8888_SkColorType @@ -82,6 +86,7 @@ static int SkColorTypeBytesPerPixel(SkColorType ct) { static const uint8_t gSize[] = { 1, // Alpha_8 2, // RGB_565 + 2, // ARGB_4444 4, // RGBA_8888 4, // BGRA_8888 1, // kIndex_8 @@ -112,12 +117,26 @@ struct SkImageInfo { return SkColorTypeBytesPerPixel(fColorType); } + size_t minRowBytes() const { + return fWidth * this->bytesPerPixel(); + } + bool operator==(const SkImageInfo& other) const { return 0 == memcmp(this, &other, sizeof(other)); } bool operator!=(const SkImageInfo& other) const { return 0 != memcmp(this, &other, sizeof(other)); } + + void unflatten(SkFlattenableReadBuffer&); + void flatten(SkFlattenableWriteBuffer&) const; + + size_t getSafeSize(size_t rowBytes) const { + if (0 == fHeight) { + return 0; + } + return (fHeight - 1) * rowBytes + fWidth * this->bytesPerPixel(); + } }; #endif diff --git a/core/SkMatrix.h b/core/SkMatrix.h index dad5ff9..d7726f6 100644 --- a/core/SkMatrix.h +++ b/core/SkMatrix.h @@ -574,6 +574,14 @@ public: SkDEVCODE(void toString(SkString*) const;) /** + * Calculates the minimum stretching factor of the matrix. If the matrix has + * perspective -1 is returned. + * + * @return minumum strecthing factor + */ + SkScalar getMinStretch() const; + + /** * Calculates the maximum stretching factor of the matrix. If the matrix has * perspective -1 is returned. * diff --git a/core/SkPixelRef.h b/core/SkPixelRef.h index 4c564e4..b87b0dc 100644 --- a/core/SkPixelRef.h +++ b/core/SkPixelRef.h @@ -16,6 +16,8 @@ #include "SkFlattenable.h" #include "SkTDArray.h" +#define SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR + #ifdef SK_DEBUG /** * Defining SK_IGNORE_PIXELREF_SETPRELOCKED will force all pixelref @@ -49,9 +51,19 @@ class SK_API SkPixelRef : public SkFlattenable { public: SK_DECLARE_INST_COUNT(SkPixelRef) +#ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR + // DEPRECATED -- use a constructor that takes SkImageInfo explicit SkPixelRef(SkBaseMutex* mutex = NULL); +#endif + + explicit SkPixelRef(const SkImageInfo&); + SkPixelRef(const SkImageInfo&, SkBaseMutex* mutex); virtual ~SkPixelRef(); + const SkImageInfo& info() const { + return fInfo; + } + /** Return the pixel memory returned from lockPixels, or null if the lockCount is 0. */ @@ -283,6 +295,8 @@ protected: private: SkBaseMutex* fMutex; // must remain in scope for the life of this object + SkImageInfo fInfo; + void* fPixels; SkColorTable* fColorTable; // we do not track ownership, subclass does int fLockCount; diff --git a/effects/SkBitmapSource.h b/effects/SkBitmapSource.h index 138987e..699186e 100644 --- a/effects/SkBitmapSource.h +++ b/effects/SkBitmapSource.h @@ -14,6 +14,7 @@ class SK_API SkBitmapSource : public SkImageFilter { public: explicit SkBitmapSource(const SkBitmap& bitmap); + SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, const SkRect& dstRect); SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapSource) @@ -25,6 +26,7 @@ protected: private: SkBitmap fBitmap; + SkRect fSrcRect, fDstRect; typedef SkImageFilter INHERITED; }; diff --git a/gpu/SkGrPixelRef.h b/gpu/SkGrPixelRef.h index da4b8fa..c29c27f 100644 --- a/gpu/SkGrPixelRef.h +++ b/gpu/SkGrPixelRef.h @@ -47,7 +47,8 @@ public: * cache and would like the pixel ref to unlock it in its destructor then transferCacheLock * should be set to true. */ - SkGrPixelRef(GrSurface* surface, bool transferCacheLock = false); + SkGrPixelRef(GrSurface*, bool transferCacheLock = false); + SkGrPixelRef(const SkImageInfo&, GrSurface*, bool transferCacheLock = false); virtual ~SkGrPixelRef(); // override from SkPixelRef |