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

Side by Side Diff: experimental/PdfViewer/pdf_viewer_main.cpp

Issue 21981008: pdfviewer: set backdround to transparent, and add an app to chop transparent content in png files. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 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 | « experimental/PdfViewer/chop_transparency_main.cpp ('k') | gyp/pdfviewer.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "SkCanvas.h" 1 #include "SkCanvas.h"
2 #include "SkCommandLineFlags.h" 2 #include "SkCommandLineFlags.h"
3 #include "SkDevice.h" 3 #include "SkDevice.h"
4 #include "SkGraphics.h" 4 #include "SkGraphics.h"
5 #include "SkImageDecoder.h" 5 #include "SkImageDecoder.h"
6 #include "SkImageEncoder.h" 6 #include "SkImageEncoder.h"
7 #include "SkOSFile.h" 7 #include "SkOSFile.h"
8 #include "SkPicture.h" 8 #include "SkPicture.h"
9 #include "SkStream.h" 9 #include "SkStream.h"
10 #include "SkTypeface.h" 10 #include "SkTypeface.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 */ 132 */
133 static bool make_output_filepath(SkString* path, const SkString& dir, 133 static bool make_output_filepath(SkString* path, const SkString& dir,
134 const SkString& name, 134 const SkString& name,
135 int page) { 135 int page) {
136 make_filepath(path, dir, name); 136 make_filepath(path, dir, name);
137 return add_page_and_replace_filename_extension(path, page, 137 return add_page_and_replace_filename_extension(path, page,
138 PDF_FILE_EXTENSION, 138 PDF_FILE_EXTENSION,
139 PNG_FILE_EXTENSION); 139 PNG_FILE_EXTENSION);
140 } 140 }
141 141
142 static void setup_bitmap(SkBitmap* bitmap, int width, int height, SkColor color = SK_ColorWHITE) { 142 static void setup_bitmap(SkBitmap* bitmap, int width, int height, SkColor color = SK_ColorTRANSPARENT) {
143 bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height); 143 bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height);
144 144
145 bitmap->allocPixels(); 145 bitmap->allocPixels();
146 bitmap->eraseColor(color); 146 bitmap->eraseColor(color);
147 } 147 }
148 148
149 /** Write the output of pdf renderer to a file. 149 /** Write the output of pdf renderer to a file.
150 * @param outputDir Output dir. 150 * @param outputDir Output dir.
151 * @param inputFilename The skp file that was read. 151 * @param inputFilename The skp file that was read.
152 * @param renderer The object responsible to write the pdf file. 152 * @param renderer The object responsible to write the pdf file.
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 } 332 }
333 333
334 return 0; 334 return 0;
335 } 335 }
336 336
337 #if !defined SK_BUILD_FOR_IOS 337 #if !defined SK_BUILD_FOR_IOS
338 int main(int argc, char * const argv[]) { 338 int main(int argc, char * const argv[]) {
339 return tool_main(argc, (char**) argv); 339 return tool_main(argc, (char**) argv);
340 } 340 }
341 #endif 341 #endif
OLDNEW
« no previous file with comments | « experimental/PdfViewer/chop_transparency_main.cpp ('k') | gyp/pdfviewer.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698