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

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

Issue 143073008: add installPixels (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 years, 11 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/SkPDFDevice.cpp ('k') | src/utils/debugger/SkDebugCanvas.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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 if (!image.is_valid() || image.format() != poppler::image::format_argb32) { 44 if (!image.is_valid() || image.format() != poppler::image::format_argb32) {
45 return false; 45 return false;
46 } 46 }
47 47
48 int width = image.width(), height = image.height(); 48 int width = image.width(), height = image.height();
49 size_t rowSize = image.bytes_per_row(); 49 size_t rowSize = image.bytes_per_row();
50 char *imgData = image.data(); 50 char *imgData = image.data();
51 51
52 SkBitmap bitmap; 52 SkBitmap bitmap;
53 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); 53 if (!bitmap.allocPixels(SkImageInfo::MakeN32Premul(width, height))) {
54 if (!bitmap.allocPixels()) {
55 return false; 54 return false;
56 } 55 }
57 bitmap.eraseColor(SK_ColorWHITE); 56 bitmap.eraseColor(SK_ColorWHITE);
58 SkPMColor* bitmapPixels = (SkPMColor*)bitmap.getPixels(); 57 SkPMColor* bitmapPixels = (SkPMColor*)bitmap.getPixels();
59 58
60 // do pixel-by-pixel copy to deal with RGBA ordering conversions 59 // do pixel-by-pixel copy to deal with RGBA ordering conversions
61 for (int y = 0; y < height; y++) { 60 for (int y = 0; y < height; y++) {
62 char *rowData = imgData; 61 char *rowData = imgData;
63 for (int x = 0; x < width; x++) { 62 for (int x = 0; x < width; x++) {
64 uint8_t a = rowData[3]; 63 uint8_t a = rowData[3];
(...skipping 13 matching lines...) Expand all
78 77
79 return true; 78 return true;
80 } 79 }
81 #endif // SK_BUILD_POPPLER 80 #endif // SK_BUILD_POPPLER
82 81
83 #ifdef SK_BUILD_NATIVE_PDF_RENDERER 82 #ifdef SK_BUILD_NATIVE_PDF_RENDERER
84 bool SkNativeRasterizePDF(SkStream* pdf, SkBitmap* output) { 83 bool SkNativeRasterizePDF(SkStream* pdf, SkBitmap* output) {
85 return SkPDFNativeRenderToBitmap(pdf, output); 84 return SkPDFNativeRenderToBitmap(pdf, output);
86 } 85 }
87 #endif // SK_BUILD_NATIVE_PDF_RENDERER 86 #endif // SK_BUILD_NATIVE_PDF_RENDERER
OLDNEW
« no previous file with comments | « src/pdf/SkPDFDevice.cpp ('k') | src/utils/debugger/SkDebugCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698