Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: experimental/PdfViewer/src/SkPdfRenderer.cpp

Issue 775763003: Fix PdfViewer BGR byte order (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Another Patch Set Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « expectations/gm/Test-Mac10.8-MacMini4.1-GeForce320M-x86_64-Release/expected-results.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/PdfViewer/src/SkPdfRenderer.cpp
diff --git a/experimental/PdfViewer/src/SkPdfRenderer.cpp b/experimental/PdfViewer/src/SkPdfRenderer.cpp
index 09953440932d71603e5b95aa62eb2c4754afa6dd..35e6e060add4c9d5d83a4d908b8217fd72aa8bad 100644
--- a/experimental/PdfViewer/src/SkPdfRenderer.cpp
+++ b/experimental/PdfViewer/src/SkPdfRenderer.cpp
@@ -9,6 +9,7 @@
#include "SkBitmapDevice.h"
#include "SkCanvas.h"
+#include "SkColorPriv.h"
#include "SkDevice.h"
#include "SkForceLinking.h"
#include "SkGraphics.h"
@@ -383,14 +384,15 @@ static SkBitmap* transferImageStreamToBitmap(const unsigned char* uncompressedSt
// minimal support for now
if ((colorSpace.equals("DeviceRGB") || colorSpace.equals("RGB")) && bpc == 8) {
- SkColor* uncompressedStreamArgb = (SkColor*)malloc(width * height * sizeof(SkColor));
+ uint32_t* uncompressedStreamArgb = (SkColor*)malloc(width * height * sizeof(uint32_t));
for (int h = 0 ; h < height; h++) {
long i = width * (h);
for (int w = 0 ; w < width; w++) {
- uncompressedStreamArgb[i] = SkColorSetRGB(uncompressedStream[3 * w],
- uncompressedStream[3 * w + 1],
- uncompressedStream[3 * w + 2]);
+ uncompressedStreamArgb[i] = SkPackARGB32(0xFF,
+ uncompressedStream[3 * w],
+ uncompressedStream[3 * w + 1],
+ uncompressedStream[3 * w + 2]);
i++;
}
uncompressedStream += bytesPerLine;
« no previous file with comments | « expectations/gm/Test-Mac10.8-MacMini4.1-GeForce320M-x86_64-Release/expected-results.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698