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

Side by Side Diff: ui/gfx/image/image_util.cc

Issue 11086058: Switch from FORMAT_BGRA to FORMAT_SkBitmap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/gfx/image/image_util.h" 5 #include "ui/gfx/image/image_util.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "third_party/skia/include/core/SkBitmap.h" 8 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "ui/gfx/codec/jpeg_codec.h" 9 #include "ui/gfx/codec/jpeg_codec.h"
10 #include "ui/gfx/image/image.h" 10 #include "ui/gfx/image/image.h"
(...skipping 25 matching lines...) Expand all
36 bool JPEGEncodedDataFromImage(const Image& image, int quality, 36 bool JPEGEncodedDataFromImage(const Image& image, int quality,
37 std::vector<unsigned char>* dst) { 37 std::vector<unsigned char>* dst) {
38 const SkBitmap& bitmap = *image.ToSkBitmap(); 38 const SkBitmap& bitmap = *image.ToSkBitmap();
39 SkAutoLockPixels bitmap_lock(bitmap); 39 SkAutoLockPixels bitmap_lock(bitmap);
40 40
41 if (!bitmap.readyToDraw()) 41 if (!bitmap.readyToDraw())
42 return false; 42 return false;
43 43
44 return gfx::JPEGCodec::Encode( 44 return gfx::JPEGCodec::Encode(
45 reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)), 45 reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)),
46 gfx::JPEGCodec::FORMAT_BGRA, bitmap.width(), 46 gfx::JPEGCodec::FORMAT_SkBitmap, bitmap.width(),
47 bitmap.height(), 47 bitmap.height(),
48 static_cast<int>(bitmap.rowBytes()), quality, 48 static_cast<int>(bitmap.rowBytes()), quality,
49 dst); 49 dst);
50 } 50 }
51 #endif // !defined(OS_IOS) 51 #endif // !defined(OS_IOS)
52 52
53 } 53 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698