[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48852] trunk/blender/source/blender: add bli rect funcs BLI_rctf_init_minmax, BLI_rcti_init_minmax
Campbell Barton
ideasman42 at gmail.com
Thu Jul 12 10:31:23 CEST 2012
Revision: 48852
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48852
Author: campbellbarton
Date: 2012-07-12 08:31:23 +0000 (Thu, 12 Jul 2012)
Log Message:
-----------
add bli rect funcs BLI_rctf_init_minmax, BLI_rcti_init_minmax
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/colortools.c
trunk/blender/source/blender/blenkernel/intern/scene.c
trunk/blender/source/blender/blenlib/BLI_rect.h
trunk/blender/source/blender/blenlib/intern/rct.c
trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp
trunk/blender/source/blender/compositor/intern/COM_MemoryBuffer.cpp
trunk/blender/source/blender/compositor/intern/COM_NodeOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
trunk/blender/source/blender/editors/screen/area.c
trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
trunk/blender/source/blender/editors/space_file/file_ops.c
trunk/blender/source/blender/editors/space_image/image_buttons.c
trunk/blender/source/blender/editors/space_view3d/view3d_select.c
Modified: trunk/blender/source/blender/blenkernel/intern/colortools.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/colortools.c 2012-07-12 07:30:50 UTC (rev 48851)
+++ trunk/blender/source/blender/blenkernel/intern/colortools.c 2012-07-12 08:31:23 UTC (rev 48852)
@@ -71,7 +71,7 @@
clipmaxx = MAX2(minx, maxx);
clipmaxy = MAX2(miny, maxy);
- BLI_init_rctf(&cumap->curr, clipminx, clipmaxx, clipminy, clipmaxy);
+ BLI_rctf_init(&cumap->curr, clipminx, clipmaxx, clipminy, clipmaxy);
cumap->clipr = cumap->curr;
cumap->white[0] = cumap->white[1] = cumap->white[2] = 1.0f;
Modified: trunk/blender/source/blender/blenkernel/intern/scene.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/scene.c 2012-07-12 07:30:50 UTC (rev 48851)
+++ trunk/blender/source/blender/blenkernel/intern/scene.c 2012-07-12 08:31:23 UTC (rev 48852)
@@ -487,7 +487,7 @@
BLI_strncpy(sce->r.pic, U.renderdir, sizeof(sce->r.pic));
- BLI_init_rctf(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f);
+ BLI_rctf_init(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f);
sce->r.osa = 8;
/* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */
Modified: trunk/blender/source/blender/blenlib/BLI_rect.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_rect.h 2012-07-12 07:30:50 UTC (rev 48851)
+++ trunk/blender/source/blender/blenlib/BLI_rect.h 2012-07-12 08:31:23 UTC (rev 48852)
@@ -40,18 +40,12 @@
extern "C" {
#endif
-/* BLI_rct.c */
-/**
- * Determine if a rect is empty. An empty
- * rect is one with a zero (or negative)
- * width or height.
- *
- * \return True if \a rect is empty.
- */
int BLI_rcti_is_empty(const struct rcti *rect);
int BLI_rctf_is_empty(const struct rctf *rect);
-void BLI_init_rctf(struct rctf *rect, float xmin, float xmax, float ymin, float ymax);
-void BLI_init_rcti(struct rcti *rect, int xmin, int xmax, int ymin, int ymax);
+void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax);
+void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax);
+void BLI_rcti_init_minmax(struct rcti *rect);
+void BLI_rctf_init_minmax(struct rctf *rect);
void BLI_translate_rctf(struct rctf *rect, float x, float y);
void BLI_translate_rcti(struct rcti *rect, int x, int y);
void BLI_resize_rcti(struct rcti *rect, int x, int y);
Modified: trunk/blender/source/blender/blenlib/intern/rct.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/rct.c 2012-07-12 07:30:50 UTC (rev 48851)
+++ trunk/blender/source/blender/blenlib/intern/rct.c 2012-07-12 08:31:23 UTC (rev 48852)
@@ -35,6 +35,9 @@
#include <stdio.h>
#include <math.h>
+#include <limits.h>
+#include <float.h>
+
#include "DNA_vec_types.h"
#include "BLI_rect.h"
@@ -57,6 +60,13 @@
return 1;
}
+/**
+ * Determine if a rect is empty. An empty
+ * rect is one with a zero (or negative)
+ * width or height.
+ *
+ * \return True if \a rect is empty.
+ */
int BLI_in_rcti_v(const rcti *rect, const int xy[2])
{
if (xy[0] < rect->xmin) return 0;
@@ -149,7 +159,7 @@
if (rct1->ymax < rct2->ymax) rct1->ymax = rct2->ymax;
}
-void BLI_init_rctf(rctf *rect, float xmin, float xmax, float ymin, float ymax)
+void BLI_rctf_init(rctf *rect, float xmin, float xmax, float ymin, float ymax)
{
if (xmin <= xmax) {
rect->xmin = xmin;
@@ -169,7 +179,7 @@
}
}
-void BLI_init_rcti(rcti *rect, int xmin, int xmax, int ymin, int ymax)
+void BLI_rcti_init(rcti *rect, int xmin, int xmax, int ymin, int ymax)
{
if (xmin <= xmax) {
rect->xmin = xmin;
@@ -189,6 +199,18 @@
}
}
+void BLI_rcti_init_minmax(struct rcti *rect)
+{
+ rect->xmin = rect->ymin = INT_MAX;
+ rect->xmax = rect->ymax = INT_MIN;
+}
+
+void BLI_rctf_init_minmax(struct rctf *rect)
+{
+ rect->xmin = rect->ymin = FLT_MAX;
+ rect->xmax = rect->ymax = FLT_MIN;
+}
+
void BLI_translate_rcti(rcti *rect, int x, int y)
{
rect->xmin += x;
Modified: trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp 2012-07-12 07:30:50 UTC (rev 48851)
+++ trunk/blender/source/blender/compositor/intern/COM_ExecutionGroup.cpp 2012-07-12 08:31:23 UTC (rev 48852)
@@ -432,12 +432,12 @@
inline void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk) const
{
if (this->m_singleThreaded) {
- BLI_init_rcti(rect, 0, this->m_width, 0, this->m_height);
+ BLI_rcti_init(rect, 0, this->m_width, 0, this->m_height);
}
else {
const unsigned int minx = xChunk * this->m_chunkSize;
const unsigned int miny = yChunk * this->m_chunkSize;
- BLI_init_rcti(rect, minx, min(minx + this->m_chunkSize, this->m_width), miny, min(miny + this->m_chunkSize, this->m_height));
+ BLI_rcti_init(rect, minx, min(minx + this->m_chunkSize, this->m_width), miny, min(miny + this->m_chunkSize, this->m_height));
}
}
@@ -534,7 +534,7 @@
for (index = 0; index < this->m_cachedReadOperations.size(); index++) {
ReadBufferOperation *readOperation = (ReadBufferOperation *)this->m_cachedReadOperations[index];
- BLI_init_rcti(&area, 0, 0, 0, 0);
+ BLI_rcti_init(&area, 0, 0, 0, 0);
MemoryProxy *memoryProxy = memoryProxies[index];
determineDependingAreaOfInterest(&rect, readOperation, &area);
ExecutionGroup *group = memoryProxy->getExecutor();
Modified: trunk/blender/source/blender/compositor/intern/COM_MemoryBuffer.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_MemoryBuffer.cpp 2012-07-12 07:30:50 UTC (rev 48851)
+++ trunk/blender/source/blender/compositor/intern/COM_MemoryBuffer.cpp 2012-07-12 08:31:23 UTC (rev 48852)
@@ -40,7 +40,7 @@
MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti *rect)
{
- BLI_init_rcti(&this->m_rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
+ BLI_rcti_init(&this->m_rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
this->m_memoryProxy = memoryProxy;
this->m_chunkNumber = chunkNumber;
this->m_buffer = (float *)MEM_mallocN(sizeof(float) * determineBufferSize() * COM_NUMBER_OF_CHANNELS, "COM_MemoryBuffer");
@@ -51,7 +51,7 @@
MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, rcti *rect)
{
- BLI_init_rcti(&this->m_rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
+ BLI_rcti_init(&this->m_rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
this->m_memoryProxy = memoryProxy;
this->m_chunkNumber = -1;
this->m_buffer = (float *)MEM_mallocN(sizeof(float) * determineBufferSize() * COM_NUMBER_OF_CHANNELS, "COM_MemoryBuffer");
Modified: trunk/blender/source/blender/compositor/intern/COM_NodeOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_NodeOperation.cpp 2012-07-12 07:30:50 UTC (rev 48851)
+++ trunk/blender/source/blender/compositor/intern/COM_NodeOperation.cpp 2012-07-12 08:31:23 UTC (rev 48852)
@@ -120,7 +120,7 @@
bool NodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
if (this->isInputNode()) {
- BLI_init_rcti(output, input->xmin, input->xmax, input->ymin, input->ymax);
+ BLI_rcti_init(output, input->xmin, input->xmax, input->ymin, input->ymax);
return false;
}
else {
Modified: trunk/blender/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp 2012-07-12 07:30:50 UTC (rev 48851)
+++ trunk/blender/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp 2012-07-12 08:31:23 UTC (rev 48852)
@@ -379,7 +379,7 @@
// temp. src image
// make the convolution kernel
rcti kernelRect;
- BLI_init_rcti(&kernelRect, 0, sz, 0, sz);
+ BLI_rcti_init(&kernelRect, 0, sz, 0, sz);
ckrn = new MemoryBuffer(NULL, &kernelRect);
scale = 0.25f * sqrtf((float)(sz * sz));
Modified: trunk/blender/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp 2012-07-12 07:30:50 UTC (rev 48851)
+++ trunk/blender/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp 2012-07-12 08:31:23 UTC (rev 48852)
@@ -242,7 +242,7 @@
if (!triangulation)
return NULL;
- BLI_init_rctf(&rect_float, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
+ BLI_rctf_init(&rect_float, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
tile_data = (TileData *) MEM_callocN(sizeof(TileData), "keying screen tile data");
Modified: trunk/blender/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_ReadBufferOperation.cpp 2012-07-12 07:30:50 UTC (rev 48851)
+++ trunk/blender/source/blender/compositor/operations/COM_ReadBufferOperation.cpp 2012-07-12 08:31:23 UTC (rev 48852)
@@ -67,7 +67,7 @@
bool ReadBufferOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
if (this == readOperation) {
- BLI_init_rcti(output, input->xmin, input->xmax, input->ymin, input->ymax);
+ BLI_rcti_init(output, input->xmin, input->xmax, input->ymin, input->ymax);
return true;
}
return false;
Modified: trunk/blender/source/blender/editors/screen/area.c
===================================================================
--- trunk/blender/source/blender/editors/screen/area.c 2012-07-12 07:30:50 UTC (rev 48851)
+++ trunk/blender/source/blender/editors/screen/area.c 2012-07-12 08:31:23 UTC (rev 48852)
@@ -607,7 +607,7 @@
az->y1 = sa->totrct.ymin - 1;
az->x2 = sa->totrct.xmin + (AZONESPOT - 1);
az->y2 = sa->totrct.ymin + (AZONESPOT - 1);
- BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+ BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
az = (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list