зеркало из https://github.com/mozilla/moz-skia.git
More SkRecord TODOs:
- add basic test for SkRecorder - rejigger GYPs so that the include dir comes along with the dependency BUG=skia:2378 R=fmalita@chromium.org, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/227673011 git-svn-id: http://skia.googlecode.com/svn/trunk@14099 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
eefd8a01fc
Коммит
b73696262c
|
@ -16,7 +16,6 @@
|
|||
'../src/core',
|
||||
'../src/effects',
|
||||
'../src/pipe/utils/',
|
||||
'../src/record',
|
||||
'../src/utils',
|
||||
'../src/utils/debugger',
|
||||
'../tools',
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
'../include/config',
|
||||
'../include/core',
|
||||
],
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'../src/record',
|
||||
],
|
||||
},
|
||||
'sources': [
|
||||
'../src/record/SkRecorder.cpp',
|
||||
],
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
'../src/pathops',
|
||||
'../src/pdf',
|
||||
'../src/pipe/utils',
|
||||
'../src/record',
|
||||
'../src/utils',
|
||||
'../src/utils/debugger',
|
||||
'../tools/',
|
||||
|
@ -24,6 +23,7 @@
|
|||
'flags.gyp:flags',
|
||||
'pdf.gyp:pdf',
|
||||
'tools.gyp:picture_utils',
|
||||
'record.gyp:record',
|
||||
],
|
||||
'sources': [
|
||||
'../tests/Test.cpp',
|
||||
|
@ -136,6 +136,7 @@
|
|||
'../tests/ReadWriteAlphaTest.cpp',
|
||||
'../tests/Reader32Test.cpp',
|
||||
'../tests/RecordTest.cpp',
|
||||
'../tests/RecorderTest.cpp',
|
||||
'../tests/RefCntTest.cpp',
|
||||
'../tests/RefDictTest.cpp',
|
||||
'../tests/RegionTest.cpp',
|
||||
|
|
|
@ -300,7 +300,6 @@
|
|||
'../src/core/',
|
||||
'../src/images',
|
||||
'../src/lazy',
|
||||
'../src/record',
|
||||
],
|
||||
'dependencies': [
|
||||
'flags.gyp:flags',
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
#include "Test.h"
|
||||
|
||||
#include "SkRecord.h"
|
||||
#include "SkRecorder.h"
|
||||
#include "SkRecords.h"
|
||||
|
||||
#define COUNT(T) + 1
|
||||
static const int kRecordTypes = SK_RECORD_TYPES(COUNT);
|
||||
#undef COUNT
|
||||
|
||||
// Tallies the types of commands it sees into histogram.
|
||||
class Tally {
|
||||
public:
|
||||
explicit Tally(int histogram[kRecordTypes]) : fHistogram(histogram) {}
|
||||
|
||||
template <typename T> void operator()(const T&) {
|
||||
++fHistogram[T::kType];
|
||||
}
|
||||
|
||||
private:
|
||||
int* fHistogram;
|
||||
};
|
||||
|
||||
DEF_TEST(Recorder, r) {
|
||||
SkRecord record;
|
||||
SkRecorder recorder(&record, 1920, 1080);
|
||||
|
||||
recorder.drawRect(SkRect::MakeWH(10, 10), SkPaint());
|
||||
|
||||
int histogram[kRecordTypes];
|
||||
bzero(&histogram, sizeof(histogram));
|
||||
|
||||
record.visit(Tally(histogram));
|
||||
|
||||
REPORTER_ASSERT(r, 1 == histogram[SkRecords::DrawRect::kType]);
|
||||
}
|
Загрузка…
Ссылка в новой задаче