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

Side by Side Diff: src/utils/SkPDFRasterizer.cpp

Issue 27487003: Third wave of Win64 warning cleanup (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Got compiling on linux Created 7 years, 2 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/pdf/SkTSet.h ('k') | tests/BitmapCopyTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifdef SK_BUILD_FOR_WIN32 9 #ifdef SK_BUILD_FOR_WIN32
10 #pragma warning(push) 10 #pragma warning(push)
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 SkAutoTDelete<poppler::page> page(doc->create_page(0)); 33 SkAutoTDelete<poppler::page> page(doc->create_page(0));
34 poppler::page_renderer renderer; 34 poppler::page_renderer renderer;
35 poppler::image image = renderer.render_page(page.get()); 35 poppler::image image = renderer.render_page(page.get());
36 36
37 if (!image.is_valid() || image.format() != poppler::image::format_argb32) { 37 if (!image.is_valid() || image.format() != poppler::image::format_argb32) {
38 return false; 38 return false;
39 } 39 }
40 40
41 size_t width = image.width(), height = image.height(); 41 int width = image.width(), height = image.height();
42 size_t rowSize = image.bytes_per_row(); 42 size_t rowSize = image.bytes_per_row();
43 char *imgData = image.data(); 43 char *imgData = image.data();
44 44
45 SkBitmap bitmap; 45 SkBitmap bitmap;
46 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); 46 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
47 if (!bitmap.allocPixels()) { 47 if (!bitmap.allocPixels()) {
48 return false; 48 return false;
49 } 49 }
50 bitmap.eraseColor(SK_ColorWHITE); 50 bitmap.eraseColor(SK_ColorWHITE);
51 SkPMColor* bitmapPixels = (SkPMColor*)bitmap.getPixels(); 51 SkPMColor* bitmapPixels = (SkPMColor*)bitmap.getPixels();
52 52
53 // do pixel-by-pixel copy to deal with RGBA ordering conversions 53 // do pixel-by-pixel copy to deal with RGBA ordering conversions
54 for (size_t y = 0; y < height; y++) { 54 for (int y = 0; y < height; y++) {
55 char *rowData = imgData; 55 char *rowData = imgData;
56 for (size_t x = 0; x < width; x++) { 56 for (int x = 0; x < width; x++) {
57 uint8_t a = rowData[3]; 57 uint8_t a = rowData[3];
58 uint8_t r = rowData[2]; 58 uint8_t r = rowData[2];
59 uint8_t g = rowData[1]; 59 uint8_t g = rowData[1];
60 uint8_t b = rowData[0]; 60 uint8_t b = rowData[0];
61 61
62 *bitmapPixels = SkPreMultiplyARGB(a, r, g, b); 62 *bitmapPixels = SkPreMultiplyARGB(a, r, g, b);
63 63
64 bitmapPixels++; 64 bitmapPixels++;
65 rowData += 4; 65 rowData += 4;
66 } 66 }
67 imgData += rowSize; 67 imgData += rowSize;
68 } 68 }
69 69
70 output->swap(bitmap); 70 output->swap(bitmap);
71 71
72 return true; 72 return true;
73 } 73 }
OLDNEW
« no previous file with comments | « src/pdf/SkTSet.h ('k') | tests/BitmapCopyTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698