mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 21:53:41 +00:00
common: Clean up code
- Combine if condition with the same return value. - Remove empty space - Remove tab
This commit is contained in:
parent
6a4598f706
commit
c63f961b9c
6 changed files with 27 additions and 34 deletions
|
@ -54,10 +54,8 @@ struct Canvas::Impl
|
||||||
|
|
||||||
Result clear(bool free)
|
Result clear(bool free)
|
||||||
{
|
{
|
||||||
if (!renderer) return Result::InsufficientCondition;
|
|
||||||
|
|
||||||
//Clear render target before drawing
|
//Clear render target before drawing
|
||||||
if (!renderer->clear()) return Result::InsufficientCondition;
|
if (!renderer || !renderer->clear()) return Result::InsufficientCondition;
|
||||||
|
|
||||||
//free paints
|
//free paints
|
||||||
if (free) {
|
if (free) {
|
||||||
|
@ -93,9 +91,7 @@ struct Canvas::Impl
|
||||||
|
|
||||||
Result draw()
|
Result draw()
|
||||||
{
|
{
|
||||||
if (!renderer) return Result::InsufficientCondition;
|
if (!renderer || !renderer->preRender()) return Result::InsufficientCondition;
|
||||||
|
|
||||||
if (!renderer->preRender()) return Result::InsufficientCondition;
|
|
||||||
|
|
||||||
for (auto paint = paints.data; paint < (paints.data + paints.count); ++paint) {
|
for (auto paint = paints.data; paint < (paints.data + paints.count); ++paint) {
|
||||||
if (!(*paint)->pImpl->render(*renderer)) return Result::InsufficientCondition;
|
if (!(*paint)->pImpl->render(*renderer)) return Result::InsufficientCondition;
|
||||||
|
|
|
@ -220,8 +220,7 @@ namespace tvg
|
||||||
|
|
||||||
bool composite(Paint* target, CompositeMethod method)
|
bool composite(Paint* target, CompositeMethod method)
|
||||||
{
|
{
|
||||||
if (!target && method != CompositeMethod::None) return false;
|
if ((!target && method != CompositeMethod::None) || (target && method == CompositeMethod::None)) return false;
|
||||||
if (target && method == CompositeMethod::None) return false;
|
|
||||||
cmpTarget = target;
|
cmpTarget = target;
|
||||||
cmpMethod = method;
|
cmpMethod = method;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -141,8 +141,7 @@ bool simpleXmlParseAttributes(const char* buf, unsigned bufLength, simpleXMLAttr
|
||||||
const char *itr = buf, *itrEnd = buf + bufLength;
|
const char *itr = buf, *itrEnd = buf + bufLength;
|
||||||
char* tmpBuf = (char*)alloca(bufLength + 1);
|
char* tmpBuf = (char*)alloca(bufLength + 1);
|
||||||
|
|
||||||
if (!buf) return false;
|
if (!buf || !func) return false;
|
||||||
if (!func) return false;
|
|
||||||
|
|
||||||
while (itr < itrEnd) {
|
while (itr < itrEnd) {
|
||||||
const char* p = _simpleXmlSkipWhiteSpace(itr, itrEnd);
|
const char* p = _simpleXmlSkipWhiteSpace(itr, itrEnd);
|
||||||
|
@ -200,8 +199,7 @@ bool simpleXmlParse(const char* buf, unsigned bufLength, bool strip, simpleXMLCb
|
||||||
{
|
{
|
||||||
const char *itr = buf, *itrEnd = buf + bufLength;
|
const char *itr = buf, *itrEnd = buf + bufLength;
|
||||||
|
|
||||||
if (!buf) return false;
|
if (!buf || !func) return false;
|
||||||
if (!func) return false;
|
|
||||||
|
|
||||||
#define CB(type, start, end) \
|
#define CB(type, start, end) \
|
||||||
do { \
|
do { \
|
||||||
|
|
Loading…
Add table
Reference in a new issue