Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: core/src/fxge/agg/src/fx_agg_driver.cpp

Issue 1520063002: Get rid of most instance of 'foo == NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@bstr_isnull
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxcrt/fx_xml_parser.cpp ('k') | core/src/fxge/android/fpf_skiafontmgr.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/src/fxge/agg/include/fx_agg_driver.h" 7 #include "core/src/fxge/agg/include/fx_agg_driver.h"
8 8
9 #include "core/include/fxcodec/fx_codec.h" 9 #include "core/include/fxcodec/fx_codec.h"
10 #include "core/include/fxge/fx_ge.h" 10 #include "core/include/fxge/fx_ge.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 143 }
144 FX_FLOAT width = pGraphState->m_LineWidth * scale; 144 FX_FLOAT width = pGraphState->m_LineWidth * scale;
145 FX_FLOAT unit = 1.f; 145 FX_FLOAT unit = 1.f;
146 if (pObject2Device) { 146 if (pObject2Device) {
147 unit = FXSYS_Div( 147 unit = FXSYS_Div(
148 1.0f, (pObject2Device->GetXUnit() + pObject2Device->GetYUnit()) / 2); 148 1.0f, (pObject2Device->GetXUnit() + pObject2Device->GetYUnit()) / 2);
149 } 149 }
150 if (width < unit) { 150 if (width < unit) {
151 width = unit; 151 width = unit;
152 } 152 }
153 if (pGraphState->m_DashArray == NULL) { 153 if (pGraphState->m_DashArray) {
154 agg::conv_stroke<agg::path_storage> stroke(path_data);
155 stroke.line_join(join);
156 stroke.line_cap(cap);
157 stroke.miter_limit(pGraphState->m_MiterLimit);
158 stroke.width(width);
159 rasterizer.add_path_transformed(stroke, pObject2Device);
160 } else {
161 typedef agg::conv_dash<agg::path_storage> dash_converter; 154 typedef agg::conv_dash<agg::path_storage> dash_converter;
162 dash_converter dash(path_data); 155 dash_converter dash(path_data);
163 for (int i = 0; i < (pGraphState->m_DashCount + 1) / 2; i++) { 156 for (int i = 0; i < (pGraphState->m_DashCount + 1) / 2; i++) {
164 FX_FLOAT on = pGraphState->m_DashArray[i * 2]; 157 FX_FLOAT on = pGraphState->m_DashArray[i * 2];
165 if (on <= 0.000001f) { 158 if (on <= 0.000001f) {
166 on = 1.0f / 10; 159 on = 1.0f / 10;
167 } 160 }
168 FX_FLOAT off = i * 2 + 1 == pGraphState->m_DashCount 161 FX_FLOAT off = i * 2 + 1 == pGraphState->m_DashCount
169 ? on 162 ? on
170 : pGraphState->m_DashArray[i * 2 + 1]; 163 : pGraphState->m_DashArray[i * 2 + 1];
171 if (off < 0) { 164 if (off < 0) {
172 off = 0; 165 off = 0;
173 } 166 }
174 dash.add_dash(on * scale, off * scale); 167 dash.add_dash(on * scale, off * scale);
175 } 168 }
176 dash.dash_start(pGraphState->m_DashPhase * scale); 169 dash.dash_start(pGraphState->m_DashPhase * scale);
177 typedef agg::conv_stroke<dash_converter> dash_stroke; 170 typedef agg::conv_stroke<dash_converter> dash_stroke;
178 dash_stroke stroke(dash); 171 dash_stroke stroke(dash);
179 stroke.line_join(join); 172 stroke.line_join(join);
180 stroke.line_cap(cap); 173 stroke.line_cap(cap);
181 stroke.miter_limit(pGraphState->m_MiterLimit); 174 stroke.miter_limit(pGraphState->m_MiterLimit);
182 stroke.width(width); 175 stroke.width(width);
183 rasterizer.add_path_transformed(stroke, pObject2Device); 176 rasterizer.add_path_transformed(stroke, pObject2Device);
177 } else {
178 agg::conv_stroke<agg::path_storage> stroke(path_data);
179 stroke.line_join(join);
180 stroke.line_cap(cap);
181 stroke.miter_limit(pGraphState->m_MiterLimit);
182 stroke.width(width);
183 rasterizer.add_path_transformed(stroke, pObject2Device);
184 } 184 }
185 } 185 }
186 IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver( 186 IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver(
187 CFX_DIBitmap* pBitmap, 187 CFX_DIBitmap* pBitmap,
188 FX_BOOL bRgbByteOrder, 188 FX_BOOL bRgbByteOrder,
189 CFX_DIBitmap* pOriDevice, 189 CFX_DIBitmap* pOriDevice,
190 FX_BOOL bGroupKnockout) { 190 FX_BOOL bGroupKnockout) {
191 return new CFX_AggDeviceDriver(pBitmap, 0, bRgbByteOrder, pOriDevice, 191 return new CFX_AggDeviceDriver(pBitmap, 0, bRgbByteOrder, pOriDevice,
192 bGroupKnockout); 192 bGroupKnockout);
193 } 193 }
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 if (m_bFullCover) { 547 if (m_bFullCover) {
548 *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha); 548 *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
549 } else { 549 } else {
550 int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha); 550 int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
551 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan[col]); 551 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan[col]);
552 dest_scan++; 552 dest_scan++;
553 } 553 }
554 } 554 }
555 } else { 555 } else {
556 int index = 0; 556 int index = 0;
557 if (m_pDevice->GetPalette() == NULL) { 557 if (m_pDevice->GetPalette()) {
558 index = ((uint8_t)m_Color == 0xff) ? 1 : 0; 558 for (int i = 0; i < 2; i++) {
559 } else {
560 for (int i = 0; i < 2; i++)
561 if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) { 559 if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) {
562 index = i; 560 index = i;
563 } 561 }
562 }
563 } else {
564 index = ((uint8_t)m_Color == 0xff) ? 1 : 0;
564 } 565 }
565 uint8_t* dest_scan1 = dest_scan; 566 uint8_t* dest_scan1 = dest_scan;
566 for (int col = col_start; col < col_end; col++) { 567 for (int col = col_start; col < col_end; col++) {
567 int src_alpha; 568 int src_alpha;
568 if (clip_scan) { 569 if (clip_scan) {
569 src_alpha = m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255; 570 src_alpha = m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255;
570 } else { 571 } else {
571 src_alpha = m_Alpha * cover_scan[col] / 255; 572 src_alpha = m_Alpha * cover_scan[col] / 255;
572 } 573 }
573 if (src_alpha) { 574 if (src_alpha) {
(...skipping 17 matching lines...) Expand all
591 uint8_t* clip_scan, 592 uint8_t* clip_scan,
592 uint8_t* dest_extra_alpha_scan) { 593 uint8_t* dest_extra_alpha_scan) {
593 ASSERT(!m_bRgbByteOrder); 594 ASSERT(!m_bRgbByteOrder);
594 ASSERT(!m_pDevice->IsCmykImage()); 595 ASSERT(!m_pDevice->IsCmykImage());
595 int col_start = span_left < clip_left ? clip_left - span_left : 0; 596 int col_start = span_left < clip_left ? clip_left - span_left : 0;
596 int col_end = (span_left + span_len) < clip_right 597 int col_end = (span_left + span_len) < clip_right
597 ? span_len 598 ? span_len
598 : (clip_right - span_left); 599 : (clip_right - span_left);
599 dest_scan += col_start / 8; 600 dest_scan += col_start / 8;
600 int index = 0; 601 int index = 0;
601 if (m_pDevice->GetPalette() == NULL) { 602 if (m_pDevice->GetPalette()) {
602 index = ((uint8_t)m_Color == 0xff) ? 1 : 0; 603 for (int i = 0; i < 2; i++) {
603 } else {
604 for (int i = 0; i < 2; i++)
605 if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) { 604 if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color) {
606 index = i; 605 index = i;
607 } 606 }
607 }
608 } else {
609 index = ((uint8_t)m_Color == 0xff) ? 1 : 0;
608 } 610 }
609 uint8_t* dest_scan1 = dest_scan; 611 uint8_t* dest_scan1 = dest_scan;
610 for (int col = col_start; col < col_end; col++) { 612 for (int col = col_start; col < col_end; col++) {
611 int src_alpha; 613 int src_alpha;
612 if (clip_scan) { 614 if (clip_scan) {
613 src_alpha = m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255; 615 src_alpha = m_Alpha * cover_scan[col] * clip_scan[col] / 255 / 255;
614 } else { 616 } else {
615 src_alpha = m_Alpha * cover_scan[col] / 255; 617 src_alpha = m_Alpha * cover_scan[col] / 255;
616 } 618 }
617 if (src_alpha) { 619 if (src_alpha) {
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 dest_scan++; 989 dest_scan++;
988 continue; 990 continue;
989 } 991 }
990 } 992 }
991 dest_scan += 4; 993 dest_scan += 4;
992 } 994 }
993 } 995 }
994 } 996 }
995 template <class Scanline> 997 template <class Scanline>
996 void render(const Scanline& sl) { 998 void render(const Scanline& sl) {
997 if (m_pOriDevice == NULL && composite_span == NULL) { 999 if (!m_pOriDevice && !composite_span) {
998 return; 1000 return;
999 } 1001 }
1000 int y = sl.y(); 1002 int y = sl.y();
1001 if (y < m_ClipBox.top || y >= m_ClipBox.bottom) { 1003 if (y < m_ClipBox.top || y >= m_ClipBox.bottom) {
1002 return; 1004 return;
1003 } 1005 }
1004 uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * y; 1006 uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * y;
1005 uint8_t* dest_scan_extra_alpha = NULL; 1007 uint8_t* dest_scan_extra_alpha = NULL;
1006 CFX_DIBitmap* pAlphaMask = m_pDevice->m_pAlphaMask; 1008 CFX_DIBitmap* pAlphaMask = m_pDevice->m_pAlphaMask;
1007 if (pAlphaMask) { 1009 if (pAlphaMask) {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 const CFX_GraphStateData* pGraphState, 1207 const CFX_GraphStateData* pGraphState,
1206 FX_DWORD fill_color, 1208 FX_DWORD fill_color,
1207 FX_DWORD stroke_color, 1209 FX_DWORD stroke_color,
1208 int fill_mode, 1210 int fill_mode,
1209 int alpha_flag, 1211 int alpha_flag,
1210 void* pIccTransform, 1212 void* pIccTransform,
1211 int blend_type) { 1213 int blend_type) {
1212 if (blend_type != FXDIB_BLEND_NORMAL) { 1214 if (blend_type != FXDIB_BLEND_NORMAL) {
1213 return FALSE; 1215 return FALSE;
1214 } 1216 }
1215 if (GetBuffer() == NULL) { 1217 if (!GetBuffer()) {
1216 return TRUE; 1218 return TRUE;
1217 } 1219 }
1218 m_FillFlags = fill_mode; 1220 m_FillFlags = fill_mode;
1219 if ((fill_mode & 3) && fill_color) { 1221 if ((fill_mode & 3) && fill_color) {
1220 CAgg_PathData path_data; 1222 CAgg_PathData path_data;
1221 path_data.BuildPath(pPathData, pObject2Device); 1223 path_data.BuildPath(pPathData, pObject2Device);
1222 agg::rasterizer_scanline_aa rasterizer; 1224 agg::rasterizer_scanline_aa rasterizer;
1223 rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), 1225 rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
1224 (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); 1226 (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
1225 rasterizer.add_path(path_data.m_PathData); 1227 rasterizer.add_path(path_data.m_PathData);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 } 1381 }
1380 } 1382 }
1381 void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, 1383 void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap,
1382 int dest_left, 1384 int dest_left,
1383 int dest_top, 1385 int dest_top,
1384 int width, 1386 int width,
1385 int height, 1387 int height,
1386 const CFX_DIBSource* pSrcBitmap, 1388 const CFX_DIBSource* pSrcBitmap,
1387 int src_left, 1389 int src_left,
1388 int src_top) { 1390 int src_top) {
1389 if (pBitmap == NULL) { 1391 if (!pBitmap) {
1390 return; 1392 return;
1391 } 1393 }
1392 pBitmap->GetOverlapRect(dest_left, dest_top, width, height, 1394 pBitmap->GetOverlapRect(dest_left, dest_top, width, height,
1393 pSrcBitmap->GetWidth(), pSrcBitmap->GetHeight(), 1395 pSrcBitmap->GetWidth(), pSrcBitmap->GetHeight(),
1394 src_left, src_top, NULL); 1396 src_left, src_top, NULL);
1395 if (width == 0 || height == 0) { 1397 if (width == 0 || height == 0) {
1396 return; 1398 return;
1397 } 1399 }
1398 int Bpp = pBitmap->GetBPP() / 8; 1400 int Bpp = pBitmap->GetBPP() / 8;
1399 FXDIB_Format dest_format = pBitmap->GetFormat(); 1401 FXDIB_Format dest_format = pBitmap->GetFormat();
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 if (pDevice->m_pAlphaMask) { 1522 if (pDevice->m_pAlphaMask) {
1521 pDevice->m_pAlphaMask->SetPixel(x, y, alpha << 24); 1523 pDevice->m_pAlphaMask->SetPixel(x, y, alpha << 24);
1522 } 1524 }
1523 return TRUE; 1525 return TRUE;
1524 } 1526 }
1525 FX_BOOL CFX_AggDeviceDriver::SetPixel(int x, 1527 FX_BOOL CFX_AggDeviceDriver::SetPixel(int x,
1526 int y, 1528 int y,
1527 FX_DWORD color, 1529 FX_DWORD color,
1528 int alpha_flag, 1530 int alpha_flag,
1529 void* pIccTransform) { 1531 void* pIccTransform) {
1530 if (m_pBitmap->GetBuffer() == NULL) { 1532 if (!m_pBitmap->GetBuffer()) {
1531 return TRUE; 1533 return TRUE;
1532 } 1534 }
1533 if (!CFX_GEModule::Get()->GetCodecModule() || 1535 if (!CFX_GEModule::Get()->GetCodecModule() ||
1534 !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { 1536 !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) {
1535 pIccTransform = NULL; 1537 pIccTransform = NULL;
1536 } 1538 }
1537 if (m_pClipRgn == NULL) { 1539 if (!m_pClipRgn) {
1538 if (m_bRgbByteOrder) { 1540 if (m_bRgbByteOrder) {
1539 RgbByteOrderSetPixel(m_pBitmap, x, y, color); 1541 RgbByteOrderSetPixel(m_pBitmap, x, y, color);
1540 } else { 1542 } else {
1541 return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTransform); 1543 return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTransform);
1542 } 1544 }
1543 } else if (m_pClipRgn->GetBox().Contains(x, y)) { 1545 } else if (m_pClipRgn->GetBox().Contains(x, y)) {
1544 if (m_pClipRgn->GetType() == CFX_ClipRgn::RectI) { 1546 if (m_pClipRgn->GetType() == CFX_ClipRgn::RectI) {
1545 if (m_bRgbByteOrder) { 1547 if (m_bRgbByteOrder) {
1546 RgbByteOrderSetPixel(m_pBitmap, x, y, color); 1548 RgbByteOrderSetPixel(m_pBitmap, x, y, color);
1547 } else { 1549 } else {
(...skipping 21 matching lines...) Expand all
1569 return TRUE; 1571 return TRUE;
1570 } 1572 }
1571 FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect, 1573 FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect,
1572 FX_DWORD fill_color, 1574 FX_DWORD fill_color,
1573 int alpha_flag, 1575 int alpha_flag,
1574 void* pIccTransform, 1576 void* pIccTransform,
1575 int blend_type) { 1577 int blend_type) {
1576 if (blend_type != FXDIB_BLEND_NORMAL) { 1578 if (blend_type != FXDIB_BLEND_NORMAL) {
1577 return FALSE; 1579 return FALSE;
1578 } 1580 }
1579 if (m_pBitmap->GetBuffer() == NULL) { 1581 if (!m_pBitmap->GetBuffer()) {
1580 return TRUE; 1582 return TRUE;
1581 } 1583 }
1582 FX_RECT clip_rect; 1584 FX_RECT clip_rect;
1583 GetClipBox(&clip_rect); 1585 GetClipBox(&clip_rect);
1584 FX_RECT draw_rect = clip_rect; 1586 FX_RECT draw_rect = clip_rect;
1585 if (pRect) { 1587 if (pRect) {
1586 draw_rect.Intersect(*pRect); 1588 draw_rect.Intersect(*pRect);
1587 } 1589 }
1588 if (draw_rect.IsEmpty()) { 1590 if (draw_rect.IsEmpty()) {
1589 return TRUE; 1591 return TRUE;
1590 } 1592 }
1591 if (m_pClipRgn == NULL || m_pClipRgn->GetType() == CFX_ClipRgn::RectI) { 1593 if (!m_pClipRgn || m_pClipRgn->GetType() == CFX_ClipRgn::RectI) {
1592 if (m_bRgbByteOrder) { 1594 if (m_bRgbByteOrder) {
1593 RgbByteOrderCompositeRect(m_pBitmap, draw_rect.left, draw_rect.top, 1595 RgbByteOrderCompositeRect(m_pBitmap, draw_rect.left, draw_rect.top,
1594 draw_rect.Width(), draw_rect.Height(), 1596 draw_rect.Width(), draw_rect.Height(),
1595 fill_color); 1597 fill_color);
1596 } else { 1598 } else {
1597 m_pBitmap->CompositeRect(draw_rect.left, draw_rect.top, draw_rect.Width(), 1599 m_pBitmap->CompositeRect(draw_rect.left, draw_rect.top, draw_rect.Width(),
1598 draw_rect.Height(), fill_color, alpha_flag, 1600 draw_rect.Height(), fill_color, alpha_flag,
1599 pIccTransform); 1601 pIccTransform);
1600 } 1602 }
1601 return TRUE; 1603 return TRUE;
1602 } 1604 }
1603 m_pBitmap->CompositeMask( 1605 m_pBitmap->CompositeMask(
1604 draw_rect.left, draw_rect.top, draw_rect.Width(), draw_rect.Height(), 1606 draw_rect.left, draw_rect.top, draw_rect.Width(), draw_rect.Height(),
1605 (const CFX_DIBitmap*)m_pClipRgn->GetMask(), fill_color, 1607 (const CFX_DIBitmap*)m_pClipRgn->GetMask(), fill_color,
1606 draw_rect.left - clip_rect.left, draw_rect.top - clip_rect.top, 1608 draw_rect.left - clip_rect.left, draw_rect.top - clip_rect.top,
1607 FXDIB_BLEND_NORMAL, NULL, m_bRgbByteOrder, alpha_flag, pIccTransform); 1609 FXDIB_BLEND_NORMAL, NULL, m_bRgbByteOrder, alpha_flag, pIccTransform);
1608 return TRUE; 1610 return TRUE;
1609 } 1611 }
1610 FX_BOOL CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect) { 1612 FX_BOOL CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect) {
1611 if (m_pClipRgn == NULL) { 1613 if (!m_pClipRgn) {
1612 pRect->left = pRect->top = 0; 1614 pRect->left = pRect->top = 0;
1613 pRect->right = GetDeviceCaps(FXDC_PIXEL_WIDTH); 1615 pRect->right = GetDeviceCaps(FXDC_PIXEL_WIDTH);
1614 pRect->bottom = GetDeviceCaps(FXDC_PIXEL_HEIGHT); 1616 pRect->bottom = GetDeviceCaps(FXDC_PIXEL_HEIGHT);
1615 return TRUE; 1617 return TRUE;
1616 } 1618 }
1617 *pRect = m_pClipRgn->GetBox(); 1619 *pRect = m_pClipRgn->GetBox();
1618 return TRUE; 1620 return TRUE;
1619 } 1621 }
1620 FX_BOOL CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, 1622 FX_BOOL CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap,
1621 int left, 1623 int left,
1622 int top, 1624 int top,
1623 void* pIccTransform, 1625 void* pIccTransform,
1624 FX_BOOL bDEdge) { 1626 FX_BOOL bDEdge) {
1625 if (m_pBitmap->GetBuffer() == NULL) { 1627 if (!m_pBitmap->GetBuffer()) {
1626 return TRUE; 1628 return TRUE;
1627 } 1629 }
1628 if (bDEdge) { 1630 if (bDEdge) {
1629 if (m_bRgbByteOrder) { 1631 if (m_bRgbByteOrder) {
1630 RgbByteOrderTransferBitmap(pBitmap, 0, 0, pBitmap->GetWidth(), 1632 RgbByteOrderTransferBitmap(pBitmap, 0, 0, pBitmap->GetWidth(),
1631 pBitmap->GetHeight(), m_pBitmap, left, top); 1633 pBitmap->GetHeight(), m_pBitmap, left, top);
1632 } else { 1634 } else {
1633 return pBitmap->TransferBitmap(0, 0, pBitmap->GetWidth(), 1635 return pBitmap->TransferBitmap(0, 0, pBitmap->GetWidth(),
1634 pBitmap->GetHeight(), m_pBitmap, left, top, 1636 pBitmap->GetHeight(), m_pBitmap, left, top,
1635 pIccTransform); 1637 pIccTransform);
(...skipping 30 matching lines...) Expand all
1666 return bRet; 1668 return bRet;
1667 } 1669 }
1668 FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, 1670 FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
1669 FX_DWORD argb, 1671 FX_DWORD argb,
1670 const FX_RECT* pSrcRect, 1672 const FX_RECT* pSrcRect,
1671 int left, 1673 int left,
1672 int top, 1674 int top,
1673 int blend_type, 1675 int blend_type,
1674 int alpha_flag, 1676 int alpha_flag,
1675 void* pIccTransform) { 1677 void* pIccTransform) {
1676 if (m_pBitmap->GetBuffer() == NULL) { 1678 if (!m_pBitmap->GetBuffer()) {
1677 return TRUE; 1679 return TRUE;
1678 } 1680 }
1679 if (pBitmap->IsAlphaMask()) 1681 if (pBitmap->IsAlphaMask())
1680 return m_pBitmap->CompositeMask( 1682 return m_pBitmap->CompositeMask(
1681 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, argb, 1683 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, argb,
1682 pSrcRect->left, pSrcRect->top, blend_type, m_pClipRgn, m_bRgbByteOrder, 1684 pSrcRect->left, pSrcRect->top, blend_type, m_pClipRgn, m_bRgbByteOrder,
1683 alpha_flag, pIccTransform); 1685 alpha_flag, pIccTransform);
1684 return m_pBitmap->CompositeBitmap( 1686 return m_pBitmap->CompositeBitmap(
1685 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, pSrcRect->left, 1687 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, pSrcRect->left,
1686 pSrcRect->top, blend_type, m_pClipRgn, m_bRgbByteOrder, pIccTransform); 1688 pSrcRect->top, blend_type, m_pClipRgn, m_bRgbByteOrder, pIccTransform);
1687 } 1689 }
1688 FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, 1690 FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
1689 FX_DWORD argb, 1691 FX_DWORD argb,
1690 int dest_left, 1692 int dest_left,
1691 int dest_top, 1693 int dest_top,
1692 int dest_width, 1694 int dest_width,
1693 int dest_height, 1695 int dest_height,
1694 const FX_RECT* pClipRect, 1696 const FX_RECT* pClipRect,
1695 FX_DWORD flags, 1697 FX_DWORD flags,
1696 int alpha_flag, 1698 int alpha_flag,
1697 void* pIccTransform, 1699 void* pIccTransform,
1698 int blend_type) { 1700 int blend_type) {
1699 if (m_pBitmap->GetBuffer() == NULL) { 1701 if (!m_pBitmap->GetBuffer()) {
1700 return TRUE; 1702 return TRUE;
1701 } 1703 }
1702 if (dest_width == pSource->GetWidth() && 1704 if (dest_width == pSource->GetWidth() &&
1703 dest_height == pSource->GetHeight()) { 1705 dest_height == pSource->GetHeight()) {
1704 FX_RECT rect(0, 0, dest_width, dest_height); 1706 FX_RECT rect(0, 0, dest_width, dest_height);
1705 return SetDIBits(pSource, argb, &rect, dest_left, dest_top, blend_type, 1707 return SetDIBits(pSource, argb, &rect, dest_left, dest_top, blend_type,
1706 alpha_flag, pIccTransform); 1708 alpha_flag, pIccTransform);
1707 } 1709 }
1708 FX_RECT dest_rect(dest_left, dest_top, dest_left + dest_width, 1710 FX_RECT dest_rect(dest_left, dest_top, dest_left + dest_width,
1709 dest_top + dest_height); 1711 dest_top + dest_height);
(...skipping 14 matching lines...) Expand all
1724 } 1726 }
1725 FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, 1727 FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource,
1726 int bitmap_alpha, 1728 int bitmap_alpha,
1727 FX_DWORD argb, 1729 FX_DWORD argb,
1728 const CFX_Matrix* pMatrix, 1730 const CFX_Matrix* pMatrix,
1729 FX_DWORD render_flags, 1731 FX_DWORD render_flags,
1730 void*& handle, 1732 void*& handle,
1731 int alpha_flag, 1733 int alpha_flag,
1732 void* pIccTransform, 1734 void* pIccTransform,
1733 int blend_type) { 1735 int blend_type) {
1734 if (m_pBitmap->GetBuffer() == NULL) { 1736 if (!m_pBitmap->GetBuffer()) {
1735 return TRUE; 1737 return TRUE;
1736 } 1738 }
1737 CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer; 1739 CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer;
1738 pRenderer->Start(m_pBitmap, m_pClipRgn, pSource, bitmap_alpha, argb, pMatrix, 1740 pRenderer->Start(m_pBitmap, m_pClipRgn, pSource, bitmap_alpha, argb, pMatrix,
1739 render_flags, m_bRgbByteOrder, alpha_flag, pIccTransform); 1741 render_flags, m_bRgbByteOrder, alpha_flag, pIccTransform);
1740 handle = pRenderer; 1742 handle = pRenderer;
1741 return TRUE; 1743 return TRUE;
1742 } 1744 }
1743 FX_BOOL CFX_AggDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { 1745 FX_BOOL CFX_AggDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) {
1744 if (m_pBitmap->GetBuffer() == NULL) { 1746 if (!m_pBitmap->GetBuffer()) {
1745 return TRUE; 1747 return TRUE;
1746 } 1748 }
1747 return ((CFX_ImageRenderer*)pHandle)->Continue(pPause); 1749 return ((CFX_ImageRenderer*)pHandle)->Continue(pPause);
1748 } 1750 }
1749 void CFX_AggDeviceDriver::CancelDIBits(void* pHandle) { 1751 void CFX_AggDeviceDriver::CancelDIBits(void* pHandle) {
1750 if (m_pBitmap->GetBuffer() == NULL) { 1752 if (!m_pBitmap->GetBuffer()) {
1751 return; 1753 return;
1752 } 1754 }
1753 delete (CFX_ImageRenderer*)pHandle; 1755 delete (CFX_ImageRenderer*)pHandle;
1754 } 1756 }
1755 CFX_FxgeDevice::CFX_FxgeDevice() { 1757 CFX_FxgeDevice::CFX_FxgeDevice() {
1756 m_bOwnedBitmap = FALSE; 1758 m_bOwnedBitmap = FALSE;
1757 } 1759 }
1758 FX_BOOL CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, 1760 FX_BOOL CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap,
1759 int dither_bits, 1761 int dither_bits,
1760 FX_BOOL bRgbByteOrder, 1762 FX_BOOL bRgbByteOrder,
1761 CFX_DIBitmap* pOriDevice, 1763 CFX_DIBitmap* pOriDevice,
1762 FX_BOOL bGroupKnockout) { 1764 FX_BOOL bGroupKnockout) {
1763 if (pBitmap == NULL) { 1765 if (!pBitmap) {
1764 return FALSE; 1766 return FALSE;
1765 } 1767 }
1766 SetBitmap(pBitmap); 1768 SetBitmap(pBitmap);
1767 IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver( 1769 IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(
1768 pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout); 1770 pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout);
1769 SetDeviceDriver(pDriver); 1771 SetDeviceDriver(pDriver);
1770 return TRUE; 1772 return TRUE;
1771 } 1773 }
1772 FX_BOOL CFX_FxgeDevice::Create(int width, 1774 FX_BOOL CFX_FxgeDevice::Create(int width,
1773 int height, 1775 int height,
(...skipping 10 matching lines...) Expand all
1784 IFX_RenderDeviceDriver* pDriver = 1786 IFX_RenderDeviceDriver* pDriver =
1785 new CFX_AggDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE); 1787 new CFX_AggDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE);
1786 SetDeviceDriver(pDriver); 1788 SetDeviceDriver(pDriver);
1787 return TRUE; 1789 return TRUE;
1788 } 1790 }
1789 CFX_FxgeDevice::~CFX_FxgeDevice() { 1791 CFX_FxgeDevice::~CFX_FxgeDevice() {
1790 if (m_bOwnedBitmap) { 1792 if (m_bOwnedBitmap) {
1791 delete GetBitmap(); 1793 delete GetBitmap();
1792 } 1794 }
1793 } 1795 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_xml_parser.cpp ('k') | core/src/fxge/android/fpf_skiafontmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698