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

Side by Side Diff: Source/core/fetch/ImageResource.cpp

Issue 22900016: x (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 | « no previous file | Source/core/platform/SharedBuffer.h » ('j') | 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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 if (!fetcher || fetcher->autoLoadImages()) 70 if (!fetcher || fetcher->autoLoadImages())
71 Resource::load(fetcher, options); 71 Resource::load(fetcher, options);
72 else 72 else
73 setLoading(false); 73 setLoading(false);
74 } 74 }
75 75
76 void ImageResource::didAddClient(ResourceClient* c) 76 void ImageResource::didAddClient(ResourceClient* c)
77 { 77 {
78 if (m_data && !m_image && !errorOccurred()) { 78 if (m_data && !m_image && !errorOccurred()) {
79 createImage(); 79 createImage();
80 m_data->setDebug(url().string());
80 m_image->setData(m_data, true); 81 m_image->setData(m_data, true);
81 } 82 }
82 83
83 ASSERT(c->resourceClientType() == ImageResourceClient::expectedType()); 84 ASSERT(c->resourceClientType() == ImageResourceClient::expectedType());
84 if (m_image && !m_image->isNull()) 85 if (m_image && !m_image->isNull())
85 static_cast<ImageResourceClient*>(c)->imageChanged(this); 86 static_cast<ImageResourceClient*>(c)->imageChanged(this);
86 87
87 Resource::didAddClient(c); 88 Resource::didAddClient(c);
88 } 89 }
89 90
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 void ImageResource::updateImage(bool allDataReceived) 325 void ImageResource::updateImage(bool allDataReceived)
325 { 326 {
326 if (m_data) 327 if (m_data)
327 createImage(); 328 createImage();
328 329
329 bool sizeAvailable = false; 330 bool sizeAvailable = false;
330 331
331 // Have the image update its data from its internal buffer. 332 // Have the image update its data from its internal buffer.
332 // It will not do anything now, but will delay decoding until 333 // It will not do anything now, but will delay decoding until
333 // queried for info (like size or specific image frames). 334 // queried for info (like size or specific image frames).
335 if (m_data)
336 m_data->setDebug(url().string());
334 if (m_image) 337 if (m_image)
335 sizeAvailable = m_image->setData(m_data, allDataReceived); 338 sizeAvailable = m_image->setData(m_data, allDataReceived);
336 339
337 // Go ahead and tell our observers to try to draw if we have either 340 // Go ahead and tell our observers to try to draw if we have either
338 // received all the data or the size is known. Each chunk from the 341 // received all the data or the size is known. Each chunk from the
339 // network causes observers to repaint, which will force that chunk 342 // network causes observers to repaint, which will force that chunk
340 // to decode. 343 // to decode.
341 if (sizeAvailable || allDataReceived) { 344 if (sizeAvailable || allDataReceived) {
342 if (!m_image || m_image->isNull()) { 345 if (!m_image || m_image->isNull()) {
343 error(errorOccurred() ? status() : DecodeError); 346 error(errorOccurred() ? status() : DecodeError);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 445
443 bool ImageResource::currentFrameKnownToBeOpaque(const RenderObject* renderer) 446 bool ImageResource::currentFrameKnownToBeOpaque(const RenderObject* renderer)
444 { 447 {
445 WebCore::Image* image = imageForRenderer(renderer); 448 WebCore::Image* image = imageForRenderer(renderer);
446 if (image->isBitmapImage()) 449 if (image->isBitmapImage())
447 image->nativeImageForCurrentFrame(); // force decode 450 image->nativeImageForCurrentFrame(); // force decode
448 return image->currentFrameKnownToBeOpaque(); 451 return image->currentFrameKnownToBeOpaque();
449 } 452 }
450 453
451 } // namespace WebCore 454 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/platform/SharedBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698