OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkPDFImage.h" | 8 #include "SkPDFImage.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 return SkPackARGB4444(SK_AlphaOPAQUE & 0x0F, | 419 return SkPackARGB4444(SK_AlphaOPAQUE & 0x0F, |
420 r / count, g / count, b / count); | 420 r / count, g / count, b / count); |
421 } | 421 } |
422 } | 422 } |
423 | 423 |
424 static SkBitmap unpremultiply_bitmap(const SkBitmap& bitmap, | 424 static SkBitmap unpremultiply_bitmap(const SkBitmap& bitmap, |
425 const SkIRect& srcRect) { | 425 const SkIRect& srcRect) { |
426 SkBitmap outBitmap; | 426 SkBitmap outBitmap; |
427 outBitmap.setConfig(bitmap.config(), srcRect.width(), srcRect.height()); | 427 outBitmap.setConfig(bitmap.config(), srcRect.width(), srcRect.height()); |
428 outBitmap.allocPixels(); | 428 outBitmap.allocPixels(); |
429 size_t dstRow = 0; | 429 int dstRow = 0; |
430 | 430 |
431 outBitmap.lockPixels(); | 431 outBitmap.lockPixels(); |
432 bitmap.lockPixels(); | 432 bitmap.lockPixels(); |
433 switch (bitmap.config()) { | 433 switch (bitmap.config()) { |
434 case SkBitmap::kARGB_4444_Config: { | 434 case SkBitmap::kARGB_4444_Config: { |
435 for (int y = srcRect.fTop; y < srcRect.fBottom; y++) { | 435 for (int y = srcRect.fTop; y < srcRect.fBottom; y++) { |
436 uint16_t* dst = outBitmap.getAddr16(0, dstRow); | 436 uint16_t* dst = outBitmap.getAddr16(0, dstRow); |
437 uint16_t* src = bitmap.getAddr16(0, y); | 437 uint16_t* src = bitmap.getAddr16(0, y); |
438 for (int x = srcRect.fLeft; x < srcRect.fRight; x++) { | 438 for (int x = srcRect.fLeft; x < srcRect.fRight; x++) { |
439 uint8_t a = SkGetPackedA4444(src[x]); | 439 uint8_t a = SkGetPackedA4444(src[x]); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 // but the new catalog wants it compressed. | 680 // but the new catalog wants it compressed. |
681 if (!getSubstitute()) { | 681 if (!getSubstitute()) { |
682 SkPDFStream* substitute = SkNEW_ARGS(SkPDFImage, (*this)); | 682 SkPDFStream* substitute = SkNEW_ARGS(SkPDFImage, (*this)); |
683 setSubstitute(substitute); | 683 setSubstitute(substitute); |
684 catalog->setSubstitute(this, substitute); | 684 catalog->setSubstitute(this, substitute); |
685 } | 685 } |
686 return false; | 686 return false; |
687 } | 687 } |
688 return true; | 688 return true; |
689 } | 689 } |
OLD | NEW |