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

Side by Side Diff: chrome/renderer/print_web_view_helper.cc

Issue 243076: Move the JPEG and PNG codecs from base/gfx to app/gfx/codec. Move the classes... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/print_web_view_helper.h" 5 #include "chrome/renderer/print_web_view_helper.h"
6 6
7 #include "app/gfx/codec/jpeg_codec.h"
7 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
8 #include "base/gfx/jpeg_codec.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
11 #include "chrome/renderer/render_view.h" 11 #include "chrome/renderer/render_view.h"
12 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
13 #include "printing/units.h" 13 #include "printing/units.h"
14 #include "webkit/api/public/WebFrame.h" 14 #include "webkit/api/public/WebFrame.h"
15 #include "webkit/api/public/WebRect.h" 15 #include "webkit/api/public/WebRect.h"
16 #include "webkit/api/public/WebScreenInfo.h" 16 #include "webkit/api/public/WebScreenInfo.h"
17 #include "webkit/api/public/WebSize.h" 17 #include "webkit/api/public/WebSize.h"
18 #include "webkit/api/public/WebURLRequest.h" 18 #include "webkit/api/public/WebURLRequest.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 int size_y = static_cast<int>(canvas_size.height() * 132 int size_y = static_cast<int>(canvas_size.height() *
133 params.params.max_shrink); 133 params.params.max_shrink);
134 134
135 // Access the bitmap from the canvas device. 135 // Access the bitmap from the canvas device.
136 skia::PlatformCanvas canvas(size_x, size_y, true); 136 skia::PlatformCanvas canvas(size_x, size_y, true);
137 frame->printPage(params.page_number, webkit_glue::ToWebCanvas(&canvas)); 137 frame->printPage(params.page_number, webkit_glue::ToWebCanvas(&canvas));
138 const SkBitmap& bitmap = canvas.getDevice()->accessBitmap(false); 138 const SkBitmap& bitmap = canvas.getDevice()->accessBitmap(false);
139 139
140 // Encode the SkBitmap to jpeg. 140 // Encode the SkBitmap to jpeg.
141 SkAutoLockPixels image_lock(bitmap); 141 SkAutoLockPixels image_lock(bitmap);
142 bool encoded = JPEGCodec::Encode( 142 bool encoded = gfx::JPEGCodec::Encode(
143 reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)), 143 reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)),
144 JPEGCodec::FORMAT_BGRA, 144 gfx::JPEGCodec::FORMAT_BGRA,
145 static_cast<int>(bitmap.width() * zoom_factor), 145 static_cast<int>(bitmap.width() * zoom_factor),
146 static_cast<int>(bitmap.height() * zoom_factor), 146 static_cast<int>(bitmap.height() * zoom_factor),
147 static_cast<int>(bitmap.rowBytes()), 147 static_cast<int>(bitmap.rowBytes()),
148 90, 148 90,
149 image_data); 149 image_data);
150 DCHECK(encoded); 150 DCHECK(encoded);
151 } 151 }
152 152
153 bool PrintWebViewHelper::Send(IPC::Message* msg) { 153 bool PrintWebViewHelper::Send(IPC::Message* msg) {
154 return render_view_->Send(msg); 154 return render_view_->Send(msg);
(...skipping 24 matching lines...) Expand all
179 179
180 WebRect PrintWebViewHelper::rootWindowRect() { 180 WebRect PrintWebViewHelper::rootWindowRect() {
181 NOTREACHED(); 181 NOTREACHED();
182 return WebRect(); 182 return WebRect();
183 } 183 }
184 184
185 WebScreenInfo PrintWebViewHelper::screenInfo() { 185 WebScreenInfo PrintWebViewHelper::screenInfo() {
186 NOTREACHED(); 186 NOTREACHED();
187 return WebScreenInfo(); 187 return WebScreenInfo();
188 } 188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698