diff options
author | rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-23 18:14:13 +0000 |
---|---|---|
committer | rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-23 18:14:13 +0000 |
commit | d6176b0dcacb124539e0cfd051e6d93a9782f020 (patch) | |
tree | 9e6f4b465e54c9b26e1ba70cd8890b55abb08464 /src/utils/mac | |
parent | fbfcd5602128ec010c82cb733c9cdc0a3254f9f3 (diff) |
Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part II of IV (I broke down the 1280 files into 4 CLs).
Review URL: https://codereview.appspot.com/6474054
git-svn-id: http://skia.googlecode.com/svn/trunk@5263 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/utils/mac')
-rw-r--r-- | src/utils/mac/SkBitmap_Mac.cpp | 18 | ||||
-rw-r--r-- | src/utils/mac/SkCreateCGImageRef.cpp | 22 |
2 files changed, 20 insertions, 20 deletions
diff --git a/src/utils/mac/SkBitmap_Mac.cpp b/src/utils/mac/SkBitmap_Mac.cpp index a99513135d..1f73f0f423 100644 --- a/src/utils/mac/SkBitmap_Mac.cpp +++ b/src/utils/mac/SkBitmap_Mac.cpp @@ -20,7 +20,7 @@ static void convertGL32_to_Mac32(uint32_t dst[], const SkBitmap& bm) { memcpy(dst, bm.getPixels(), bm.getSize()); return; - + uint32_t* stop = dst + (bm.getSize() >> 2); const uint8_t* src = (const uint8_t*)bm.getPixels(); while (dst < stop) { @@ -38,7 +38,7 @@ static void convert565_to_32(uint32_t dst[], const SkBitmap& bm) { unsigned r = SkPacked16ToR32(c); unsigned g = SkPacked16ToG32(c); unsigned b = SkPacked16ToB32(c); - + *dst++ = (b << 24) | (g << 16) | (r << 8) | 0xFF; } } @@ -47,11 +47,11 @@ static void convert565_to_32(uint32_t dst[], const SkBitmap& bm) { static void convert4444_to_555(uint16_t dst[], const uint16_t src[], int count) { const uint16_t* stop = src + count; - + while (src < stop) { unsigned c = *src++; - + unsigned r = SkGetPackedR4444(c); unsigned g = SkGetPackedG4444(c); unsigned b = SkGetPackedB4444(c); @@ -61,7 +61,7 @@ static void convert4444_to_555(uint16_t dst[], const uint16_t src[], int count) b = (b << 1) | (b >> 3); // build the 555 c = (r << 10) | (g << 5) | b; - + #ifdef SWAP_16BIT c = (c >> 8) | (c << 8); #endif @@ -111,10 +111,10 @@ static CGImageRef bitmap2imageref(const SkBitmap& bm) { } void SkBitmap::drawToPort(WindowRef wind, CGContextRef cg) const { - if (fPixels == NULL || fWidth == 0 || fHeight == 0) { - return; + if (fPixels == NULL || fWidth == 0 || fHeight == 0) { + return; } - + bool useQD = false; if (NULL == cg) { SetPortWindowPort(wind); @@ -136,7 +136,7 @@ void SkBitmap::drawToPort(WindowRef wind, CGContextRef cg) const { rect.origin.x = rect.origin.y = 0; rect.size.width = bm.width(); rect.size.height = bm.height(); - + CGContextDrawImage(cg, rect, image); CGImageRelease(image); } diff --git a/src/utils/mac/SkCreateCGImageRef.cpp b/src/utils/mac/SkCreateCGImageRef.cpp index e5f7c69cb8..df20ba930d 100644 --- a/src/utils/mac/SkCreateCGImageRef.cpp +++ b/src/utils/mac/SkCreateCGImageRef.cpp @@ -18,14 +18,14 @@ static void SkBitmap_ReleaseInfo(void* info, const void* pixelData, size_t size) (SK_A32_SHIFT == (a) && SK_R32_SHIFT == (r) \ && SK_G32_SHIFT == (g) && SK_B32_SHIFT == (b)) -static bool getBitmapInfo(const SkBitmap& bm, +static bool getBitmapInfo(const SkBitmap& bm, size_t* bitsPerComponent, CGBitmapInfo* info, bool* upscaleTo32) { if (upscaleTo32) { *upscaleTo32 = false; } - + switch (bm.config()) { case SkBitmap::kRGB_565_Config: if (upscaleTo32) { @@ -105,11 +105,11 @@ CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm, const size_t s = bitmap->getSize(); // our provider "owns" the bitmap*, and will take care of deleting it - // 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(); + // 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); + SkBitmap_ReleaseInfo); bool releaseColorSpace = false; if (NULL == colorSpace) { @@ -177,7 +177,7 @@ bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) { if (NULL == data) { return false; } - + CGPDFDocumentRef pdf = CGPDFDocumentCreateWithProvider(data); CGDataProviderRelease(data); if (NULL == pdf) { @@ -189,12 +189,12 @@ bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) { if (NULL == page) { return false; } - + CGRect bounds = CGPDFPageGetBoxRect(page, kCGPDFMediaBox); - + int w = (int)CGRectGetWidth(bounds); int h = (int)CGRectGetHeight(bounds); - + SkBitmap bitmap; bitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h); bitmap.allocPixels(); @@ -202,7 +202,7 @@ bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) { size_t bitsPerComponent; CGBitmapInfo info; - getBitmapInfo(bitmap, &bitsPerComponent, &info, NULL); + getBitmapInfo(bitmap, &bitsPerComponent, &info, NULL); CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB(); CGContextRef ctx = CGBitmapContextCreate(bitmap.getPixels(), w, h, |