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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/BitmapImage.cpp

Issue 1732563007: [NOT FOR COMMIT] Pass defaultObjectSize to get image size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
1 /* 1 /*
2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 void BitmapImage::updateSize() const 183 void BitmapImage::updateSize() const
184 { 184 {
185 if (!m_sizeAvailable || m_haveSize) 185 if (!m_sizeAvailable || m_haveSize)
186 return; 186 return;
187 187
188 m_size = m_source.size(); 188 m_size = m_source.size();
189 m_sizeRespectingOrientation = m_source.size(RespectImageOrientation); 189 m_sizeRespectingOrientation = m_source.size(RespectImageOrientation);
190 m_haveSize = true; 190 m_haveSize = true;
191 } 191 }
192 192
193 IntSize BitmapImage::size() const 193 IntSize BitmapImage::concreteObjectSize(const FloatSize&) const
194 { 194 {
195 updateSize(); 195 updateSize();
196 return m_size; 196 return m_size;
197 } 197 }
198 198
199 IntSize BitmapImage::sizeRespectingOrientation() const 199 IntSize BitmapImage::sizeRespectingOrientation() const
200 { 200 {
201 updateSize(); 201 updateSize();
202 return m_sizeRespectingOrientation; 202 return m_sizeRespectingOrientation;
203 } 203 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 return (size.width() > 1 || size.height() > 1); 323 return (size.width() > 1 || size.height() > 1);
324 } 324 }
325 325
326 bool BitmapImage::isSizeAvailable() 326 bool BitmapImage::isSizeAvailable()
327 { 327 {
328 if (m_sizeAvailable) 328 if (m_sizeAvailable)
329 return true; 329 return true;
330 330
331 m_sizeAvailable = m_source.isSizeAvailable(); 331 m_sizeAvailable = m_source.isSizeAvailable();
332 332
333 if (m_sizeAvailable && hasVisibleImageSize(size())) { 333 if (m_sizeAvailable && hasVisibleImageSize(defaultConcreteObjectSize())) {
334 BitmapImageMetrics::countDecodedImageType(m_source.filenameExtension()); 334 BitmapImageMetrics::countDecodedImageType(m_source.filenameExtension());
335 if (m_source.filenameExtension() == "jpg") 335 if (m_source.filenameExtension() == "jpg")
336 BitmapImageMetrics::countImageOrientation(m_source.orientationAtInde x(0).orientation()); 336 BitmapImageMetrics::countImageOrientation(m_source.orientationAtInde x(0).orientation());
337 } 337 }
338 338
339 return m_sizeAvailable; 339 return m_sizeAvailable;
340 } 340 }
341 341
342 bool BitmapImage::ensureFrameIsCached(size_t index) 342 bool BitmapImage::ensureFrameIsCached(size_t index)
343 { 343 {
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 destroyDecodedDataIfNecessary(); 634 destroyDecodedDataIfNecessary();
635 635
636 // We need to draw this frame if we advanced to it while not skipping, or if 636 // We need to draw this frame if we advanced to it while not skipping, or if
637 // while trying to skip frames we hit the last frame and thus had to stop. 637 // while trying to skip frames we hit the last frame and thus had to stop.
638 if (skippingFrames != advancedAnimation) 638 if (skippingFrames != advancedAnimation)
639 imageObserver()->animationAdvanced(this); 639 imageObserver()->animationAdvanced(this);
640 return advancedAnimation; 640 return advancedAnimation;
641 } 641 }
642 642
643 } // namespace blink 643 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698