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

Side by Side Diff: chrome/browser/chromeos/login/user_image.cc

Issue 10454044: Added support for animated/nonanimated user image. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Small fixes to comments. Created 8 years, 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/login/user_image.h"
6
7 namespace chromeos {
8
9 namespace {
10
11 bool IsAnimatedImage(const UserImage::RawImage& data) {
12 const char kGIFStamp[] = "GIF";
13 const size_t kGIFStampLength = sizeof(kGIFStamp) - 1;
14
15 if (data.size() >= kGIFStampLength &&
16 memcmp(&data[0], kGIFStamp, kGIFStampLength) == 0) {
17 return true;
18 }
19 return false;
20 }
21
22 } // namespace
23
24 UserImage::UserImage(const gfx::ImageSkia& image)
25 : image_(image),
26 has_raw_image_(false),
27 has_animated_image_(false) {
28 }
29
30 UserImage::UserImage(const gfx::ImageSkia& image,
31 const RawImage& raw_image)
32 : image_(image),
33 has_raw_image_(true),
34 has_animated_image_(IsAnimatedImage(raw_image)),
35 raw_image_(raw_image) {
36 }
37
38 UserImage::~UserImage() {}
39
40 void UserImage::SetImage(const gfx::ImageSkia& image) {
41 image_ = image;
42 has_raw_image_ = false;
43 has_animated_image_ = false;
44 // Clear |raw_image_|.
45 RawImage().swap(raw_image_);
46 }
47
48 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698