1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-03 03:30:06 +00:00

Changes to Image::BitmapData constructors, replacing the bool with a more explicit enum for the read/write mode. Some win32 dLL declarator changes. Android work. Small Quicktime fix.

This commit is contained in:
Julian Storer 2011-02-09 10:50:19 +00:00
parent 1d215fa865
commit 3dfbb0d713
37 changed files with 1216 additions and 431 deletions

View file

@ -212,7 +212,7 @@ public:
const ScopedLock sl (imageSwapLock);
{
const Image::BitmapData destData (loadingImage, 0, 0, width, height, true);
const Image::BitmapData destData (loadingImage, 0, 0, width, height, Image::BitmapData::writeOnly);
for (int i = 0; i < height; ++i)
memcpy (destData.getLinePointer ((height - 1) - i),

View file

@ -243,7 +243,7 @@ public:
D2D1_BITMAP_PROPERTIES bp = D2D1::BitmapProperties();
Image img (image.convertedToFormat (Image::ARGB));
Image::BitmapData bd (img, false);
Image::BitmapData bd (img, Image::BitmapData::readOnly);
bp.pixelFormat = renderingTarget->GetPixelFormat();
bp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
@ -479,7 +479,7 @@ public:
D2D1_BITMAP_PROPERTIES bp = D2D1::BitmapProperties();
maskImage = image.convertedToFormat (Image::ARGB);
Image::BitmapData bd (this->image, false); // xxx should be maskImage?
Image::BitmapData bd (this->image, Image::BitmapData::readOnly); // xxx should be maskImage?
bp.pixelFormat = owner.renderingTarget->GetPixelFormat();
bp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
@ -658,7 +658,7 @@ public:
D2D1_BITMAP_PROPERTIES bp = D2D1::BitmapProperties();
this->image = image.convertedToFormat (Image::ARGB);
Image::BitmapData bd (this->image, false);
Image::BitmapData bd (this->image, Image::BitmapData::readOnly);
bp.pixelFormat = owner.renderingTarget->GetPixelFormat();
bp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;

View file

@ -145,13 +145,6 @@ const int KeyPress::rewindKey = 0x30003;
class WindowsBitmapImage : public Image::SharedImage
{
public:
//==============================================================================
HBITMAP hBitmap;
HGDIOBJ previousBitmap;
BITMAPV4HEADER bitmapInfo;
HDC hdc;
unsigned char* bitmapData;
//==============================================================================
WindowsBitmapImage (const Image::PixelFormat format_,
const int w, const int h, const bool clearImage)
@ -160,6 +153,7 @@ public:
jassert (format_ == Image::RGB || format_ == Image::ARGB);
pixelStride = (format_ == Image::RGB) ? 3 : 4;
lineStride = -((w * pixelStride + 3) & ~3);
zerostruct (bitmapInfo);
bitmapInfo.bV4Size = sizeof (BITMAPV4HEADER);
@ -182,19 +176,14 @@ public:
bitmapInfo.bV4V4Compression = BI_RGB;
}
lineStride = -((w * pixelStride + 3) & ~3);
HDC dc = GetDC (0);
hdc = CreateCompatibleDC (dc);
ReleaseDC (0, dc);
SetMapMode (hdc, MM_TEXT);
hBitmap = CreateDIBSection (hdc,
(BITMAPINFO*) &(bitmapInfo),
DIB_RGB_COLORS,
(void**) &bitmapData,
0, 0);
hBitmap = CreateDIBSection (hdc, (BITMAPINFO*) &(bitmapInfo), DIB_RGB_COLORS,
(void**) &bitmapData, 0, 0);
previousBitmap = SelectObject (hdc, hBitmap);
@ -218,6 +207,14 @@ public:
return new LowLevelGraphicsSoftwareRenderer (Image (this));
}
void initialiseBitmapData (Image::BitmapData& bitmap, int x, int y, Image::BitmapData::ReadWriteMode /*mode*/)
{
bitmap.data = imageData + x * pixelStride + y * lineStride;
bitmap.pixelFormat = format;
bitmap.lineStride = lineStride;
bitmap.pixelStride = pixelStride;
}
Image::SharedImage* clone()
{
WindowsBitmapImage* im = new WindowsBitmapImage (format, width, height, false);
@ -318,6 +315,15 @@ public:
}
}
//==============================================================================
HBITMAP hBitmap;
HGDIOBJ previousBitmap;
BITMAPV4HEADER bitmapInfo;
HDC hdc;
uint8* bitmapData;
int pixelStride, lineStride;
uint8* imageData;
private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WindowsBitmapImage);
};
@ -342,7 +348,7 @@ namespace IconConverters
SelectObject (dc, bitmap);
im = Image (Image::ARGB, bm.bmWidth, bm.bmHeight, true);
Image::BitmapData imageData (im, true);
Image::BitmapData imageData (im, Image::BitmapData::writeOnly);
for (int y = bm.bmHeight; --y >= 0;)
{