diff options
author | djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-02-23 20:46:31 +0000 |
---|---|---|
committer | djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-02-23 20:46:31 +0000 |
commit | 57f4969724a1dd88c8d9ae35a863e6cf621181d5 (patch) | |
tree | cb1c377ea38c512e380b21d8d767c4497142f5a8 /include | |
parent | 819c921b0445fa9f45f18d4a560603cd9fde6ba4 (diff) |
merge from android tree:
- optional parameters added to descriptorProc and allocPixels
- clip options to image decoders
- check for xfermode in blitter_a8
- UNROLL loops in blitrow
reviewed by reed@google.com
git-svn-id: http://skia.googlecode.com/svn/trunk@841 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkBitmap.h | 7 | ||||
-rw-r--r-- | include/core/SkPaint.h | 2 | ||||
-rw-r--r-- | include/core/SkPixelRef.h | 12 | ||||
-rw-r--r-- | include/core/SkStream.h | 5 | ||||
-rw-r--r-- | include/core/SkTemplates.h | 7 | ||||
-rw-r--r-- | include/images/SkImageRef.h | 6 | ||||
-rw-r--r-- | include/images/SkJpegUtility.h | 6 |
7 files changed, 39 insertions, 6 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index c54fb5d227..a38cafa351 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -462,10 +462,15 @@ public: int extractMipLevel(SkBitmap* dst, SkFixed sx, SkFixed sy); void extractAlpha(SkBitmap* dst) const { - this->extractAlpha(dst, NULL, NULL); + this->extractAlpha(dst, NULL, NULL, NULL); } void extractAlpha(SkBitmap* dst, const SkPaint* paint, + SkIPoint* offset) const { + this->extractAlpha(dst, paint, NULL, offset); + } + + void extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator, SkIPoint* offset) const; void flatten(SkFlattenableWriteBuffer&) const; diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index 16411d5886..a4def5f188 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -855,7 +855,7 @@ private: void descriptorProc(const SkMatrix* deviceMatrix, void (*proc)(const SkDescriptor*, void*), - void* context) const; + void* context, bool ignoreGamma = false) const; const SkRect& computeStrokeFastBounds(const SkRect& orig, SkRect* storage) const; diff --git a/include/core/SkPixelRef.h b/include/core/SkPixelRef.h index 8375cc7f74..c0259af1d3 100644 --- a/include/core/SkPixelRef.h +++ b/include/core/SkPixelRef.h @@ -119,6 +119,18 @@ public: virtual Factory getFactory() const { return NULL; } virtual void flatten(SkFlattenableWriteBuffer&) const; + /** Acquire a "global" ref on this object. + * The default implementation just calls ref(), but subclasses can override + * this method to implement additional behavior. + */ + virtual void globalRef(void* data=NULL); + + /** Release a "global" ref on this object. + * The default implementation just calls unref(), but subclasses can override + * this method to implement additional behavior. + */ + virtual void globalUnref(); + static Factory NameToFactory(const char name[]); static const char* FactoryToName(Factory); static void Register(const char name[], Factory); diff --git a/include/core/SkStream.h b/include/core/SkStream.h index 046c4d963f..b02d48272d 100644 --- a/include/core/SkStream.h +++ b/include/core/SkStream.h @@ -177,6 +177,11 @@ public: */ virtual void setMemory(const void* data, size_t length, bool copyData = false); + /** Replace any memory buffer with the specified buffer. The caller + must have allocated data with sk_malloc or sk_realloc, since it + will be freed with sk_free. + */ + void setMemoryOwned(const void* data, size_t length); void skipToAlign4(); virtual bool rewind(); virtual size_t read(void* buffer, size_t size); diff --git a/include/core/SkTemplates.h b/include/core/SkTemplates.h index eaa812fdbd..55109bfce3 100644 --- a/include/core/SkTemplates.h +++ b/include/core/SkTemplates.h @@ -62,8 +62,10 @@ private: // See also SkTScopedPtr. template <typename T> class SkAutoTDelete : SkNoncopyable { public: - SkAutoTDelete(T* obj) : fObj(obj) {} - ~SkAutoTDelete() { delete fObj; } + SkAutoTDelete(T* obj, bool deleteWhenDone = true) : fObj(obj) { + fDeleteWhenDone = deleteWhenDone; + } + ~SkAutoTDelete() { if (fDeleteWhenDone) delete fObj; } T* get() const { return fObj; } void free() { delete fObj; fObj = NULL; } @@ -71,6 +73,7 @@ public: private: T* fObj; + bool fDeleteWhenDone; }; template <typename T> class SkAutoTDeleteArray : SkNoncopyable { diff --git a/include/images/SkImageRef.h b/include/images/SkImageRef.h index 9c9896f6fc..800f12e07e 100644 --- a/include/images/SkImageRef.h +++ b/include/images/SkImageRef.h @@ -57,6 +57,12 @@ public: */ bool getInfo(SkBitmap* bm); + /** Return true if the image can be decoded and is opaque. Calling this + method will decode and set the pixels in the specified bitmap and + sets the isOpaque flag. + */ + bool isOpaque(SkBitmap* bm); + SkImageDecoderFactory* getDecoderFactory() const { return fFactory; } // returns the factory parameter SkImageDecoderFactory* setDecoderFactory(SkImageDecoderFactory*); diff --git a/include/images/SkJpegUtility.h b/include/images/SkJpegUtility.h index cc9d2466df..e9dd9778ee 100644 --- a/include/images/SkJpegUtility.h +++ b/include/images/SkJpegUtility.h @@ -41,11 +41,13 @@ void skjpeg_error_exit(j_common_ptr cinfo); /* Our source struct for directing jpeg to our stream object. */ struct skjpeg_source_mgr : jpeg_source_mgr { - skjpeg_source_mgr(SkStream* stream, SkImageDecoder* decoder); + skjpeg_source_mgr(SkStream* stream, SkImageDecoder* decoder, bool ownStream); + ~skjpeg_source_mgr(); SkStream* fStream; - const void* fMemoryBase; + void* fMemoryBase; size_t fMemoryBaseSize; + bool fUnrefStream; SkImageDecoder* fDecoder; enum { kBufferSize = 1024 |