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

Side by Side Diff: Source/WebKit/chromium/src/WebImageSkia.cpp

Issue 11785017: Merge 138302 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « Source/WebKit/chromium/ChangeLog ('k') | 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 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include <wtf/PassRefPtr.h> 43 #include <wtf/PassRefPtr.h>
44 #include <wtf/Vector.h> 44 #include <wtf/Vector.h>
45 45
46 using namespace WebCore; 46 using namespace WebCore;
47 47
48 namespace WebKit { 48 namespace WebKit {
49 49
50 WebImage WebImage::fromData(const WebData& data, const WebSize& desiredSize) 50 WebImage WebImage::fromData(const WebData& data, const WebSize& desiredSize)
51 { 51 {
52 RefPtr<SharedBuffer> buffer = PassRefPtr<SharedBuffer>(data); 52 RefPtr<SharedBuffer> buffer = PassRefPtr<SharedBuffer>(data);
53 OwnPtr<ImageDecoder> decoder(adoptPtr(ImageDecoder::create(*buffer.get(), Im ageSource::AlphaPremultiplied, ImageSource::GammaAndColorProfileApplied))); 53 OwnPtr<ImageDecoder> decoder(adoptPtr(ImageDecoder::create(*buffer.get(), Im ageSource::AlphaPremultiplied, ImageSource::GammaAndColorProfileIgnored)));
54 if (!decoder) 54 if (!decoder)
55 return WebImage(); 55 return WebImage();
56 56
57 decoder->setData(buffer.get(), true); 57 decoder->setData(buffer.get(), true);
58 if (!decoder->isSizeAvailable()) 58 if (!decoder->isSizeAvailable())
59 return WebImage(); 59 return WebImage();
60 60
61 // Frames are arranged by decreasing size, then decreasing bit depth. 61 // Frames are arranged by decreasing size, then decreasing bit depth.
62 // Pick the frame closest to |desiredSize|'s area without being smaller, 62 // Pick the frame closest to |desiredSize|'s area without being smaller,
63 // which has the highest bit depth. 63 // which has the highest bit depth.
(...skipping 27 matching lines...) Expand all
91 91
92 return WebImage(image->bitmap()); 92 return WebImage(image->bitmap());
93 } 93 }
94 94
95 WebVector<WebImage> WebImage::framesFromData(const WebData& data) 95 WebVector<WebImage> WebImage::framesFromData(const WebData& data)
96 { 96 {
97 // This is to protect from malicious images. It should be big enough that it 's never hit in pracice. 97 // This is to protect from malicious images. It should be big enough that it 's never hit in pracice.
98 const size_t maxFrameCount = 8; 98 const size_t maxFrameCount = 8;
99 99
100 RefPtr<SharedBuffer> buffer = PassRefPtr<SharedBuffer>(data); 100 RefPtr<SharedBuffer> buffer = PassRefPtr<SharedBuffer>(data);
101 OwnPtr<ImageDecoder> decoder(adoptPtr(ImageDecoder::create(*buffer.get(), Im ageSource::AlphaPremultiplied, ImageSource::GammaAndColorProfileApplied))); 101 OwnPtr<ImageDecoder> decoder(adoptPtr(ImageDecoder::create(*buffer.get(), Im ageSource::AlphaPremultiplied, ImageSource::GammaAndColorProfileIgnored)));
102 if (!decoder) 102 if (!decoder)
103 return WebVector<WebImage>(); 103 return WebVector<WebImage>();
104 104
105 decoder->setData(buffer.get(), true); 105 decoder->setData(buffer.get(), true);
106 if (!decoder->isSizeAvailable()) 106 if (!decoder->isSizeAvailable())
107 return WebVector<WebImage>(); 107 return WebVector<WebImage>();
108 108
109 // Frames are arranged by decreasing size, then decreasing bit depth. 109 // Frames are arranged by decreasing size, then decreasing bit depth.
110 // Keep the first frame at every size, has the highest bit depth. 110 // Keep the first frame at every size, has the highest bit depth.
111 const size_t frameCount = decoder->frameCount(); 111 const size_t frameCount = decoder->frameCount();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 { 159 {
160 NativeImagePtr p; 160 NativeImagePtr p;
161 if (image.get() && (p = image->nativeImageForCurrentFrame())) 161 if (image.get() && (p = image->nativeImageForCurrentFrame()))
162 assign(p->bitmap()); 162 assign(p->bitmap());
163 else 163 else
164 reset(); 164 reset();
165 return *this; 165 return *this;
166 } 166 }
167 167
168 } // namespace WebKit 168 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698