From 0cbc10f94e2b350761e64b225c97390269f41479 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Mon, 30 Oct 2017 09:07:53 -0400 Subject: Make SkImageGeneratorCG apply encoded origin SkImageGeneratorCG: - Detect the origin and apply it to the output - Deprecate NewFromEncodedCG and add MakeFromEncodedCG SkCodecImageGenerator: - Move code elsewhere for sharing - Apply origin for incomplete decodes SkPixmap.cpp/SkPixmapPriv.h: - Now has the shared code for generators to apply origin DMSrcSink.cpp: - Call MakeFromEncodedCG SkCGUtils.h: - Add a version of SkCopyPixelsFromCGImage that takes an SkPixmap Bug: skia:7138 Bug: skia:3834 Change-Id: Ic6dbc76360c6a84913b67373582f328d3946d637 Reviewed-on: https://skia-review.googlesource.com/63740 Reviewed-by: Mike Reed Commit-Queue: Leon Scroggins --- include/utils/mac/SkCGUtils.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/utils') diff --git a/include/utils/mac/SkCGUtils.h b/include/utils/mac/SkCGUtils.h index 2dcbb965b4..06995c3ec1 100644 --- a/include/utils/mac/SkCGUtils.h +++ b/include/utils/mac/SkCGUtils.h @@ -11,6 +11,7 @@ #include "SkSize.h" #include "SkImageInfo.h" #include "SkImage.h" +#include "SkPixmap.h" #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) @@ -46,6 +47,9 @@ SK_API sk_sp SkMakeImageFromCGImage(CGImageRef); */ SK_API bool SkCopyPixelsFromCGImage(const SkImageInfo& info, size_t rowBytes, void* dstPixels, CGImageRef src); +static inline bool SkCopyPixelsFromCGImage(const SkPixmap& dst, CGImageRef src) { + return SkCopyPixelsFromCGImage(dst.info(), dst.rowBytes(), dst.writable_addr(), src); +} /** * Create an imageref from the specified bitmap using the specified colorspace. -- cgit v1.2.3