Beatmup
image_shader.cpp File Reference
#include "image_shader.h"
#include "../gpu/program.h"
#include "../gpu/bgl.h"
#include "../debug.h"

Go to the source code of this file.

Functions

bool str_replace (std::string &str, const std::string &from, const std::string &to)
 
static AffineMapping getOutputCropMapping (const ImageResolution &out, const IntRectangle &outputClipRect)
 

Function Documentation

◆ str_replace()

bool str_replace ( std::string &  str,
const std::string &  from,
const std::string &  to 
)

Definition at line 36 of file image_shader.cpp.

36  {
37  size_t start_pos = str.find(from);
38  if (start_pos == std::string::npos)
39  return false;
40  str.replace(start_pos, from.length(), to);
41  return true;
42 }
JNIEnv jobject jstring str

◆ getOutputCropMapping()

static AffineMapping getOutputCropMapping ( const ImageResolution out,
const IntRectangle outputClipRect 
)
static

Definition at line 45 of file image_shader.cpp.

45  {
47  (float)outputClipRect.getX1() / out.getWidth(),
48  (float)outputClipRect.getY1() / out.getHeight(),
49  (float)outputClipRect.getX2() / out.getWidth(),
50  (float)outputClipRect.getY2() / out.getHeight()
51  )).getInverse();
52 }
2x3 affine mapping containing a 2x2 matrix and a 2D point
Definition: geometry.h:639
AffineMapping getInverse() const
Returns inverse mapping.
Definition: geometry.cpp:52
numeric getX2() const
Definition: geometry.h:171
numeric getY2() const
Definition: geometry.h:172
numeric getX1() const
Definition: geometry.h:169
numeric getY1() const
Definition: geometry.h:170
JNIEnv jlong jint out