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

Side by Side Diff: chrome/common/security_filter_peer.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) 2006-2008 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/common/security_filter_peer.h" 5 #include "chrome/common/security_filter_peer.h"
6 6
7 #include "app/gfx/codec/png_codec.h"
7 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 9 #include "app/resource_bundle.h"
9 #include "base/gfx/png_encoder.h"
10 #include "base/gfx/size.h" 10 #include "base/gfx/size.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
13 #include "grit/renderer_resources.h" 13 #include "grit/renderer_resources.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 #include "net/http/http_response_headers.h" 15 #include "net/http/http_response_headers.h"
16 #include "third_party/skia/include/core/SkCanvas.h" 16 #include "third_party/skia/include/core/SkCanvas.h"
17 #include "third_party/skia/include/core/SkBitmap.h" 17 #include "third_party/skia/include/core/SkBitmap.h"
18 #include "third_party/skia/include/core/SkDevice.h" 18 #include "third_party/skia/include/core/SkDevice.h"
19 #include "webkit/glue/webkit_glue.h" 19 #include "webkit/glue/webkit_glue.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 x += stamp_bitmap->width() * 2) { 303 x += stamp_bitmap->width() * 2) {
304 canvas.drawBitmap(*stamp_bitmap, 304 canvas.drawBitmap(*stamp_bitmap,
305 SkIntToScalar(x), 305 SkIntToScalar(x),
306 SkIntToScalar(row * stamp_bitmap->height()), 306 SkIntToScalar(row * stamp_bitmap->height()),
307 &paint); 307 &paint);
308 } 308 }
309 } 309 }
310 310
311 // Now encode it to a PNG. 311 // Now encode it to a PNG.
312 std::vector<unsigned char> output; 312 std::vector<unsigned char> output;
313 if (!PNGEncoder::EncodeBGRASkBitmap(canvas.getDevice()->accessBitmap(false), 313 if (!gfx::PNGCodec::EncodeBGRASkBitmap(
314 false, &output)) { 314 canvas.getDevice()->accessBitmap(false), false, &output)) {
315 return false; 315 return false;
316 } 316 }
317 317
318 // Copy the vector content to data_ which is a string. 318 // Copy the vector content to data_ which is a string.
319 data_.clear(); 319 data_.clear();
320 data_.resize(output.size()); 320 data_.resize(output.size());
321 std::copy(output.begin(), output.end(), data_.begin()); 321 std::copy(output.begin(), output.end(), data_.begin());
322 322
323 return true; 323 return true;
324 } 324 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698