diff options
-rw-r--r-- | gyp/utils.gyp | 21 | ||||
-rw-r--r-- | gyp/utils.gypi | 8 | ||||
-rw-r--r-- | src/utils/win/SkAutoCoInitialize.h (renamed from include/utils/win/SkAutoCoInitialize.h) | 2 | ||||
-rw-r--r-- | src/utils/win/SkHRESULT.h (renamed from include/utils/win/SkHRESULT.h) | 16 | ||||
-rw-r--r-- | src/utils/win/SkIStream.h (renamed from include/utils/win/SkIStream.h) | 2 | ||||
-rw-r--r-- | src/utils/win/SkTScopedComPtr.h (renamed from include/utils/win/SkTScopedComPtr.h) | 28 |
6 files changed, 37 insertions, 40 deletions
diff --git a/gyp/utils.gyp b/gyp/utils.gyp index 4cd71a7b60..b6ce7fde1b 100644 --- a/gyp/utils.gyp +++ b/gyp/utils.gyp @@ -25,13 +25,12 @@ '../include/private', '../include/utils', '../include/utils/mac', - '../include/utils/unix', - '../include/utils/win', '../src/core', '../src/gpu', '../src/image', '../src/opts', '../src/utils', + '../src/utils/win', ], 'sources': [ 'utils.gypi', # Makes the gypi appear in IDEs (but does not modify the build). @@ -59,16 +58,10 @@ '../src/utils/mac/SkCreateCGImageRef.cpp', ], }], - [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', { - },{ #else if 'skia_os not in ["linux", "freebsd", "openbsd", "solaris"]' - 'include_dirs!': [ - '../include/utils/unix', - ], - }], [ 'skia_os == "win"', { 'direct_dependent_settings': { 'include_dirs': [ - '../include/utils/win', + '../src/utils/win', ], }, 'sources!': [ @@ -77,14 +70,11 @@ ], },{ #else if 'skia_os != "win"' 'include_dirs!': [ - '../include/utils/win', + '../src/utils/win', ], 'sources/': [ ['exclude', '_win.(h|cpp)$'],], 'sources!': [ - '../include/utils/win/SkAutoCoInitialize.h', - '../include/utils/win/SkHRESULT.h', - '../include/utils/win/SkIStream.h', - '../include/utils/win/SkTScopedComPtr.h', + '../src/utils/win/SkAutoCoInitialize.h', '../src/utils/win/SkAutoCoInitialize.cpp', '../src/utils/win/SkDWrite.h', '../src/utils/win/SkDWrite.cpp', @@ -92,8 +82,11 @@ '../src/utils/win/SkDWriteFontFileStream.h', '../src/utils/win/SkDWriteGeometrySink.cpp', '../src/utils/win/SkDWriteGeometrySink.h', + '../src/utils/win/SkHRESULT.h', '../src/utils/win/SkHRESULT.cpp', + '../src/utils/win/SkIStream.h', '../src/utils/win/SkIStream.cpp', + '../src/utils/win/SkTScopedComPtr.h', ], }], ], diff --git a/gyp/utils.gypi b/gyp/utils.gypi index fb8805eecd..eeadafbe53 100644 --- a/gyp/utils.gypi +++ b/gyp/utils.gypi @@ -93,10 +93,7 @@ '<(skia_src_path)/utils/mac/SkCreateCGImageRef.cpp', #windows - '<(skia_include_path)/utils/win/SkAutoCoInitialize.h', - '<(skia_include_path)/utils/win/SkHRESULT.h', - '<(skia_include_path)/utils/win/SkIStream.h', - '<(skia_include_path)/utils/win/SkTScopedComPtr.h', + '<(skia_src_path)/utils/win/SkAutoCoInitialize.h', '<(skia_src_path)/utils/win/SkAutoCoInitialize.cpp', '<(skia_src_path)/utils/win/SkDWrite.h', '<(skia_src_path)/utils/win/SkDWrite.cpp', @@ -104,8 +101,11 @@ '<(skia_src_path)/utils/win/SkDWriteFontFileStream.h', '<(skia_src_path)/utils/win/SkDWriteGeometrySink.cpp', '<(skia_src_path)/utils/win/SkDWriteGeometrySink.h', + '<(skia_src_path)/utils/win/SkHRESULT.h', '<(skia_src_path)/utils/win/SkHRESULT.cpp', + '<(skia_src_path)/utils/win/SkIStream.h', '<(skia_src_path)/utils/win/SkIStream.cpp', + '<(skia_src_path)/utils/win/SkTScopedComPtr.h', '<(skia_src_path)/utils/win/SkWGL.h', '<(skia_src_path)/utils/win/SkWGL_win.cpp', diff --git a/include/utils/win/SkAutoCoInitialize.h b/src/utils/win/SkAutoCoInitialize.h index 04709782ee..f11cf856c5 100644 --- a/include/utils/win/SkAutoCoInitialize.h +++ b/src/utils/win/SkAutoCoInitialize.h @@ -12,7 +12,7 @@ #ifdef SK_BUILD_FOR_WIN -#include "../../private/SkLeanWindows.h" +#include "SkLeanWindows.h" /** * An instance of this class initializes COM on creation diff --git a/include/utils/win/SkHRESULT.h b/src/utils/win/SkHRESULT.h index 69a7118940..a9cd8c408b 100644 --- a/include/utils/win/SkHRESULT.h +++ b/src/utils/win/SkHRESULT.h @@ -11,7 +11,7 @@ #include "SkTypes.h" #ifdef SK_BUILD_FOR_WIN -#include "../../private/SkLeanWindows.h" +#include "SkLeanWindows.h" void SkTraceHR(const char* file, unsigned long line, HRESULT hr, const char* msg); @@ -39,23 +39,23 @@ If the HRESULT FAILED then the macro will return from the current function. In variants ending with 'M' the given message will be traced when FAILED. The HR variants will return the HRESULT when FAILED. The HRB variants will return false when FAILED. -The HRN variants will return NULL when FAILED. +The HRN variants will return nullptr when FAILED. The HRV variants will simply return when FAILED. The HRZ variants will return 0 when FAILED. */ -#define HR(ex) HR_GENERAL(ex, NULL, _hr) +#define HR(ex) HR_GENERAL(ex, nullptr, _hr) #define HRM(ex, msg) HR_GENERAL(ex, msg, _hr) -#define HRB(ex) HR_GENERAL(ex, NULL, false) +#define HRB(ex) HR_GENERAL(ex, nullptr, false) #define HRBM(ex, msg) HR_GENERAL(ex, msg, false) -#define HRN(ex) HR_GENERAL(ex, NULL, NULL) -#define HRNM(ex, msg) HR_GENERAL(ex, msg, NULL) +#define HRN(ex) HR_GENERAL(ex, nullptr, nullptr) +#define HRNM(ex, msg) HR_GENERAL(ex, msg, nullptr) -#define HRV(ex) HR_GENERAL(ex, NULL, ) +#define HRV(ex) HR_GENERAL(ex, nullptr, ) #define HRVM(ex, msg) HR_GENERAL(ex, msg, ) -#define HRZ(ex) HR_GENERAL(ex, NULL, 0) +#define HRZ(ex) HR_GENERAL(ex, nullptr, 0) #define HRZM(ex, msg) HR_GENERAL(ex, msg, 0) //@} #endif // SK_BUILD_FOR_WIN diff --git a/include/utils/win/SkIStream.h b/src/utils/win/SkIStream.h index 28a59f9a02..a3315c121d 100644 --- a/include/utils/win/SkIStream.h +++ b/src/utils/win/SkIStream.h @@ -14,7 +14,7 @@ #ifdef SK_BUILD_FOR_WIN -#include "../../private/SkLeanWindows.h" +#include "SkLeanWindows.h" #include <ole2.h> class SkStream; diff --git a/include/utils/win/SkTScopedComPtr.h b/src/utils/win/SkTScopedComPtr.h index 6fb6143adc..5410f5c992 100644 --- a/include/utils/win/SkTScopedComPtr.h +++ b/src/utils/win/SkTScopedComPtr.h @@ -8,7 +8,7 @@ #ifndef SkTScopedComPtr_DEFINED #define SkTScopedComPtr_DEFINED -#include "../../private/SkLeanWindows.h" +#include "SkLeanWindows.h" #ifdef SK_BUILD_FOR_WIN @@ -37,26 +37,30 @@ private: T *fPtr; public: - explicit SkTScopedComPtr(T *ptr = NULL) : fPtr(ptr) { } - ~SkTScopedComPtr() { - this->reset(); - } - T &operator*() const { SkASSERT(fPtr != NULL); return *fPtr; } - SkBlockComRef<T> *operator->() const { - return static_cast<SkBlockComRef<T>*>(fPtr); - } + explicit SkTScopedComPtr(T *ptr = nullptr) : fPtr(ptr) { } + + ~SkTScopedComPtr() { this->reset();} + + T &operator*() const { SkASSERT(fPtr != nullptr); return *fPtr; } + + explicit operator bool() const { return fPtr != nullptr; } + + SkBlockComRef<T> *operator->() const { return static_cast<SkBlockComRef<T>*>(fPtr); } + /** * Returns the address of the underlying pointer. * This is dangerous -- it breaks encapsulation and the reference escapes. * Must only be used on instances currently pointing to NULL, * and only to initialize the instance. */ - T **operator&() { SkASSERT(fPtr == NULL); return &fPtr; } + T **operator&() { SkASSERT(fPtr == nullptr); return &fPtr; } + T *get() const { return fPtr; } + void reset() { if (this->fPtr) { this->fPtr->Release(); - this->fPtr = NULL; + this->fPtr = nullptr; } } @@ -68,7 +72,7 @@ public: T* release() { T* temp = this->fPtr; - this->fPtr = NULL; + this->fPtr = nullptr; return temp; } }; |