From ad9149b1432da676ad7dcadf8f22c92fe9d8e48e Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Fri, 12 Apr 2013 17:09:42 +0300 Subject: [PATCH] Gfx: Move WIC files to Util --- Common/Gfx/CanvasD2D.cpp | 4 ++-- Common/Gfx/CanvasD2D.h | 4 ++-- Common/Gfx/{ => Util}/WICBitmapDIB.cpp | 4 +++- Common/Gfx/{ => Util}/WICBitmapDIB.h | 3 ++- Common/Gfx/{ => Util}/WICBitmapLockDIB.cpp | 4 ++-- Common/Gfx/{ => Util}/WICBitmapLockDIB.h | 3 ++- Common/Gfx/{ => Util}/WICBitmapLockGDIP.cpp | 2 ++ Common/Gfx/{ => Util}/WICBitmapLockGDIP.h | 2 ++ Library/Library.vcxproj | 12 +++++------ Library/Library.vcxproj.filters | 24 ++++++++++----------- 10 files changed, 35 insertions(+), 27 deletions(-) rename Common/Gfx/{ => Util}/WICBitmapDIB.cpp (94%) rename Common/Gfx/{ => Util}/WICBitmapDIB.h (95%) rename Common/Gfx/{ => Util}/WICBitmapLockDIB.cpp (94%) rename Common/Gfx/{ => Util}/WICBitmapLockDIB.h (94%) rename Common/Gfx/{ => Util}/WICBitmapLockGDIP.cpp (94%) rename Common/Gfx/{ => Util}/WICBitmapLockGDIP.h (94%) diff --git a/Common/Gfx/CanvasD2D.cpp b/Common/Gfx/CanvasD2D.cpp index 1d458707..0bac208a 100644 --- a/Common/Gfx/CanvasD2D.cpp +++ b/Common/Gfx/CanvasD2D.cpp @@ -19,7 +19,7 @@ #include "CanvasD2D.h" #include "TextFormatD2D.h" #include "Util/DWriteFontCollectionLoader.h" -#include "WICBitmapLockGDIP.h" +#include "Util/WICBitmapLockGDIP.h" #include "../../Library/Litestep.h" template @@ -411,7 +411,7 @@ void CanvasD2D::DrawBitmap(Gdiplus::Bitmap* bitmap, const Gdiplus::Rect& dstRect // The D2D DrawBitmap seems to perform exactly like Gdiplus::Graphics::DrawImage since we are // not using a hardware accelerated render target. Nevertheless, we will use it to avoid // the EndDraw() call needed for GDI+ drawing. - WICBitmapLockGDIP* bitmapLock = new WICBitmapLockGDIP(); + Util::WICBitmapLockGDIP* bitmapLock = new Util::WICBitmapLockGDIP(); Gdiplus::Status status = bitmap->LockBits( &srcRect, Gdiplus::ImageLockModeRead, PixelFormat32bppPARGB, bitmapLock->GetBitmapData()); if (status == Gdiplus::Ok) diff --git a/Common/Gfx/CanvasD2D.h b/Common/Gfx/CanvasD2D.h index 76d444d9..ed044776 100644 --- a/Common/Gfx/CanvasD2D.h +++ b/Common/Gfx/CanvasD2D.h @@ -22,7 +22,7 @@ #include "Canvas.h" #include "FontCollectionD2D.h" #include "TextFormatD2D.h" -#include "WICBitmapDIB.h" +#include "Util/WICBitmapDIB.h" #include #include #include @@ -90,7 +90,7 @@ private: D2D1_MATRIX_3X2_F GetCurrentTransform(); ID2D1RenderTarget* m_Target; - WICBitmapDIB m_Bitmap; + Util::WICBitmapDIB m_Bitmap; // GDI+ objects that share the pixel data of m_Bitmap. Gdiplus::Graphics* m_GdipGraphics; diff --git a/Common/Gfx/WICBitmapDIB.cpp b/Common/Gfx/Util/WICBitmapDIB.cpp similarity index 94% rename from Common/Gfx/WICBitmapDIB.cpp rename to Common/Gfx/Util/WICBitmapDIB.cpp index 8043c5df..6c09abf5 100644 --- a/Common/Gfx/WICBitmapDIB.cpp +++ b/Common/Gfx/Util/WICBitmapDIB.cpp @@ -21,7 +21,8 @@ #include namespace Gfx { - +namespace Util { + WICBitmapDIB::WICBitmapDIB() : m_DIBSectionBuffer(), m_DIBSectionBufferPixels(), @@ -131,4 +132,5 @@ IFACEMETHODIMP WICBitmapDIB::SetResolution(double dpiX, double dpiY) return E_NOTIMPL; } +} // namespace Util } // namespace Gfx diff --git a/Common/Gfx/WICBitmapDIB.h b/Common/Gfx/Util/WICBitmapDIB.h similarity index 95% rename from Common/Gfx/WICBitmapDIB.h rename to Common/Gfx/Util/WICBitmapDIB.h index 1afc44ab..641f1e19 100644 --- a/Common/Gfx/WICBitmapDIB.h +++ b/Common/Gfx/Util/WICBitmapDIB.h @@ -24,6 +24,7 @@ #include namespace Gfx { +namespace Util { // Allows the use of a DIB section (HBITMAP) in Direct2D as a WIC bitmap. It is assumed that this // class is used only with 32bpp PARGB bitmaps and using a sigle thread. @@ -67,7 +68,7 @@ private: UINT m_H; }; - +} // namespace Util } // namespace Gfx #endif \ No newline at end of file diff --git a/Common/Gfx/WICBitmapLockDIB.cpp b/Common/Gfx/Util/WICBitmapLockDIB.cpp similarity index 94% rename from Common/Gfx/WICBitmapLockDIB.cpp rename to Common/Gfx/Util/WICBitmapLockDIB.cpp index 09f8de56..c43410c3 100644 --- a/Common/Gfx/WICBitmapLockDIB.cpp +++ b/Common/Gfx/Util/WICBitmapLockDIB.cpp @@ -18,9 +18,9 @@ #include "WICBitmapLockDIB.h" #include -#include "../../Library/Litestep.h" namespace Gfx { +namespace Util { WICBitmapLockDIB::WICBitmapLockDIB(WICBitmapDIB* bitmap, const WICRect* lockRect) : m_Bitmap(bitmap), @@ -82,10 +82,10 @@ IFACEMETHODIMP WICBitmapLockDIB::GetDataPointer(UINT* pcbBufferSize, BYTE** ppbD return S_OK; } - IFACEMETHODIMP WICBitmapLockDIB::GetPixelFormat(WICPixelFormatGUID* pPixelFormat) { return m_Bitmap->GetPixelFormat(pPixelFormat); } +} // namespace Util } // namespace Gfx diff --git a/Common/Gfx/WICBitmapLockDIB.h b/Common/Gfx/Util/WICBitmapLockDIB.h similarity index 94% rename from Common/Gfx/WICBitmapLockDIB.h rename to Common/Gfx/Util/WICBitmapLockDIB.h index 24130d49..35fc3443 100644 --- a/Common/Gfx/WICBitmapLockDIB.h +++ b/Common/Gfx/Util/WICBitmapLockDIB.h @@ -25,6 +25,7 @@ #include "WICBitmapDIB.h" namespace Gfx { +namespace Util { // Implements the IWICBitmapLock interface for use with WICBitmapDIB. It is assumed that this // class is used only with 32bpp PARGB bitmaps and using a sigle thread. @@ -53,7 +54,7 @@ private: UINT m_RefCount; }; - +} // namespace Util } // namespace Gfx #endif \ No newline at end of file diff --git a/Common/Gfx/WICBitmapLockGDIP.cpp b/Common/Gfx/Util/WICBitmapLockGDIP.cpp similarity index 94% rename from Common/Gfx/WICBitmapLockGDIP.cpp rename to Common/Gfx/Util/WICBitmapLockGDIP.cpp index f42df566..f3e25fc2 100644 --- a/Common/Gfx/WICBitmapLockGDIP.cpp +++ b/Common/Gfx/Util/WICBitmapLockGDIP.cpp @@ -20,6 +20,7 @@ #include namespace Gfx { +namespace Util { WICBitmapLockGDIP::WICBitmapLockGDIP() : m_RefCount(1) @@ -77,4 +78,5 @@ IFACEMETHODIMP WICBitmapLockGDIP::GetPixelFormat(WICPixelFormatGUID* pPixelForma return S_OK; } +} // namespace Util } // namespace Gfx diff --git a/Common/Gfx/WICBitmapLockGDIP.h b/Common/Gfx/Util/WICBitmapLockGDIP.h similarity index 94% rename from Common/Gfx/WICBitmapLockGDIP.h rename to Common/Gfx/Util/WICBitmapLockGDIP.h index b0d1ac9f..c33f3b69 100644 --- a/Common/Gfx/WICBitmapLockGDIP.h +++ b/Common/Gfx/Util/WICBitmapLockGDIP.h @@ -24,6 +24,7 @@ #include namespace Gfx { +namespace Util { // Allows the creation of a shared ID2D1Bitmap using pixel data in a Gdiplus::Bitmap. It is // assumed that this class is used only with 32bpp PARGB bitmaps and using a sigle thread. @@ -50,6 +51,7 @@ private: UINT m_RefCount; }; +} // namespace Util } // namespace Gfx #endif \ No newline at end of file diff --git a/Library/Library.vcxproj b/Library/Library.vcxproj index e99ec640..aef1b800 100644 --- a/Library/Library.vcxproj +++ b/Library/Library.vcxproj @@ -76,9 +76,9 @@ - - - + + + @@ -300,9 +300,9 @@ - - - + + + diff --git a/Library/Library.vcxproj.filters b/Library/Library.vcxproj.filters index d4ee2a13..6112cbca 100644 --- a/Library/Library.vcxproj.filters +++ b/Library/Library.vcxproj.filters @@ -378,14 +378,14 @@ Common\Gfx\Util - - Common\Gfx + + Common\Gfx\Util - - Common\Gfx + + Common\Gfx\Util - - Common\Gfx + + Common\Gfx\Util @@ -665,14 +665,14 @@ Common\Gfx\Util - - Common\Gfx + + Common\Gfx\Util - - Common\Gfx + + Common\Gfx\Util - - Common\Gfx + + Common\Gfx\Util