diff options
-rw-r--r-- | gyp/gpu.gypi | 2 | ||||
-rw-r--r-- | src/gpu/GrPlotMgr.h | 73 | ||||
-rw-r--r-- | src/gpu/GrTBSearch.h | 44 | ||||
-rw-r--r-- | src/gpu/GrTemplates.h | 43 | ||||
-rw-r--r-- | tests/GrTBSearchTest.cpp | 40 |
5 files changed, 0 insertions, 202 deletions
diff --git a/gyp/gpu.gypi b/gyp/gpu.gypi index 10df51db0b..5387e6a41c 100644 --- a/gyp/gpu.gypi +++ b/gyp/gpu.gypi @@ -167,7 +167,6 @@ '<(skia_src_path)/gpu/GrProcOptInfo.cpp', '<(skia_src_path)/gpu/GrProcOptInfo.h', '<(skia_src_path)/gpu/GrGpuResourceRef.cpp', - '<(skia_src_path)/gpu/GrPlotMgr.h', '<(skia_src_path)/gpu/GrRecordReplaceDraw.cpp', '<(skia_src_path)/gpu/GrRecordReplaceDraw.h', '<(skia_src_path)/gpu/GrRectanizer.h', @@ -200,7 +199,6 @@ '<(skia_src_path)/gpu/GrStrokeInfo.h', '<(skia_src_path)/gpu/GrTargetCommands.cpp', '<(skia_src_path)/gpu/GrTargetCommands.h', - '<(skia_src_path)/gpu/GrTBSearch.h', '<(skia_src_path)/gpu/GrTraceMarker.cpp', '<(skia_src_path)/gpu/GrTraceMarker.h', '<(skia_src_path)/gpu/GrTracing.h', diff --git a/src/gpu/GrPlotMgr.h b/src/gpu/GrPlotMgr.h deleted file mode 100644 index 1441611327..0000000000 --- a/src/gpu/GrPlotMgr.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2010 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrPlotMgr_DEFINED -#define GrPlotMgr_DEFINED - -#include "GrTypes.h" -#include "SkTypes.h" - -class GrPlotMgr : SkNoncopyable { -public: - GrPlotMgr(int width, int height) { - fDim.set(width, height); - size_t needed = width * height; - if (needed <= sizeof(fStorage)) { - fBusy = fStorage; - } else { - fBusy = SkNEW_ARRAY(char, needed); - } - this->reset(); - } - - ~GrPlotMgr() { - if (fBusy != fStorage) { - delete[] fBusy; - } - } - - void reset() { - sk_bzero(fBusy, fDim.fX * fDim.fY); - } - - bool newPlot(SkIPoint16* loc) { - char* busy = fBusy; - for (int y = 0; y < fDim.fY; y++) { - for (int x = 0; x < fDim.fX; x++) { - if (!*busy) { - *busy = true; - loc->set(x, y); - return true; - } - busy++; - } - } - return false; - } - - bool isBusy(int x, int y) const { - SkASSERT((unsigned)x < (unsigned)fDim.fX); - SkASSERT((unsigned)y < (unsigned)fDim.fY); - return fBusy[y * fDim.fX + x] != 0; - } - - void freePlot(int x, int y) { - SkASSERT((unsigned)x < (unsigned)fDim.fX); - SkASSERT((unsigned)y < (unsigned)fDim.fY); - fBusy[y * fDim.fX + x] = false; - } - -private: - enum { - STORAGE = 64 - }; - char fStorage[STORAGE]; - char* fBusy; - SkIPoint16 fDim; -}; - -#endif diff --git a/src/gpu/GrTBSearch.h b/src/gpu/GrTBSearch.h deleted file mode 100644 index 01e97440a6..0000000000 --- a/src/gpu/GrTBSearch.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2010 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrTBSearch_DEFINED -#define GrTBSearch_DEFINED - -#include "SkTypes.h" - -template <typename ELEM, typename KEY> -int GrTBSearch(const ELEM array[], int count, KEY target) { - SkASSERT(count >= 0); - if (0 == count) { - // we should insert it at 0 - return ~0; - } - - int high = count - 1; - int low = 0; - while (high > low) { - int index = (low + high) >> 1; - if (LT(array[index], target)) { - low = index + 1; - } else { - high = index; - } - } - - // check if we found it - if (EQ(array[high], target)) { - return high; - } - - // now return the ~ of where we should insert it - if (LT(array[high], target)) { - high += 1; - } - return ~high; -} - -#endif diff --git a/src/gpu/GrTemplates.h b/src/gpu/GrTemplates.h index 8e43a15f7b..8eab9c5ef3 100644 --- a/src/gpu/GrTemplates.h +++ b/src/gpu/GrTemplates.h @@ -22,47 +22,4 @@ template <typename Dst, typename Src> Dst GrTCast(Src src) { return data.dst; } -/** - * takes a T*, saves the value it points to, in and restores the value in the - * destructor - * e.g.: - * { - * GrAutoTRestore<int*> autoCountRestore; - * if (useExtra) { - * autoCountRestore.reset(&fCount); - * fCount += fExtraCount; - * } - * ... - * } // fCount is restored - */ -template <typename T> class GrAutoTRestore : SkNoncopyable { -public: - GrAutoTRestore() : fPtr(NULL), fVal() {} - - GrAutoTRestore(T* ptr) { - fPtr = ptr; - if (ptr) { - fVal = *ptr; - } - } - - ~GrAutoTRestore() { - if (fPtr) { - *fPtr = fVal; - } - } - - // restores previously saved value (if any) and saves value for passed T* - void reset(T* ptr) { - if (fPtr) { - *fPtr = fVal; - } - fPtr = ptr; - fVal = *ptr; - } -private: - T* fPtr; - T fVal; -}; - #endif diff --git a/tests/GrTBSearchTest.cpp b/tests/GrTBSearchTest.cpp deleted file mode 100644 index d05780778b..0000000000 --- a/tests/GrTBSearchTest.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -// This is a GPU-backend specific test -#if SK_SUPPORT_GPU - -#include "Test.h" - -// If we aren't inheriting these as #defines from elsewhere, -// clang demands they be declared before we #include the template -// that relies on them. -static bool LT(const int& elem, int value) { - return elem < value; -} -static bool EQ(const int& elem, int value) { - return elem == value; -} - -#include "GrTBSearch.h" - -DEF_TEST(GrTBSearch, reporter) { - const int array[] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99 - }; - - for (int n = 0; n < static_cast<int>(SK_ARRAY_COUNT(array)); ++n) { - for (int i = 0; i < n; i++) { - int index = GrTBSearch<int, int>(array, n, array[i]); - REPORTER_ASSERT(reporter, index == (int) i); - index = GrTBSearch<int, int>(array, n, -array[i]); - REPORTER_ASSERT(reporter, index < 0); - } - } -} - -#endif |