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

Side by Side Diff: ui/gfx/codec/jpeg_codec.cc

Issue 361643002: setConfig is deprecated, use setInfo or allocPixels instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't call allocPixels+rowbytes yet (skia bug) Created 6 years, 5 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 | « ui/gfx/android/java_bitmap.cc ('k') | ui/gfx/codec/png_codec.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/codec/jpeg_codec.h" 5 #include "ui/gfx/codec/jpeg_codec.h"
6 6
7 #include <setjmp.h> 7 #include <setjmp.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 SkBitmap* JPEGCodec::Decode(const unsigned char* input, size_t input_size) { 615 SkBitmap* JPEGCodec::Decode(const unsigned char* input, size_t input_size) {
616 int w, h; 616 int w, h;
617 std::vector<unsigned char> data_vector; 617 std::vector<unsigned char> data_vector;
618 if (!Decode(input, input_size, FORMAT_SkBitmap, &data_vector, &w, &h)) 618 if (!Decode(input, input_size, FORMAT_SkBitmap, &data_vector, &w, &h))
619 return NULL; 619 return NULL;
620 620
621 // Skia only handles 32 bit images. 621 // Skia only handles 32 bit images.
622 int data_length = w * h * 4; 622 int data_length = w * h * 4;
623 623
624 SkBitmap* bitmap = new SkBitmap(); 624 SkBitmap* bitmap = new SkBitmap();
625 bitmap->setConfig(SkBitmap::kARGB_8888_Config, w, h); 625 bitmap->allocN32Pixels(w, h);
626 bitmap->allocPixels();
627 memcpy(bitmap->getAddr32(0, 0), &data_vector[0], data_length); 626 memcpy(bitmap->getAddr32(0, 0), &data_vector[0], data_length);
628 627
629 return bitmap; 628 return bitmap;
630 } 629 }
631 630
632 } // namespace gfx 631 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/android/java_bitmap.cc ('k') | ui/gfx/codec/png_codec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698