Chromium Code Reviews| Index: core/src/fxge/agg/src/fx_agg_driver.cpp |
| diff --git a/core/src/fxge/agg/src/fx_agg_driver.cpp b/core/src/fxge/agg/src/fx_agg_driver.cpp |
| index 4b3389bb4c00d4b524f28b9387cbfa309f247c32..1a7ac3f0847da3358a2c9f0405a3702730c48e95 100644 |
| --- a/core/src/fxge/agg/src/fx_agg_driver.cpp |
| +++ b/core/src/fxge/agg/src/fx_agg_driver.cpp |
| @@ -150,14 +150,7 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer, |
| if (width < unit) { |
| width = unit; |
| } |
| - if (pGraphState->m_DashArray == NULL) { |
| - agg::conv_stroke<agg::path_storage> stroke(path_data); |
| - stroke.line_join(join); |
| - stroke.line_cap(cap); |
| - stroke.miter_limit(pGraphState->m_MiterLimit); |
| - stroke.width(width); |
| - rasterizer.add_path_transformed(stroke, pObject2Device); |
| - } else { |
| + if (pGraphState->m_DashArray) { |
| typedef agg::conv_dash<agg::path_storage> dash_converter; |
| dash_converter dash(path_data); |
| for (int i = 0; i < (pGraphState->m_DashCount + 1) / 2; i++) { |
| @@ -181,6 +174,13 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer, |
| stroke.miter_limit(pGraphState->m_MiterLimit); |
| stroke.width(width); |
| rasterizer.add_path_transformed(stroke, pObject2Device); |
| + } else { |
| + agg::conv_stroke<agg::path_storage> stroke(path_data); |
| + stroke.line_join(join); |
| + stroke.line_cap(cap); |
| + stroke.miter_limit(pGraphState->m_MiterLimit); |
| + stroke.width(width); |
| + rasterizer.add_path_transformed(stroke, pObject2Device); |
| } |
| } |
| IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver( |
| @@ -556,13 +556,14 @@ class CFX_Renderer { |
| } |
| } else { |
| int index = 0; |
| - if (m_pDevice->GetPalette() == NULL) { |
| - index = ((uint8_t)m_Color == 0xff) ? 1 : 0; |
| - } else { |
| - for (int i = 0; i < 2; i++) |
| + if (m_pDevice->GetPalette()) { |
|
Lei Zhang
2015/12/12 02:31:44
There's a bunch of places where I flipped the logi
|
| + for (int i = 0; i < 2; i++) { |
| if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) { |
| index = i; |
| } |
| + } |
| + } else { |
| + index = ((uint8_t)m_Color == 0xff) ? 1 : 0; |
| } |
| uint8_t* dest_scan1 = dest_scan; |
| for (int col = col_start; col < col_end; col++) { |
| @@ -600,13 +601,14 @@ class CFX_Renderer { |
| : (clip_right - span_left); |
| dest_scan += col_start / 8; |
| int index = 0; |
| - if (m_pDevice->GetPalette() == NULL) { |
| - index = ((uint8_t)m_Color == 0xff) ? 1 : 0; |
| - } else { |
| - for (int i = 0; i < 2; i++) |
| + if (m_pDevice->GetPalette()) { |
| + for (int i = 0; i < 2; i++) { |
| if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) { |
| index = i; |
| } |
| + } |
| + } else { |
| + index = ((uint8_t)m_Color == 0xff) ? 1 : 0; |
| } |
| uint8_t* dest_scan1 = dest_scan; |
| for (int col = col_start; col < col_end; col++) { |
| @@ -996,7 +998,7 @@ class CFX_Renderer { |
| } |
| template <class Scanline> |
| void render(const Scanline& sl) { |
| - if (m_pOriDevice == NULL && composite_span == NULL) { |
| + if (!m_pOriDevice && !composite_span) { |
| return; |
| } |
| int y = sl.y(); |
| @@ -1214,7 +1216,7 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, |
| if (blend_type != FXDIB_BLEND_NORMAL) { |
| return FALSE; |
| } |
| - if (GetBuffer() == NULL) { |
| + if (!GetBuffer()) { |
| return TRUE; |
| } |
| m_FillFlags = fill_mode; |
| @@ -1388,7 +1390,7 @@ void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, |
| const CFX_DIBSource* pSrcBitmap, |
| int src_left, |
| int src_top) { |
| - if (pBitmap == NULL) { |
| + if (!pBitmap) { |
| return; |
| } |
| pBitmap->GetOverlapRect(dest_left, dest_top, width, height, |
| @@ -1529,14 +1531,14 @@ FX_BOOL CFX_AggDeviceDriver::SetPixel(int x, |
| FX_DWORD color, |
| int alpha_flag, |
| void* pIccTransform) { |
| - if (m_pBitmap->GetBuffer() == NULL) { |
| + if (!m_pBitmap->GetBuffer()) { |
| return TRUE; |
| } |
| if (!CFX_GEModule::Get()->GetCodecModule() || |
| !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { |
| pIccTransform = NULL; |
| } |
| - if (m_pClipRgn == NULL) { |
| + if (!m_pClipRgn) { |
| if (m_bRgbByteOrder) { |
| RgbByteOrderSetPixel(m_pBitmap, x, y, color); |
| } else { |
| @@ -1578,7 +1580,7 @@ FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect, |
| if (blend_type != FXDIB_BLEND_NORMAL) { |
| return FALSE; |
| } |
| - if (m_pBitmap->GetBuffer() == NULL) { |
| + if (!m_pBitmap->GetBuffer()) { |
| return TRUE; |
| } |
| FX_RECT clip_rect; |
| @@ -1590,7 +1592,7 @@ FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect, |
| if (draw_rect.IsEmpty()) { |
| return TRUE; |
| } |
| - if (m_pClipRgn == NULL || m_pClipRgn->GetType() == CFX_ClipRgn::RectI) { |
| + if (!m_pClipRgn || m_pClipRgn->GetType() == CFX_ClipRgn::RectI) { |
| if (m_bRgbByteOrder) { |
| RgbByteOrderCompositeRect(m_pBitmap, draw_rect.left, draw_rect.top, |
| draw_rect.Width(), draw_rect.Height(), |
| @@ -1610,7 +1612,7 @@ FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect, |
| return TRUE; |
| } |
| FX_BOOL CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect) { |
| - if (m_pClipRgn == NULL) { |
| + if (!m_pClipRgn) { |
| pRect->left = pRect->top = 0; |
| pRect->right = GetDeviceCaps(FXDC_PIXEL_WIDTH); |
| pRect->bottom = GetDeviceCaps(FXDC_PIXEL_HEIGHT); |
| @@ -1624,7 +1626,7 @@ FX_BOOL CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, |
| int top, |
| void* pIccTransform, |
| FX_BOOL bDEdge) { |
| - if (m_pBitmap->GetBuffer() == NULL) { |
| + if (!m_pBitmap->GetBuffer()) { |
| return TRUE; |
| } |
| if (bDEdge) { |
| @@ -1675,7 +1677,7 @@ FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, |
| int blend_type, |
| int alpha_flag, |
| void* pIccTransform) { |
| - if (m_pBitmap->GetBuffer() == NULL) { |
| + if (!m_pBitmap->GetBuffer()) { |
| return TRUE; |
| } |
| if (pBitmap->IsAlphaMask()) |
| @@ -1698,7 +1700,7 @@ FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, |
| int alpha_flag, |
| void* pIccTransform, |
| int blend_type) { |
| - if (m_pBitmap->GetBuffer() == NULL) { |
| + if (!m_pBitmap->GetBuffer()) { |
| return TRUE; |
| } |
| if (dest_width == pSource->GetWidth() && |
| @@ -1733,7 +1735,7 @@ FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, |
| int alpha_flag, |
| void* pIccTransform, |
| int blend_type) { |
| - if (m_pBitmap->GetBuffer() == NULL) { |
| + if (!m_pBitmap->GetBuffer()) { |
| return TRUE; |
| } |
| CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer; |
| @@ -1743,13 +1745,13 @@ FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, |
| return TRUE; |
| } |
| FX_BOOL CFX_AggDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { |
| - if (m_pBitmap->GetBuffer() == NULL) { |
| + if (!m_pBitmap->GetBuffer()) { |
| return TRUE; |
| } |
| return ((CFX_ImageRenderer*)pHandle)->Continue(pPause); |
| } |
| void CFX_AggDeviceDriver::CancelDIBits(void* pHandle) { |
| - if (m_pBitmap->GetBuffer() == NULL) { |
| + if (!m_pBitmap->GetBuffer()) { |
| return; |
| } |
| delete (CFX_ImageRenderer*)pHandle; |
| @@ -1762,7 +1764,7 @@ FX_BOOL CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, |
| FX_BOOL bRgbByteOrder, |
| CFX_DIBitmap* pOriDevice, |
| FX_BOOL bGroupKnockout) { |
| - if (pBitmap == NULL) { |
| + if (!pBitmap) { |
| return FALSE; |
| } |
| SetBitmap(pBitmap); |