summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorMike Reed <reed@google.com>2017-07-13 09:53:13 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-13 14:28:54 +0000
commit360d1fce569b57aa2c487f6e171ba19b9dc8885e (patch)
treecc40fb88d28925b0f8a4f2a2b98f186074eb2122 /core
parent53aafa99985e93c527ea2803400f250025cc7f01 (diff)
downloadpdfium-360d1fce569b57aa2c487f6e171ba19b9dc8885e.tar.xz
Index_8 no longer supported, upscale to N32
This should unblock the skia-roller Bug:Skia:6828 Change-Id: Id918f017ed69bea9536eb1df8c31d43eac51d680 Reviewed-on: https://pdfium-review.googlesource.com/7730 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
Diffstat (limited to 'core')
-rw-r--r--core/fxge/skia/fx_skia_device.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index ad3b85c1fb..278b6d874f 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -599,10 +599,27 @@ bool Upsample(const CFX_RetainPtr<CFX_DIBSource>& pSource,
break;
}
case 8:
+ // we upscale ctables to 32bit.
if (pSource->GetPalette()) {
- *ctPtr =
- new SkColorTable(pSource->GetPalette(), pSource->GetPaletteSize());
- colorType = SkColorType::kIndex_8_SkColorType;
+ dst32Storage.reset(FX_Alloc2D(uint32_t, width, height));
+ SkPMColor* dst32Pixels = dst32Storage.get();
+ const SkPMColor* ctable = pSource->GetPalette();
+ const unsigned ctableSize = pSource->GetPaletteSize();
+ for (int y = 0; y < height; ++y) {
+ const uint8_t* srcRow =
+ static_cast<const uint8_t*>(buffer) + y * rowBytes;
+ uint32_t* dstRow = dst32Pixels + y * width;
+ for (int x = 0; x < width; ++x) {
+ unsigned index = srcRow[x];
+ if (index >= ctableSize) {
+ index = 0;
+ }
+ dstRow[x] = ctable[index];
+ }
+ }
+ buffer = dst32Storage.get();
+ rowBytes = width * sizeof(uint32_t);
+ colorType = SkColorType::kN32_SkColorType;
}
break;
case 24: {