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

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

Issue 322963002: hide SkBitmap::setConfig (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCommandLineFlags.h" 10 #include "SkCommandLineFlags.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 static bool make_output_filepath(SkString* path, const SkString& dir, 103 static bool make_output_filepath(SkString* path, const SkString& dir,
104 const SkString& name, 104 const SkString& name,
105 int page) { 105 int page) {
106 *path = SkOSPath::SkPathJoin(dir.c_str(), name.c_str()); 106 *path = SkOSPath::SkPathJoin(dir.c_str(), name.c_str());
107 return add_page_and_replace_filename_extension(path, page, 107 return add_page_and_replace_filename_extension(path, page,
108 PDF_FILE_EXTENSION, 108 PDF_FILE_EXTENSION,
109 PNG_FILE_EXTENSION); 109 PNG_FILE_EXTENSION);
110 } 110 }
111 111
112 static void setup_bitmap(SkBitmap* bitmap, int width, int height, SkColor color) { 112 static void setup_bitmap(SkBitmap* bitmap, int width, int height, SkColor color) {
113 bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height); 113 bitmap->allocN32Pixels(width, height);
114
115 bitmap->allocPixels();
116 bitmap->eraseColor(color); 114 bitmap->eraseColor(color);
117 } 115 }
118 116
119 /** Write the output of pdf renderer to a file. 117 /** Write the output of pdf renderer to a file.
120 * @param outputDir Output dir. 118 * @param outputDir Output dir.
121 * @param inputFilename The skp file that was read. 119 * @param inputFilename The skp file that was read.
122 * @param renderer The object responsible to write the pdf file. 120 * @param renderer The object responsible to write the pdf file.
123 * @param page -1 means there is only one page (0), and render in a file without page extension 121 * @param page -1 means there is only one page (0), and render in a file without page extension
124 */ 122 */
125 123
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 } 340 }
343 341
344 return 0; 342 return 0;
345 } 343 }
346 344
347 #if !defined SK_BUILD_FOR_IOS 345 #if !defined SK_BUILD_FOR_IOS
348 int main(int argc, char * const argv[]) { 346 int main(int argc, char * const argv[]) {
349 return tool_main(argc, (char**) argv); 347 return tool_main(argc, (char**) argv);
350 } 348 }
351 #endif 349 #endif
OLDNEW
« no previous file with comments | « experimental/PdfViewer/chop_transparency_main.cpp ('k') | experimental/PdfViewer/src/SkPdfRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698