1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

core/umat: usage flags (with proposals from PR #2195)

This commit is contained in:
Alexander Alekhin
2014-02-10 16:34:45 +04:00
parent 534bec3a90
commit 95e38e457f
7 changed files with 154 additions and 64 deletions
+4 -4
View File
@@ -169,7 +169,7 @@ class StdMatAllocator : public MatAllocator
{
public:
UMatData* allocate(int dims, const int* sizes, int type,
void* data0, size_t* step, int /*flags*/) const
void* data0, size_t* step, int /*flags*/, UMatUsageFlags /*usageFlags*/) const
{
size_t total = CV_ELEM_SIZE(type);
for( int i = dims-1; i >= 0; i-- )
@@ -196,7 +196,7 @@ public:
return u;
}
bool allocate(UMatData* u, int /*accessFlags*/) const
bool allocate(UMatData* u, int /*accessFlags*/, UMatUsageFlags /*usageFlags*/) const
{
if(!u) return false;
return true;
@@ -398,13 +398,13 @@ void Mat::create(int d, const int* _sizes, int _type)
a = a0;
try
{
u = a->allocate(dims, size, _type, 0, step.p, 0);
u = a->allocate(dims, size, _type, 0, step.p, 0, USAGE_DEFAULT);
CV_Assert(u != 0);
}
catch(...)
{
if(a != a0)
u = a0->allocate(dims, size, _type, 0, step.p, 0);
u = a0->allocate(dims, size, _type, 0, step.p, 0, USAGE_DEFAULT);
CV_Assert(u != 0);
}
CV_Assert( step[dims-1] == (size_t)CV_ELEM_SIZE(flags) );