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

Side by Side Diff: chrome/common/jpeg_codec.cc

Issue 2929: Some initial work on compiling chrome/common/ on Linux.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 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 | « chrome/common/gfx/color_utils.cc ('k') | chrome/common/json_value_serializer.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <setjmp.h> 5 #include <setjmp.h>
6 6
7 #include "chrome/common/jpeg_codec.h" 7 #include "chrome/common/jpeg_codec.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 // Use FORMAT_BGRA as that maps to Skia's 32 bit (kARGB_8888_Config) format. 507 // Use FORMAT_BGRA as that maps to Skia's 32 bit (kARGB_8888_Config) format.
508 if (!Decode(input, input_size, FORMAT_BGRA, &data_vector, &w, &h)) 508 if (!Decode(input, input_size, FORMAT_BGRA, &data_vector, &w, &h))
509 return NULL; 509 return NULL;
510 510
511 // Skia only handles 32 bit images. 511 // Skia only handles 32 bit images.
512 int data_length = w * h * 4; 512 int data_length = w * h * 4;
513 513
514 SkBitmap* bitmap = new SkBitmap(); 514 SkBitmap* bitmap = new SkBitmap();
515 bitmap->setConfig(SkBitmap::kARGB_8888_Config, w, h); 515 bitmap->setConfig(SkBitmap::kARGB_8888_Config, w, h);
516 bitmap->allocPixels(); 516 bitmap->allocPixels();
517 memcpy(bitmap->getAddr32(0, 0), &data_vector[0], w * h * 4); 517 memcpy(bitmap->getAddr32(0, 0), &data_vector[0], data_length);
518 518
519 return bitmap; 519 return bitmap;
520 } 520 }
521 521
OLDNEW
« no previous file with comments | « chrome/common/gfx/color_utils.cc ('k') | chrome/common/json_value_serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698