remove some unused stuff
BUG=skia: Review URL: https://codereview.chromium.org/1231163002
This commit is contained in:
parent
d0f4173fb0
commit
3989205322
@ -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',
|
||||
|
@ -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
|
@ -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
|
@ -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
|
||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user