mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
Major change to the way the Image class works, making it use value semantics and internally shared data (see the forum notes for more info on this). Also minor changes to win32 browser plugin object ref counting and linux millisecond timers.
This commit is contained in:
parent
1baaa016bd
commit
24673283eb
121 changed files with 2763 additions and 2930 deletions
|
|
@ -32,7 +32,7 @@ BEGIN_JUCE_NAMESPACE
|
|||
#include "../../graphics/imaging/juce_ImageCache.h"
|
||||
#include "../../../events/juce_AsyncUpdater.h"
|
||||
|
||||
Image* juce_createIconForFile (const File& file);
|
||||
const Image juce_createIconForFile (const File& file);
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -77,7 +77,6 @@ public:
|
|||
thread.removeTimeSliceClient (this);
|
||||
|
||||
clearSubItems();
|
||||
ImageCache::release (icon);
|
||||
|
||||
if (canDeleteSubContentsList)
|
||||
delete subContentsList;
|
||||
|
|
@ -145,15 +144,14 @@ public:
|
|||
{
|
||||
updateIcon (true);
|
||||
|
||||
if (icon == 0)
|
||||
if (icon.isNull())
|
||||
thread.addTimeSliceClient (this);
|
||||
}
|
||||
|
||||
owner.getLookAndFeel()
|
||||
.drawFileBrowserRow (g, width, height,
|
||||
file.getFileName(),
|
||||
icon,
|
||||
fileSize, modTime,
|
||||
&icon, fileSize, modTime,
|
||||
isDirectory, isSelected(),
|
||||
indexInContentsList);
|
||||
}
|
||||
|
|
@ -199,26 +197,26 @@ private:
|
|||
DirectoryContentsList* subContentsList;
|
||||
bool isDirectory, canDeleteSubContentsList;
|
||||
TimeSliceThread& thread;
|
||||
Image* icon;
|
||||
Image icon;
|
||||
String fileSize;
|
||||
String modTime;
|
||||
|
||||
void updateIcon (const bool onlyUpdateIfCached)
|
||||
{
|
||||
if (icon == 0)
|
||||
if (icon.isNull())
|
||||
{
|
||||
const int hashCode = (file.getFullPathName() + "_iconCacheSalt").hashCode();
|
||||
Image* im = ImageCache::getFromHashCode (hashCode);
|
||||
Image im (ImageCache::getFromHashCode (hashCode));
|
||||
|
||||
if (im == 0 && ! onlyUpdateIfCached)
|
||||
if (im.isNull() && ! onlyUpdateIfCached)
|
||||
{
|
||||
im = juce_createIconForFile (file);
|
||||
|
||||
if (im != 0)
|
||||
if (im.isValid())
|
||||
ImageCache::addImageToCache (im, hashCode);
|
||||
}
|
||||
|
||||
if (im != 0)
|
||||
if (im.isValid())
|
||||
{
|
||||
icon = im;
|
||||
triggerAsyncUpdate();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue