move some headers out of public
patch from issue 338263003 BUG=skia: R=mtklein@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/339183002
This commit is contained in:
parent
c3b3266b7d
commit
859b92448b
@ -249,7 +249,6 @@
|
||||
'<(skia_include_path)/core/SkFloatBits.h',
|
||||
'<(skia_include_path)/core/SkFloatingPoint.h',
|
||||
'<(skia_include_path)/core/SkFontHost.h',
|
||||
'<(skia_include_path)/core/SkGeometry.h',
|
||||
'<(skia_include_path)/core/SkGraphics.h',
|
||||
'<(skia_include_path)/core/SkImage.h',
|
||||
'<(skia_include_path)/core/SkImageDecoder.h',
|
||||
@ -303,7 +302,6 @@
|
||||
'<(skia_include_path)/core/SkTypes.h',
|
||||
'<(skia_include_path)/core/SkUnPreMultiply.h',
|
||||
'<(skia_include_path)/core/SkUtils.h',
|
||||
'<(skia_include_path)/core/SkVertState.h',
|
||||
'<(skia_include_path)/core/SkWeakRefCnt.h',
|
||||
'<(skia_include_path)/core/SkWriter32.h',
|
||||
'<(skia_include_path)/core/SkXfermode.h',
|
||||
|
@ -41,6 +41,7 @@
|
||||
'../experimental/PdfViewer/pdfparser',
|
||||
'../experimental/PdfViewer/pdfparser/native',
|
||||
'../experimental/PdfViewer/pdfparser/native/pdfapi',
|
||||
'../src/core',
|
||||
],
|
||||
'dependencies': [
|
||||
'skia_lib.gyp:skia_lib',
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2006 The Android Open Source Project
|
||||
*
|
||||
@ -6,7 +5,6 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SkTDict_DEFINED
|
||||
#define SkTDict_DEFINED
|
||||
|
||||
@ -18,32 +16,26 @@ template <typename T> class SkTDict : SkNoncopyable {
|
||||
public:
|
||||
SkTDict(size_t minStringAlloc) : fStrings(minStringAlloc) {}
|
||||
|
||||
void reset()
|
||||
{
|
||||
void reset() {
|
||||
fArray.reset();
|
||||
fStrings.reset();
|
||||
}
|
||||
|
||||
int count() const { return fArray.count(); }
|
||||
|
||||
bool set(const char name[], const T& value)
|
||||
{
|
||||
bool set(const char name[], const T& value) {
|
||||
return set(name, strlen(name), value);
|
||||
}
|
||||
|
||||
bool set(const char name[], size_t len, const T& value)
|
||||
{
|
||||
bool set(const char name[], size_t len, const T& value) {
|
||||
SkASSERT(name);
|
||||
|
||||
int index = this->find_index(name, len);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
if (index >= 0) {
|
||||
fArray[index].fValue = value;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Pair* pair = fArray.insert(~index);
|
||||
char* copy = (char*)fStrings.alloc(len + 1, SkChunkAlloc::kThrow_AllocFailType);
|
||||
memcpy(copy, name, len);
|
||||
@ -54,40 +46,36 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool find(const char name[]) const
|
||||
{
|
||||
bool find(const char name[]) const {
|
||||
return this->find_index(name) >= 0;
|
||||
}
|
||||
|
||||
bool find(const char name[], size_t len) const
|
||||
{
|
||||
bool find(const char name[], size_t len) const {
|
||||
return this->find_index(name, len) >= 0;
|
||||
}
|
||||
|
||||
bool find(const char name[], T* value) const
|
||||
{
|
||||
bool find(const char name[], T* value) const {
|
||||
return find(name, strlen(name), value);
|
||||
}
|
||||
|
||||
bool find(const char name[], size_t len, T* value) const
|
||||
{
|
||||
bool find(const char name[], size_t len, T* value) const {
|
||||
int index = this->find_index(name, len);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
if (value)
|
||||
if (index >= 0) {
|
||||
if (value) {
|
||||
*value = fArray[index].fValue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool findKey(T& value, const char** name) const
|
||||
{
|
||||
bool findKey(T& value, const char** name) const {
|
||||
const Pair* end = fArray.end();
|
||||
for (const Pair* pair = fArray.begin(); pair < end; pair++) {
|
||||
if (pair->fValue != value)
|
||||
if (pair->fValue != value) {
|
||||
continue;
|
||||
}
|
||||
*name = pair->fName;
|
||||
return true;
|
||||
}
|
||||
@ -99,12 +87,11 @@ public:
|
||||
const char* fName;
|
||||
T fValue;
|
||||
|
||||
friend int operator<(const Pair& a, const Pair& b)
|
||||
{
|
||||
friend int operator<(const Pair& a, const Pair& b) {
|
||||
return strcmp(a.fName, b.fName);
|
||||
}
|
||||
friend int operator!=(const Pair& a, const Pair& b)
|
||||
{
|
||||
|
||||
friend int operator!=(const Pair& a, const Pair& b) {
|
||||
return strcmp(a.fName, b.fName);
|
||||
}
|
||||
};
|
||||
@ -113,19 +100,18 @@ public:
|
||||
public:
|
||||
class Iter {
|
||||
public:
|
||||
Iter(const SkTDict<T>& dict)
|
||||
{
|
||||
Iter(const SkTDict<T>& dict) {
|
||||
fIter = dict.fArray.begin();
|
||||
fStop = dict.fArray.end();
|
||||
}
|
||||
const char* next(T* value)
|
||||
{
|
||||
|
||||
const char* next(T* value) {
|
||||
const char* name = NULL;
|
||||
if (fIter < fStop)
|
||||
{
|
||||
if (fIter < fStop) {
|
||||
name = fIter->fName;
|
||||
if (value)
|
||||
if (value) {
|
||||
*value = fIter->fValue;
|
||||
}
|
||||
fIter += 1;
|
||||
}
|
||||
return name;
|
||||
@ -139,20 +125,19 @@ private:
|
||||
SkTDArray<Pair> fArray;
|
||||
SkChunkAlloc fStrings;
|
||||
|
||||
int find_index(const char name[]) const
|
||||
{
|
||||
int find_index(const char name[]) const {
|
||||
return find_index(name, strlen(name));
|
||||
}
|
||||
|
||||
int find_index(const char name[], size_t len) const
|
||||
{
|
||||
int find_index(const char name[], size_t len) const {
|
||||
SkASSERT(name);
|
||||
|
||||
int count = fArray.count();
|
||||
int index = ~0;
|
||||
|
||||
if (count)
|
||||
if (count) {
|
||||
index = SkStrSearch(&fArray.begin()->fName, count, name, len, sizeof(Pair));
|
||||
}
|
||||
return index;
|
||||
}
|
||||
friend class Iter;
|
||||
|
Loading…
Reference in New Issue
Block a user