diff options
author | 2008-12-22 02:33:11 +0000 | |
---|---|---|
committer | 2008-12-22 02:33:11 +0000 | |
commit | 2b26cac4fd1a0ff6bfc84757f35198afba3ee1d2 (patch) | |
tree | d6052e1048cd753649a076c4d0dd7db3d53cf5a8 /src/utils/mac | |
parent | 0680d6c7caa9c2d4b1e5ee49e5816b96be0cc7bf (diff) |
downgrade project files to 10.4 so more clients can use them
downgrade some CG calls in test apps to not require 10.5 apis
remove leftover printf in SkOSWindow_Mac.cpp
git-svn-id: http://skia.googlecode.com/svn/trunk@42 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/utils/mac')
-rw-r--r-- | src/utils/mac/SkCreateCGImageRef.cpp | 36 | ||||
-rw-r--r-- | src/utils/mac/SkOSWindow_Mac.cpp | 1 |
2 files changed, 7 insertions, 30 deletions
diff --git a/src/utils/mac/SkCreateCGImageRef.cpp b/src/utils/mac/SkCreateCGImageRef.cpp index b2a37f0174..6c9415edc0 100644 --- a/src/utils/mac/SkCreateCGImageRef.cpp +++ b/src/utils/mac/SkCreateCGImageRef.cpp @@ -3,27 +3,7 @@ extern CGImageRef SkCreateCGImageRef(const SkBitmap&); -static const void* SkBitmap_GetBytesPointer(void* info) { - SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(info); - bitmap->lockPixels(); - return bitmap->getPixels(); -} - -static void SkBitmap_ReleaseBytePointer(void* info, const void* pointer) { - SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(info); - bitmap->unlockPixels(); -} - -static size_t SkBitmap_GetBytesAtPosition(void* info, void* buffer, - off_t offset, size_t count) { - SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(info); - bitmap->lockPixels(); - memcpy(buffer, (const char*)bitmap->getPixels() + offset, count); - bitmap->unlockPixels(); - return count; -} - -static void SkBitmap_ReleaseInfo(void* info) { +static void SkBitmap_ReleaseInfo(void* info, const void* pixelData, size_t size) { SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(info); delete bitmap; } @@ -67,15 +47,13 @@ CGImageRef SkCreateCGImageRef(const SkBitmap& bm) { const int h = bitmap->height(); const size_t s = bitmap->getSize(); - CGDataProviderDirectCallbacks procs; - procs.version = 0; - procs.getBytePointer = SkBitmap_GetBytesPointer; - procs.releaseBytePointer = SkBitmap_ReleaseBytePointer; - procs.getBytesAtPosition = SkBitmap_GetBytesAtPosition; - procs.releaseInfo = SkBitmap_ReleaseInfo; - // our provider "owns" the bitmap*, and will take care of deleting it - CGDataProviderRef dataRef = CGDataProviderCreateDirect(bitmap, s, &procs); + // we initially lock it, so we can access the pixels. The bitmap will be deleted in the release + // proc, which will in turn unlock the pixels + bitmap->lockPixels(); + CGDataProviderRef dataRef = CGDataProviderCreateWithData(bitmap, bitmap->getPixels(), s, + SkBitmap_ReleaseInfo); + CGColorSpaceRef space = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); CGImageRef ref = CGImageCreate(w, h, bitsPerComponent, bitmap->bytesPerPixel() * 8, diff --git a/src/utils/mac/SkOSWindow_Mac.cpp b/src/utils/mac/SkOSWindow_Mac.cpp index 2c937210c2..40ed57cc88 100644 --- a/src/utils/mac/SkOSWindow_Mac.cpp +++ b/src/utils/mac/SkOSWindow_Mac.cpp @@ -203,7 +203,6 @@ bool SkOSWindow::onEvent(const SkEvent& evt) { this->update(NULL); const SkBitmap& bm = this->getBitmap(); - SkDebugf("------ bitmap %d %d\n", bm.width(), bm.height()); CGImageRef img = SkCreateCGImageRef(bm); HIImageViewSetImage((HIViewRef)getHVIEW(), img); |