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
This commit is contained in:
reed@android.com 2008-12-22 02:33:11 +00:00
Родитель 0680d6c7ca
Коммит 2b26cac4fd
8 изменённых файлов: 23 добавлений и 42 удалений

Просмотреть файл

@ -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,

Просмотреть файл

@ -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);

Просмотреть файл

@ -495,7 +495,6 @@
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "core" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* core */;
projectDirPath = "";

Просмотреть файл

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 44;
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
@ -200,7 +200,6 @@
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "effects" */;
compatibilityVersion = "Xcode 3.0";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* effects */;
projectDirPath = "";
@ -286,7 +285,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
USER_HEADER_SEARCH_PATHS = "../../include/**";
};
name = Debug;
@ -305,7 +304,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
USER_HEADER_SEARCH_PATHS = "../../include/**";
};
name = Release;

Просмотреть файл

@ -186,7 +186,6 @@
20286C28FDCF999611CA2CEA /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 01E2163D09EDAC6600E66AF8 /* Build configuration list for PBXProject "CICarbonSample" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 20286C29FDCF999611CA2CEA /* CICarbonSample */;
projectDirPath = "";

Просмотреть файл

@ -29,9 +29,15 @@ void SkiaDraw(CGContextRef cg, CGRect bounds) {
gImage = SkCreateCGImageRef(bitmap);
}
CGColorRef color = CGColorCreateGenericRGB(1, 1, 1, 1);
float components[] = { 1, 1, 1, 1 };
CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
CGColorRef color = CGColorCreate(colorspace, components);
CGContextSetFillColorWithColor(cg, color);
CGColorRelease(color);
CGColorSpaceRelease(colorspace);
CGContextFillRect(cg, bounds);
CGRect r = CGRectMake(0, 0, 640, 480);

Просмотреть файл

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 44;
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
@ -104,7 +104,6 @@
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "maccore" */;
compatibilityVersion = "Xcode 3.0";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* maccore */;
projectDirPath = "";
@ -164,7 +163,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
USER_HEADER_SEARCH_PATHS = "../../include/utils/mac ../../include/ports ../../include/core";
};
name = Debug;
@ -183,7 +182,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
USER_HEADER_SEARCH_PATHS = "../../include/utils/mac ../../include/ports ../../include/core";
};
name = Release;

Просмотреть файл

@ -280,7 +280,6 @@
20286C28FDCF999611CA2CEA /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 01E2163D09EDAC6600E66AF8 /* Build configuration list for PBXProject "SampleApp" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 20286C29FDCF999611CA2CEA /* CICarbonSample */;
projectDirPath = "";
@ -478,6 +477,7 @@
SK_DEBUG,
);
GCC_THREADSAFE_STATICS = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
USER_HEADER_SEARCH_PATHS = "../../include/**";
};
name = Development;
@ -492,6 +492,7 @@
SK_RELEASE,
);
GCC_THREADSAFE_STATICS = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
USER_HEADER_SEARCH_PATHS = "../../include/**";
};
name = Deployment;
@ -502,6 +503,7 @@
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_THREADSAFE_STATICS = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
USER_HEADER_SEARCH_PATHS = "../../include/**";
};
name = Default;