mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +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)
|
||||
{
|
||||
if (!renderer) return Result::InsufficientCondition;
|
||||
|
||||
//Clear render target before drawing
|
||||
if (!renderer->clear()) return Result::InsufficientCondition;
|
||||
if (!renderer || !renderer->clear()) return Result::InsufficientCondition;
|
||||
|
||||
//free paints
|
||||
if (free) {
|
||||
|
@ -93,9 +91,7 @@ struct Canvas::Impl
|
|||
|
||||
Result draw()
|
||||
{
|
||||
if (!renderer) return Result::InsufficientCondition;
|
||||
|
||||
if (!renderer->preRender()) return Result::InsufficientCondition;
|
||||
if (!renderer || !renderer->preRender()) return Result::InsufficientCondition;
|
||||
|
||||
for (auto paint = paints.data; paint < (paints.data + paints.count); ++paint) {
|
||||
if (!(*paint)->pImpl->render(*renderer)) return Result::InsufficientCondition;
|
||||
|
|
|
@ -220,8 +220,7 @@ namespace tvg
|
|||
|
||||
bool composite(Paint* target, CompositeMethod method)
|
||||
{
|
||||
if (!target && method != CompositeMethod::None) return false;
|
||||
if (target && method == CompositeMethod::None) return false;
|
||||
if ((!target && method != CompositeMethod::None) || (target && method == CompositeMethod::None)) return false;
|
||||
cmpTarget = target;
|
||||
cmpMethod = method;
|
||||
return true;
|
||||
|
|
|
@ -141,8 +141,7 @@ bool simpleXmlParseAttributes(const char* buf, unsigned bufLength, simpleXMLAttr
|
|||
const char *itr = buf, *itrEnd = buf + bufLength;
|
||||
char* tmpBuf = (char*)alloca(bufLength + 1);
|
||||
|
||||
if (!buf) return false;
|
||||
if (!func) return false;
|
||||
if (!buf || !func) return false;
|
||||
|
||||
while (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;
|
||||
|
||||
if (!buf) return false;
|
||||
if (!func) return false;
|
||||
if (!buf || !func) return false;
|
||||
|
||||
#define CB(type, start, end) \
|
||||
do { \
|
||||
|
|
Loading…
Add table
Reference in a new issue