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

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

Issue 1258093002: FX Bool considered harmful, part 3 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 4 months 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/fxge/agg/include/fx_agg_driver.h ('k') | core/src/fxge/android/fpf_skiafont.h » ('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 "../../../../include/fxge/fx_ge.h" 7 #include "../../../../include/fxge/fx_ge.h"
8 #include "../../dib/dib_int.h" 8 #include "../../dib/dib_int.h"
9 #include "../../ge/text_int.h" 9 #include "../../ge/text_int.h"
10 #include "../../../../include/fxcodec/fx_codec.h" 10 #include "../../../../include/fxcodec/fx_codec.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 112 }
113 private: 113 private:
114 base_ren_type* m_ren; 114 base_ren_type* m_ren;
115 color_type m_color; 115 color_type m_color;
116 unsigned m_left, m_top; 116 unsigned m_left, m_top;
117 }; 117 };
118 } 118 }
119 static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer, agg::path_s torage& path_data, 119 static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer, agg::path_s torage& path_data,
120 const CFX_AffineMatrix* pObject2Device, 120 const CFX_AffineMatrix* pObject2Device,
121 const CFX_GraphStateData* pGraphState, FX_FLOAT scal e = 1.0f, 121 const CFX_GraphStateData* pGraphState, FX_FLOAT scal e = 1.0f,
122 FX_BOOL bStrokeAdjust = FALSE, FX_BOOL bTextMode = F ALSE) 122 bool bStrokeAdjust = false, bool bTextMode = false)
123 { 123 {
124 agg::line_cap_e cap; 124 agg::line_cap_e cap;
125 switch (pGraphState->m_LineCap) { 125 switch (pGraphState->m_LineCap) {
126 case CFX_GraphStateData::LineCapRound: 126 case CFX_GraphStateData::LineCapRound:
127 cap = agg::round_cap; 127 cap = agg::round_cap;
128 break; 128 break;
129 case CFX_GraphStateData::LineCapSquare: 129 case CFX_GraphStateData::LineCapSquare:
130 cap = agg::square_cap; 130 cap = agg::square_cap;
131 break; 131 break;
132 default: 132 default:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 dash.dash_start(pGraphState->m_DashPhase * scale); 178 dash.dash_start(pGraphState->m_DashPhase * scale);
179 typedef agg::conv_stroke<dash_converter> dash_stroke; 179 typedef agg::conv_stroke<dash_converter> dash_stroke;
180 dash_stroke stroke(dash); 180 dash_stroke stroke(dash);
181 stroke.line_join(join); 181 stroke.line_join(join);
182 stroke.line_cap(cap); 182 stroke.line_cap(cap);
183 stroke.miter_limit(pGraphState->m_MiterLimit); 183 stroke.miter_limit(pGraphState->m_MiterLimit);
184 stroke.width(width); 184 stroke.width(width);
185 rasterizer.add_path_transformed(stroke, pObject2Device); 185 rasterizer.add_path_transformed(stroke, pObject2Device);
186 } 186 }
187 } 187 }
188 IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver(CFX_DIBitmap* p Bitmap, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) 188 IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver(CFX_DIBitmap* p Bitmap, bool bRgbByteOrder, CFX_DIBitmap* pOriDevice, bool bGroupKnockout)
189 { 189 {
190 return new CFX_AggDeviceDriver(pBitmap, 0, bRgbByteOrder, pOriDevice, bGroup Knockout); 190 return new CFX_AggDeviceDriver(pBitmap, 0, bRgbByteOrder, pOriDevice, bGroup Knockout);
191 } 191 }
192 CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) 192 CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, bool bRgbByteOrder, CFX_DIBitmap* pOriDevice, bool bGroupKnockout)
193 { 193 {
194 m_pBitmap = pBitmap; 194 m_pBitmap = pBitmap;
195 m_DitherBits = dither_bits; 195 m_DitherBits = dither_bits;
196 m_pClipRgn = NULL; 196 m_pClipRgn = NULL;
197 m_pPlatformBitmap = NULL; 197 m_pPlatformBitmap = NULL;
198 m_pPlatformGraphics = NULL; 198 m_pPlatformGraphics = NULL;
199 m_pDwRenderTartget = NULL; 199 m_pDwRenderTartget = NULL;
200 m_bRgbByteOrder = bRgbByteOrder; 200 m_bRgbByteOrder = bRgbByteOrder;
201 m_pOriDevice = pOriDevice; 201 m_pOriDevice = pOriDevice;
202 m_bGroupKnockout = bGroupKnockout; 202 m_bGroupKnockout = bGroupKnockout;
203 m_FillFlags = 0; 203 m_FillFlags = 0;
204 InitPlatform(); 204 InitPlatform();
205 } 205 }
206 CFX_AggDeviceDriver::~CFX_AggDeviceDriver() 206 CFX_AggDeviceDriver::~CFX_AggDeviceDriver()
207 { 207 {
208 delete m_pClipRgn; 208 delete m_pClipRgn;
209 for (int i = 0; i < m_StateStack.GetSize(); i ++) 209 for (int i = 0; i < m_StateStack.GetSize(); i ++)
210 delete (CFX_ClipRgn*)m_StateStack[i]; 210 delete (CFX_ClipRgn*)m_StateStack[i];
211 DestroyPlatform(); 211 DestroyPlatform();
212 } 212 }
213 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ 213 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_
214 void CFX_AggDeviceDriver::InitPlatform() 214 void CFX_AggDeviceDriver::InitPlatform()
215 { 215 {
216 } 216 }
217 void CFX_AggDeviceDriver::DestroyPlatform() 217 void CFX_AggDeviceDriver::DestroyPlatform()
218 { 218 {
219 } 219 }
220 FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pC harPos, CFX_Font* pFont, 220 bool CFX_AggDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pChar Pos, CFX_Font* pFont,
221 CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, 221 CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color,
222 int alpha_flag, void* pIccTransform) 222 int alpha_flag, void* pIccTransform)
223 { 223 {
224 return FALSE; 224 return false;
225 } 225 }
226 #endif 226 #endif
227 int CFX_AggDeviceDriver::GetDeviceCaps(int caps_id) 227 int CFX_AggDeviceDriver::GetDeviceCaps(int caps_id)
228 { 228 {
229 switch (caps_id) { 229 switch (caps_id) {
230 case FXDC_DEVICE_CLASS: 230 case FXDC_DEVICE_CLASS:
231 return FXDC_DISPLAY; 231 return FXDC_DISPLAY;
232 case FXDC_PIXEL_WIDTH: 232 case FXDC_PIXEL_WIDTH:
233 return m_pBitmap->GetWidth(); 233 return m_pBitmap->GetWidth();
234 case FXDC_PIXEL_HEIGHT: 234 case FXDC_PIXEL_HEIGHT:
(...skipping 25 matching lines...) Expand all
260 return 0; 260 return 0;
261 } 261 }
262 void CFX_AggDeviceDriver::SaveState() 262 void CFX_AggDeviceDriver::SaveState()
263 { 263 {
264 void* pClip = NULL; 264 void* pClip = NULL;
265 if (m_pClipRgn) { 265 if (m_pClipRgn) {
266 pClip = new CFX_ClipRgn(*m_pClipRgn); 266 pClip = new CFX_ClipRgn(*m_pClipRgn);
267 } 267 }
268 m_StateStack.Add(pClip); 268 m_StateStack.Add(pClip);
269 } 269 }
270 void CFX_AggDeviceDriver::RestoreState(FX_BOOL bKeepSaved) 270 void CFX_AggDeviceDriver::RestoreState(bool bKeepSaved)
271 { 271 {
272 if (m_StateStack.GetSize() == 0) { 272 if (m_StateStack.GetSize() == 0) {
273 delete m_pClipRgn; 273 delete m_pClipRgn;
274 m_pClipRgn = NULL; 274 m_pClipRgn = NULL;
275 return; 275 return;
276 } 276 }
277 CFX_ClipRgn* pSavedClip = (CFX_ClipRgn*)m_StateStack[m_StateStack.GetSize() - 1]; 277 CFX_ClipRgn* pSavedClip = (CFX_ClipRgn*)m_StateStack[m_StateStack.GetSize() - 1];
278 delete m_pClipRgn; 278 delete m_pClipRgn;
279 m_pClipRgn = NULL; 279 m_pClipRgn = NULL;
280 if (bKeepSaved) { 280 if (bKeepSaved) {
(...skipping 19 matching lines...) Expand all
300 pThisLayer->Clear(0); 300 pThisLayer->Clear(0);
301 agg::rendering_buffer raw_buf(pThisLayer->GetBuffer(), pThisLayer->GetWidth( ), pThisLayer->GetHeight(), pThisLayer->GetPitch()); 301 agg::rendering_buffer raw_buf(pThisLayer->GetBuffer(), pThisLayer->GetWidth( ), pThisLayer->GetHeight(), pThisLayer->GetPitch());
302 agg::pixfmt_gray8 pixel_buf(raw_buf); 302 agg::pixfmt_gray8 pixel_buf(raw_buf);
303 agg::renderer_base<agg::pixfmt_gray8> base_buf(pixel_buf); 303 agg::renderer_base<agg::pixfmt_gray8> base_buf(pixel_buf);
304 agg::renderer_scanline_aa_offset<agg::renderer_base<agg::pixfmt_gray8> > fin al_render(base_buf, path_rect.left, path_rect.top); 304 agg::renderer_scanline_aa_offset<agg::renderer_base<agg::pixfmt_gray8> > fin al_render(base_buf, path_rect.left, path_rect.top);
305 final_render.color(agg::gray8(255)); 305 final_render.color(agg::gray8(255));
306 agg::scanline_u8 scanline; 306 agg::scanline_u8 scanline;
307 agg::render_scanlines(rasterizer, scanline, final_render, (m_FillFlags & FXF ILL_NOPATHSMOOTH) != 0); 307 agg::render_scanlines(rasterizer, scanline, final_render, (m_FillFlags & FXF ILL_NOPATHSMOOTH) != 0);
308 m_pClipRgn->IntersectMaskF(path_rect.left, path_rect.top, mask); 308 m_pClipRgn->IntersectMaskF(path_rect.left, path_rect.top, mask);
309 } 309 }
310 FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, 310 bool CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData,
311 const CFX_AffineMatrix* pObject2Device, 311 const CFX_AffineMatrix* pObject2Device,
312 int fill_mode 312 int fill_mode
313 ) 313 )
314 { 314 {
315 m_FillFlags = fill_mode; 315 m_FillFlags = fill_mode;
316 if (m_pClipRgn == NULL) { 316 if (m_pClipRgn == NULL) {
317 m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceC aps(FXDC_PIXEL_HEIGHT)); 317 m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceC aps(FXDC_PIXEL_HEIGHT));
318 } 318 }
319 if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { 319 if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) {
320 CFX_FloatRect rectf; 320 CFX_FloatRect rectf;
321 if (pPathData->IsRect(pObject2Device, &rectf)) { 321 if (pPathData->IsRect(pObject2Device, &rectf)) {
322 rectf.Intersect(CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIX EL_WIDTH), (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); 322 rectf.Intersect(CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIX EL_WIDTH), (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
323 FX_RECT rect = rectf.GetOutterRect(); 323 FX_RECT rect = rectf.GetOutterRect();
324 m_pClipRgn->IntersectRect(rect); 324 m_pClipRgn->IntersectRect(rect);
325 return TRUE; 325 return true;
326 } 326 }
327 } 327 }
328 CAgg_PathData path_data; 328 CAgg_PathData path_data;
329 path_data.BuildPath(pPathData, pObject2Device); 329 path_data.BuildPath(pPathData, pObject2Device);
330 path_data.m_PathData.end_poly(); 330 path_data.m_PathData.end_poly();
331 agg::rasterizer_scanline_aa rasterizer; 331 agg::rasterizer_scanline_aa rasterizer;
332 rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); 332 rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
333 rasterizer.add_path(path_data.m_PathData); 333 rasterizer.add_path(path_data.m_PathData);
334 rasterizer.filling_rule((fill_mode & 3) == FXFILL_WINDING ? agg::fill_non_ze ro : agg::fill_even_odd); 334 rasterizer.filling_rule((fill_mode & 3) == FXFILL_WINDING ? agg::fill_non_ze ro : agg::fill_even_odd);
335 SetClipMask(rasterizer); 335 SetClipMask(rasterizer);
336 return TRUE; 336 return true;
337 } 337 }
338 FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, 338 bool CFX_AggDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData,
339 const CFX_AffineMatrix* pObject2Device, 339 const CFX_AffineMatrix* pObject2Device,
340 const CFX_GraphStateData* pGraphState 340 const CFX_GraphStateData* pGraphState
341 ) 341 )
342 { 342 {
343 if (m_pClipRgn == NULL) { 343 if (m_pClipRgn == NULL) {
344 m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceC aps(FXDC_PIXEL_HEIGHT)); 344 m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceC aps(FXDC_PIXEL_HEIGHT));
345 } 345 }
346 CAgg_PathData path_data; 346 CAgg_PathData path_data;
347 path_data.BuildPath(pPathData, NULL); 347 path_data.BuildPath(pPathData, NULL);
348 agg::rasterizer_scanline_aa rasterizer; 348 agg::rasterizer_scanline_aa rasterizer;
349 rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); 349 rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
350 RasterizeStroke(rasterizer, path_data.m_PathData, pObject2Device, pGraphStat e); 350 RasterizeStroke(rasterizer, path_data.m_PathData, pObject2Device, pGraphStat e);
351 rasterizer.filling_rule(agg::fill_non_zero); 351 rasterizer.filling_rule(agg::fill_non_zero);
352 SetClipMask(rasterizer); 352 SetClipMask(rasterizer);
353 return TRUE; 353 return true;
354 } 354 }
355 class CFX_Renderer 355 class CFX_Renderer
356 { 356 {
357 private: 357 private:
358 int m_Alpha, 358 int m_Alpha,
359 m_Red, 359 m_Red,
360 m_Green, 360 m_Green,
361 m_Blue, 361 m_Blue,
362 m_Gray; 362 m_Gray;
363 FX_DWORD m_Color; 363 FX_DWORD m_Color;
364 FX_BOOL» » m_bFullCover; 364 bool» » m_bFullCover;
365 FX_BOOL m_bRgbByteOrder; 365 bool m_bRgbByteOrder;
366 CFX_DIBitmap* m_pOriDevice; 366 CFX_DIBitmap* m_pOriDevice;
367 FX_RECT m_ClipBox; 367 FX_RECT m_ClipBox;
368 const CFX_DIBitmap* m_pClipMask; 368 const CFX_DIBitmap* m_pClipMask;
369 CFX_DIBitmap* m_pDevice; 369 CFX_DIBitmap* m_pDevice;
370 const CFX_ClipRgn* m_pClipRgn; 370 const CFX_ClipRgn* m_pClipRgn;
371 void (CFX_Renderer::*composite_span)(uint8_t*, int, int, int, uint8_t*, int, int, uint8_t*, uint8_t*); 371 void (CFX_Renderer::*composite_span)(uint8_t*, int, int, int, uint8_t*, int, int, uint8_t*, uint8_t*);
372 public: 372 public:
373 void prepare(unsigned) {} 373 void prepare(unsigned) {}
374 void CompositeSpan(uint8_t* dest_scan, uint8_t* ori_scan, int Bpp, FX_BOOL b DestAlpha, 374 void CompositeSpan(uint8_t* dest_scan, uint8_t* ori_scan, int Bpp, bool bDes tAlpha,
375 int span_left, int span_len, uint8_t* cover_scan, 375 int span_left, int span_len, uint8_t* cover_scan,
376 int clip_left, int clip_right, uint8_t* clip_scan) 376 int clip_left, int clip_right, uint8_t* clip_scan)
377 { 377 {
378 ASSERT(!m_pDevice->IsCmykImage()); 378 ASSERT(!m_pDevice->IsCmykImage());
379 int col_start = span_left < clip_left ? clip_left - span_left : 0; 379 int col_start = span_left < clip_left ? clip_left - span_left : 0;
380 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left); 380 int col_end = (span_left + span_len) < clip_right ? span_len : (clip_rig ht - span_left);
381 if (Bpp) { 381 if (Bpp) {
382 dest_scan += col_start * Bpp; 382 dest_scan += col_start * Bpp;
383 ori_scan += col_start * Bpp; 383 ori_scan += col_start * Bpp;
384 } else { 384 } else {
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 uint8_t* dest_scan_extra_alpha = NULL; 948 uint8_t* dest_scan_extra_alpha = NULL;
949 CFX_DIBitmap* pAlphaMask = m_pDevice->m_pAlphaMask; 949 CFX_DIBitmap* pAlphaMask = m_pDevice->m_pAlphaMask;
950 if (pAlphaMask) { 950 if (pAlphaMask) {
951 dest_scan_extra_alpha = pAlphaMask->GetBuffer() + pAlphaMask->GetPit ch() * y; 951 dest_scan_extra_alpha = pAlphaMask->GetBuffer() + pAlphaMask->GetPit ch() * y;
952 } 952 }
953 uint8_t* ori_scan = NULL; 953 uint8_t* ori_scan = NULL;
954 if (m_pOriDevice) { 954 if (m_pOriDevice) {
955 ori_scan = m_pOriDevice->GetBuffer() + m_pOriDevice->GetPitch() * y; 955 ori_scan = m_pOriDevice->GetBuffer() + m_pOriDevice->GetPitch() * y;
956 } 956 }
957 int Bpp = m_pDevice->GetBPP() / 8; 957 int Bpp = m_pDevice->GetBPP() / 8;
958 FX_BOOL bDestAlpha = m_pDevice->HasAlpha() || m_pDevice->IsAlphaMask(); 958 bool bDestAlpha = m_pDevice->HasAlpha() || m_pDevice->IsAlphaMask();
959 unsigned num_spans = sl.num_spans(); 959 unsigned num_spans = sl.num_spans();
960 typename Scanline::const_iterator span = sl.begin(); 960 typename Scanline::const_iterator span = sl.begin();
961 while (1) { 961 while (1) {
962 int x = span->x; 962 int x = span->x;
963 ASSERT(span->len > 0); 963 ASSERT(span->len > 0);
964 uint8_t* dest_pos = NULL; 964 uint8_t* dest_pos = NULL;
965 uint8_t* dest_extra_alpha_pos = NULL; 965 uint8_t* dest_extra_alpha_pos = NULL;
966 uint8_t* ori_pos = NULL; 966 uint8_t* ori_pos = NULL;
967 if (Bpp) { 967 if (Bpp) {
968 ori_pos = ori_scan ? ori_scan + x * Bpp : NULL; 968 ori_pos = ori_scan ? ori_scan + x * Bpp : NULL;
(...skipping 12 matching lines...) Expand all
981 } else { 981 } else {
982 (this->*composite_span)(dest_pos, Bpp, x, span->len, span->cover s, m_ClipBox.left, m_ClipBox.right, clip_pos, dest_extra_alpha_pos); 982 (this->*composite_span)(dest_pos, Bpp, x, span->len, span->cover s, m_ClipBox.left, m_ClipBox.right, clip_pos, dest_extra_alpha_pos);
983 } 983 }
984 if(--num_spans == 0) { 984 if(--num_spans == 0) {
985 break; 985 break;
986 } 986 }
987 ++span; 987 ++span;
988 } 988 }
989 } 989 }
990 990
991 FX_BOOL Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevice, const CFX_Clip Rgn* pClipRgn, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bRgbByteOrder, 991 bool Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevice, const CFX_ClipRgn * pClipRgn, FX_DWORD color, bool bFullCover, bool bRgbByteOrder,
992 int alpha_flag = 0, void* pIccTransform = NULL) 992 int alpha_flag = 0, void* pIccTransform = NULL)
993 { 993 {
994 m_pDevice = pDevice; 994 m_pDevice = pDevice;
995 m_pClipRgn = pClipRgn; 995 m_pClipRgn = pClipRgn;
996 composite_span = NULL; 996 composite_span = NULL;
997 m_bRgbByteOrder = bRgbByteOrder; 997 m_bRgbByteOrder = bRgbByteOrder;
998 m_pOriDevice = pOriDevice; 998 m_pOriDevice = pOriDevice;
999 if (m_pClipRgn) { 999 if (m_pClipRgn) {
1000 m_ClipBox = m_pClipRgn->GetBox(); 1000 m_ClipBox = m_pClipRgn->GetBox();
1001 } else { 1001 } else {
1002 m_ClipBox.left = m_ClipBox.top = 0; 1002 m_ClipBox.left = m_ClipBox.top = 0;
1003 m_ClipBox.right = m_pDevice->GetWidth(); 1003 m_ClipBox.right = m_pDevice->GetWidth();
1004 m_ClipBox.bottom = m_pDevice->GetHeight(); 1004 m_ClipBox.bottom = m_pDevice->GetHeight();
1005 } 1005 }
1006 m_pClipMask = NULL; 1006 m_pClipMask = NULL;
1007 if (m_pClipRgn && m_pClipRgn->GetType() == CFX_ClipRgn::MaskF) { 1007 if (m_pClipRgn && m_pClipRgn->GetType() == CFX_ClipRgn::MaskF) {
1008 m_pClipMask = m_pClipRgn->GetMask(); 1008 m_pClipMask = m_pClipRgn->GetMask();
1009 } 1009 }
1010 m_bFullCover = bFullCover; 1010 m_bFullCover = bFullCover;
1011 FX_BOOL bObjectCMYK = FXGETFLAG_COLORTYPE(alpha_flag); 1011 bool bObjectCMYK = FXGETFLAG_COLORTYPE(alpha_flag);
1012 FX_BOOL bDeviceCMYK = pDevice->IsCmykImage(); 1012 bool bDeviceCMYK = pDevice->IsCmykImage();
1013 m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(colo r); 1013 m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(colo r);
1014 ICodec_IccModule* pIccModule = NULL; 1014 ICodec_IccModule* pIccModule = NULL;
1015 if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetC odecModule()->GetIccModule()) { 1015 if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetC odecModule()->GetIccModule()) {
1016 pIccTransform = NULL; 1016 pIccTransform = NULL;
1017 } else { 1017 } else {
1018 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 1018 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
1019 } 1019 }
1020 if (m_pDevice->GetBPP() == 8) { 1020 if (m_pDevice->GetBPP() == 8) {
1021 ASSERT(!m_bRgbByteOrder); 1021 ASSERT(!m_bRgbByteOrder);
1022 composite_span = &CFX_Renderer::CompositeSpanGray; 1022 composite_span = &CFX_Renderer::CompositeSpanGray;
1023 if (m_pDevice->IsAlphaMask()) { 1023 if (m_pDevice->IsAlphaMask()) {
1024 m_Gray = 255; 1024 m_Gray = 255;
1025 } else { 1025 } else {
1026 if (pIccTransform) { 1026 if (pIccTransform) {
1027 uint8_t gray; 1027 uint8_t gray;
1028 color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(col or); 1028 color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(col or);
1029 pIccModule->TranslateScanline(pIccTransform, &gray, (const u int8_t*)&color, 1); 1029 pIccModule->TranslateScanline(pIccTransform, &gray, (const u int8_t*)&color, 1);
1030 m_Gray = gray; 1030 m_Gray = gray;
1031 } else { 1031 } else {
1032 if (bObjectCMYK) { 1032 if (bObjectCMYK) {
1033 uint8_t r, g, b; 1033 uint8_t r, g, b;
1034 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMVal ue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color), 1034 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMVal ue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color),
1035 r, g, b); 1035 r, g, b);
1036 m_Gray = FXRGB2GRAY(r, g, b); 1036 m_Gray = FXRGB2GRAY(r, g, b);
1037 } else { 1037 } else {
1038 m_Gray = FXRGB2GRAY(FXARGB_R(color), FXARGB_G(color), FX ARGB_B(color)); 1038 m_Gray = FXRGB2GRAY(FXARGB_R(color), FXARGB_G(color), FX ARGB_B(color));
1039 } 1039 }
1040 } 1040 }
1041 } 1041 }
1042 return TRUE; 1042 return true;
1043 } 1043 }
1044 if (bDeviceCMYK) { 1044 if (bDeviceCMYK) {
1045 ASSERT(!m_bRgbByteOrder); 1045 ASSERT(!m_bRgbByteOrder);
1046 composite_span = &CFX_Renderer::CompositeSpanCMYK; 1046 composite_span = &CFX_Renderer::CompositeSpanCMYK;
1047 if (bObjectCMYK) { 1047 if (bObjectCMYK) {
1048 m_Color = FXCMYK_TODIB(color); 1048 m_Color = FXCMYK_TODIB(color);
1049 if (pIccTransform) { 1049 if (pIccTransform) {
1050 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Co lor, (const uint8_t*)&m_Color, 1); 1050 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Co lor, (const uint8_t*)&m_Color, 1);
1051 } 1051 }
1052 } else { 1052 } else {
1053 if (!pIccTransform) { 1053 if (!pIccTransform) {
1054 return FALSE; 1054 return false;
1055 } 1055 }
1056 color = FXARGB_TODIB(color); 1056 color = FXARGB_TODIB(color);
1057 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1); 1057 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1);
1058 } 1058 }
1059 m_Red = ((uint8_t*)&m_Color)[0]; 1059 m_Red = ((uint8_t*)&m_Color)[0];
1060 m_Green = ((uint8_t*)&m_Color)[1]; 1060 m_Green = ((uint8_t*)&m_Color)[1];
1061 m_Blue = ((uint8_t*)&m_Color)[2]; 1061 m_Blue = ((uint8_t*)&m_Color)[2];
1062 m_Gray = ((uint8_t*)&m_Color)[3]; 1062 m_Gray = ((uint8_t*)&m_Color)[3];
1063 } else { 1063 } else {
1064 composite_span = (pDevice->GetFormat() == FXDIB_Argb) ? &CFX_Rendere r::CompositeSpanARGB : &CFX_Renderer::CompositeSpanRGB; 1064 composite_span = (pDevice->GetFormat() == FXDIB_Argb) ? &CFX_Rendere r::CompositeSpanARGB : &CFX_Renderer::CompositeSpanRGB;
(...skipping 28 matching lines...) Expand all
1093 } else { 1093 } else {
1094 m_Color = FXARGB_TODIB(color); 1094 m_Color = FXARGB_TODIB(color);
1095 } 1095 }
1096 ArgbDecode(color, m_Alpha, m_Red, m_Green, m_Blue); 1096 ArgbDecode(color, m_Alpha, m_Red, m_Green, m_Blue);
1097 } 1097 }
1098 } 1098 }
1099 } 1099 }
1100 if (m_pDevice->GetBPP() == 1) { 1100 if (m_pDevice->GetBPP() == 1) {
1101 composite_span = &CFX_Renderer::CompositeSpan1bpp; 1101 composite_span = &CFX_Renderer::CompositeSpan1bpp;
1102 } 1102 }
1103 return TRUE; 1103 return true;
1104 } 1104 }
1105 }; 1105 };
1106 FX_BOOL CFX_AggDeviceDriver::RenderRasterizer(agg::rasterizer_scanline_aa& raste rizer, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout, 1106 bool CFX_AggDeviceDriver::RenderRasterizer(agg::rasterizer_scanline_aa& rasteriz er, FX_DWORD color, bool bFullCover, bool bGroupKnockout,
1107 int alpha_flag, void* pIccTransform) 1107 int alpha_flag, void* pIccTransform)
1108 { 1108 {
1109 CFX_DIBitmap* pt = bGroupKnockout ? m_pOriDevice : NULL; 1109 CFX_DIBitmap* pt = bGroupKnockout ? m_pOriDevice : NULL;
1110 CFX_Renderer render; 1110 CFX_Renderer render;
1111 if (!render.Init(m_pBitmap, pt, m_pClipRgn, color, bFullCover, m_bRgbByteOrd er, alpha_flag, pIccTransform)) { 1111 if (!render.Init(m_pBitmap, pt, m_pClipRgn, color, bFullCover, m_bRgbByteOrd er, alpha_flag, pIccTransform)) {
1112 return FALSE; 1112 return false;
1113 } 1113 }
1114 agg::scanline_u8 scanline; 1114 agg::scanline_u8 scanline;
1115 agg::render_scanlines(rasterizer, scanline, render, (m_FillFlags & FXFILL_NO PATHSMOOTH) != 0); 1115 agg::render_scanlines(rasterizer, scanline, render, (m_FillFlags & FXFILL_NO PATHSMOOTH) != 0);
1116 return TRUE; 1116 return true;
1117 } 1117 }
1118 FX_BOOL»CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, 1118 bool» CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
1119 const CFX_AffineMatrix* pObject2Device, 1119 const CFX_AffineMatrix* pObject2Device,
1120 const CFX_GraphStateData* pGraphState, 1120 const CFX_GraphStateData* pGraphState,
1121 FX_DWORD fill_color, 1121 FX_DWORD fill_color,
1122 FX_DWORD stroke_color, 1122 FX_DWORD stroke_color,
1123 int fill_mode, 1123 int fill_mode,
1124 int alpha_flag, 1124 int alpha_flag,
1125 void* pIccTransform, 1125 void* pIccTransform,
1126 int blend_type 1126 int blend_type
1127 ) 1127 )
1128 { 1128 {
1129 if (blend_type != FXDIB_BLEND_NORMAL) { 1129 if (blend_type != FXDIB_BLEND_NORMAL) {
1130 return FALSE; 1130 return false;
1131 } 1131 }
1132 if (GetBuffer() == NULL) { 1132 if (GetBuffer() == NULL) {
1133 return TRUE; 1133 return true;
1134 } 1134 }
1135 m_FillFlags = fill_mode; 1135 m_FillFlags = fill_mode;
1136 if ((fill_mode & 3) && fill_color) { 1136 if ((fill_mode & 3) && fill_color) {
1137 CAgg_PathData path_data; 1137 CAgg_PathData path_data;
1138 path_data.BuildPath(pPathData, pObject2Device); 1138 path_data.BuildPath(pPathData, pObject2Device);
1139 agg::rasterizer_scanline_aa rasterizer; 1139 agg::rasterizer_scanline_aa rasterizer;
1140 rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDT H)), (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); 1140 rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDT H)), (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
1141 rasterizer.add_path(path_data.m_PathData); 1141 rasterizer.add_path(path_data.m_PathData);
1142 rasterizer.filling_rule((fill_mode & 3) == FXFILL_WINDING ? agg::fill_no n_zero : agg::fill_even_odd); 1142 rasterizer.filling_rule((fill_mode & 3) == FXFILL_WINDING ? agg::fill_no n_zero : agg::fill_even_odd);
1143 if (!RenderRasterizer(rasterizer, fill_color, fill_mode & FXFILL_FULLCOV ER, FALSE, alpha_flag, pIccTransform)) { 1143 if (!RenderRasterizer(rasterizer, fill_color, fill_mode & FXFILL_FULLCOV ER, false, alpha_flag, pIccTransform)) {
1144 return FALSE; 1144 return false;
1145 } 1145 }
1146 } 1146 }
1147 int stroke_alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_STROKE( alpha_flag) : FXARGB_A(stroke_color); 1147 int stroke_alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_STROKE( alpha_flag) : FXARGB_A(stroke_color);
1148 if (pGraphState && stroke_alpha) { 1148 if (pGraphState && stroke_alpha) {
1149 if (fill_mode & FX_ZEROAREA_FILL) { 1149 if (fill_mode & FX_ZEROAREA_FILL) {
1150 CAgg_PathData path_data; 1150 CAgg_PathData path_data;
1151 path_data.BuildPath(pPathData, pObject2Device); 1151 path_data.BuildPath(pPathData, pObject2Device);
1152 agg::rasterizer_scanline_aa rasterizer; 1152 agg::rasterizer_scanline_aa rasterizer;
1153 rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_ WIDTH)), (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); 1153 rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_ WIDTH)), (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
1154 RasterizeStroke(rasterizer, path_data.m_PathData, NULL, pGraphState, 1, FALSE, fill_mode & FX_STROKE_TEXT_MODE); 1154 RasterizeStroke(rasterizer, path_data.m_PathData, NULL, pGraphState, 1, false, fill_mode & FX_STROKE_TEXT_MODE);
1155 int fill_flag = FXGETFLAG_COLORTYPE(alpha_flag) << 8 | FXGETFLAG_ALP HA_STROKE(alpha_flag); 1155 int fill_flag = FXGETFLAG_COLORTYPE(alpha_flag) << 8 | FXGETFLAG_ALP HA_STROKE(alpha_flag);
1156 if (!RenderRasterizer(rasterizer, stroke_color, fill_mode & FXFILL_F ULLCOVER, m_bGroupKnockout, fill_flag, pIccTransform)) { 1156 if (!RenderRasterizer(rasterizer, stroke_color, fill_mode & FXFILL_F ULLCOVER, m_bGroupKnockout, fill_flag, pIccTransform)) {
1157 return FALSE; 1157 return false;
1158 } 1158 }
1159 return TRUE; 1159 return true;
1160 } 1160 }
1161 CFX_AffineMatrix matrix1, matrix2; 1161 CFX_AffineMatrix matrix1, matrix2;
1162 if (pObject2Device) { 1162 if (pObject2Device) {
1163 matrix1.a = FX_MAX(FXSYS_fabs(pObject2Device->a), FXSYS_fabs(pObject 2Device->b)); 1163 matrix1.a = FX_MAX(FXSYS_fabs(pObject2Device->a), FXSYS_fabs(pObject 2Device->b));
1164 matrix1.d = matrix1.a; 1164 matrix1.d = matrix1.a;
1165 matrix2.Set(pObject2Device->a / matrix1.a, pObject2Device->b / matri x1.a, 1165 matrix2.Set(pObject2Device->a / matrix1.a, pObject2Device->b / matri x1.a,
1166 pObject2Device->c / matrix1.d, pObject2Device->d / matri x1.d, 1166 pObject2Device->c / matrix1.d, pObject2Device->d / matri x1.d,
1167 0, 0); 1167 0, 0);
1168 CFX_AffineMatrix mtRervese; 1168 CFX_AffineMatrix mtRervese;
1169 mtRervese.SetReverse(matrix2); 1169 mtRervese.SetReverse(matrix2);
1170 matrix1 = *pObject2Device; 1170 matrix1 = *pObject2Device;
1171 matrix1.Concat(mtRervese); 1171 matrix1.Concat(mtRervese);
1172 } 1172 }
1173 CAgg_PathData path_data; 1173 CAgg_PathData path_data;
1174 path_data.BuildPath(pPathData, &matrix1); 1174 path_data.BuildPath(pPathData, &matrix1);
1175 agg::rasterizer_scanline_aa rasterizer; 1175 agg::rasterizer_scanline_aa rasterizer;
1176 rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDT H)), (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); 1176 rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDT H)), (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
1177 RasterizeStroke(rasterizer, path_data.m_PathData, &matrix2, pGraphState, matrix1.a, FALSE, fill_mode & FX_STROKE_TEXT_MODE); 1177 RasterizeStroke(rasterizer, path_data.m_PathData, &matrix2, pGraphState, matrix1.a, false, fill_mode & FX_STROKE_TEXT_MODE);
1178 int fill_flag = FXGETFLAG_COLORTYPE(alpha_flag) << 8 | FXGETFLAG_ALPHA_S TROKE(alpha_flag); 1178 int fill_flag = FXGETFLAG_COLORTYPE(alpha_flag) << 8 | FXGETFLAG_ALPHA_S TROKE(alpha_flag);
1179 if (!RenderRasterizer(rasterizer, stroke_color, fill_mode & FXFILL_FULLC OVER, m_bGroupKnockout, fill_flag, pIccTransform)) { 1179 if (!RenderRasterizer(rasterizer, stroke_color, fill_mode & FXFILL_FULLC OVER, m_bGroupKnockout, fill_flag, pIccTransform)) {
1180 return FALSE; 1180 return false;
1181 } 1181 }
1182 } 1182 }
1183 return TRUE; 1183 return true;
1184 } 1184 }
1185 void RgbByteOrderSetPixel(CFX_DIBitmap* pBitmap, int x, int y, FX_DWORD argb) 1185 void RgbByteOrderSetPixel(CFX_DIBitmap* pBitmap, int x, int y, FX_DWORD argb)
1186 { 1186 {
1187 if (x < 0 || x >= pBitmap->GetWidth() || y < 0 || y >= pBitmap->GetHeight()) { 1187 if (x < 0 || x >= pBitmap->GetWidth() || y < 0 || y >= pBitmap->GetHeight()) {
1188 return; 1188 return;
1189 } 1189 }
1190 uint8_t* pos = (uint8_t*)pBitmap->GetBuffer() + y * pBitmap->GetPitch() + x * pBitmap->GetBPP() / 8; 1190 uint8_t* pos = (uint8_t*)pBitmap->GetBuffer() + y * pBitmap->GetPitch() + x * pBitmap->GetBPP() / 8;
1191 if (pBitmap->GetFormat() == FXDIB_Argb) { 1191 if (pBitmap->GetFormat() == FXDIB_Argb) {
1192 FXARGB_SETRGBORDERDIB(pos, ArgbGamma(argb)); 1192 FXARGB_SETRGBORDERDIB(pos, ArgbGamma(argb));
1193 } else { 1193 } else {
1194 int alpha = FXARGB_A(argb); 1194 int alpha = FXARGB_A(argb);
1195 pos[0] = (FXARGB_R(argb) * alpha + pos[0] * (255 - alpha)) / 255; 1195 pos[0] = (FXARGB_R(argb) * alpha + pos[0] * (255 - alpha)) / 255;
1196 pos[1] = (FXARGB_G(argb) * alpha + pos[1] * (255 - alpha)) / 255; 1196 pos[1] = (FXARGB_G(argb) * alpha + pos[1] * (255 - alpha)) / 255;
1197 pos[2] = (FXARGB_B(argb) * alpha + pos[2] * (255 - alpha)) / 255; 1197 pos[2] = (FXARGB_B(argb) * alpha + pos[2] * (255 - alpha)) / 255;
1198 } 1198 }
1199 } 1199 }
1200 void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap, int left, int top, int wid th, int height, FX_ARGB argb) 1200 void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap, int left, int top, int wid th, int height, FX_ARGB argb)
1201 { 1201 {
1202 int src_alpha = FXARGB_A(argb); 1202 int src_alpha = FXARGB_A(argb);
1203 if (src_alpha == 0) { 1203 if (src_alpha == 0) {
1204 return; 1204 return;
1205 } 1205 }
1206 FX_RECT rect(left, top, left + width, top + height); 1206 FX_RECT rect(left, top, left + width, top + height);
1207 rect.Intersect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight()); 1207 rect.Intersect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight());
1208 width = rect.Width(); 1208 width = rect.Width();
1209 int src_r = FXARGB_R(argb), src_g = FXARGB_G(argb), src_b = FXARGB_B(argb); 1209 int src_r = FXARGB_R(argb), src_g = FXARGB_G(argb), src_b = FXARGB_B(argb);
1210 int Bpp = pBitmap->GetBPP() / 8; 1210 int Bpp = pBitmap->GetBPP() / 8;
1211 FX_BOOL bAlpha = pBitmap->HasAlpha(); 1211 bool bAlpha = pBitmap->HasAlpha();
1212 int dib_argb = FXARGB_TOBGRORDERDIB(argb); 1212 int dib_argb = FXARGB_TOBGRORDERDIB(argb);
1213 uint8_t* pBuffer = pBitmap->GetBuffer(); 1213 uint8_t* pBuffer = pBitmap->GetBuffer();
1214 if (src_alpha == 255) { 1214 if (src_alpha == 255) {
1215 for (int row = rect.top; row < rect.bottom; row ++) { 1215 for (int row = rect.top; row < rect.bottom; row ++) {
1216 uint8_t* dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp; 1216 uint8_t* dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp;
1217 if (Bpp == 4) { 1217 if (Bpp == 4) {
1218 FX_DWORD* scan = (FX_DWORD*)dest_scan; 1218 FX_DWORD* scan = (FX_DWORD*)dest_scan;
1219 for (int col = 0; col < width; col ++) { 1219 for (int col = 0; col < width; col ++) {
1220 *scan ++ = dib_argb; 1220 *scan ++ = dib_argb;
1221 } 1221 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 uint8_t* dest_scan = dest_buf + row * pitch; 1310 uint8_t* dest_scan = dest_buf + row * pitch;
1311 uint8_t* src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 4; 1311 uint8_t* src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
1312 for (int col = 0; col < width; col ++) { 1312 for (int col = 0; col < width; col ++) {
1313 *dest_scan++ = src_scan[2]; 1313 *dest_scan++ = src_scan[2];
1314 *dest_scan++ = src_scan[1]; 1314 *dest_scan++ = src_scan[1];
1315 *dest_scan++ = src_scan[0]; 1315 *dest_scan++ = src_scan[0];
1316 src_scan += 4; 1316 src_scan += 4;
1317 } 1317 }
1318 } 1318 }
1319 } else { 1319 } else {
1320 ASSERT(FALSE); 1320 ASSERT(false);
1321 } 1321 }
1322 } else if (dest_format == FXDIB_Argb || dest_format == FXDIB_Rgb32) { 1322 } else if (dest_format == FXDIB_Argb || dest_format == FXDIB_Rgb32) {
1323 if (src_format == FXDIB_Rgb) { 1323 if (src_format == FXDIB_Rgb) {
1324 for (int row = 0; row < height; row ++) { 1324 for (int row = 0; row < height; row ++) {
1325 uint8_t* dest_scan = (uint8_t*)(dest_buf + row * pitch); 1325 uint8_t* dest_scan = (uint8_t*)(dest_buf + row * pitch);
1326 uint8_t* src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 3; 1326 uint8_t* src_scan = (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 3;
1327 if (src_format == FXDIB_Argb) { 1327 if (src_format == FXDIB_Argb) {
1328 for (int col = 0; col < width; col ++) { 1328 for (int col = 0; col < width; col ++) {
1329 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, FX_GAMMA(src_ scan[0]), FX_GAMMA(src_scan[1]), FX_GAMMA(src_scan[2]))); 1329 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, FX_GAMMA(src_ scan[0]), FX_GAMMA(src_scan[1]), FX_GAMMA(src_scan[2])));
1330 dest_scan += 4; 1330 dest_scan += 4;
(...skipping 13 matching lines...) Expand all
1344 uint8_t* dest_scan = dest_buf + row * pitch; 1344 uint8_t* dest_scan = dest_buf + row * pitch;
1345 uint8_t* src_scan = (uint8_t*)(pSrcBitmap->GetScanline(src_top + row) + src_left * 4); 1345 uint8_t* src_scan = (uint8_t*)(pSrcBitmap->GetScanline(src_top + row) + src_left * 4);
1346 for (int col = 0; col < width; col++) { 1346 for (int col = 0; col < width; col++) {
1347 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_ scan[1], src_scan[2])); 1347 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_ scan[1], src_scan[2]));
1348 src_scan += 4; 1348 src_scan += 4;
1349 dest_scan += 4; 1349 dest_scan += 4;
1350 } 1350 }
1351 } 1351 }
1352 } 1352 }
1353 } else { 1353 } else {
1354 ASSERT(FALSE); 1354 ASSERT(false);
1355 } 1355 }
1356 } 1356 }
1357 FX_ARGB _DefaultCMYK2ARGB(FX_CMYK cmyk, uint8_t alpha) 1357 FX_ARGB _DefaultCMYK2ARGB(FX_CMYK cmyk, uint8_t alpha)
1358 { 1358 {
1359 uint8_t r, g, b; 1359 uint8_t r, g, b;
1360 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), FXSYS_GetYV alue(cmyk), FXSYS_GetKValue(cmyk), 1360 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), FXSYS_GetYV alue(cmyk), FXSYS_GetKValue(cmyk),
1361 r, g, b); 1361 r, g, b);
1362 return ArgbEncode(alpha, r, g, b); 1362 return ArgbEncode(alpha, r, g, b);
1363 } 1363 }
1364 FX_BOOL _DibSetPixel(CFX_DIBitmap* pDevice, int x, int y, FX_DWORD color, int al pha_flag, void* pIccTransform) 1364 bool _DibSetPixel(CFX_DIBitmap* pDevice, int x, int y, FX_DWORD color, int alpha _flag, void* pIccTransform)
1365 { 1365 {
1366 FX_BOOL bObjCMYK = FXGETFLAG_COLORTYPE(alpha_flag); 1366 bool bObjCMYK = FXGETFLAG_COLORTYPE(alpha_flag);
1367 int alpha = bObjCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); 1367 int alpha = bObjCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color);
1368 if (pIccTransform) { 1368 if (pIccTransform) {
1369 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->Ge tIccModule(); 1369 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->Ge tIccModule();
1370 color = bObjCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); 1370 color = bObjCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
1371 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&color, (uint8_t* )&color, 1); 1371 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&color, (uint8_t* )&color, 1);
1372 color = bObjCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); 1372 color = bObjCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
1373 if (!pDevice->IsCmykImage()) { 1373 if (!pDevice->IsCmykImage()) {
1374 color = (color & 0xffffff) | (alpha << 24); 1374 color = (color & 0xffffff) | (alpha << 24);
1375 } 1375 }
1376 } else { 1376 } else {
1377 if (pDevice->IsCmykImage()) { 1377 if (pDevice->IsCmykImage()) {
1378 if (!bObjCMYK) { 1378 if (!bObjCMYK) {
1379 return FALSE; 1379 return false;
1380 } 1380 }
1381 } else { 1381 } else {
1382 if (bObjCMYK) { 1382 if (bObjCMYK) {
1383 color = _DefaultCMYK2ARGB(color, alpha); 1383 color = _DefaultCMYK2ARGB(color, alpha);
1384 } 1384 }
1385 } 1385 }
1386 } 1386 }
1387 pDevice->SetPixel(x, y, color); 1387 pDevice->SetPixel(x, y, color);
1388 if (pDevice->m_pAlphaMask) { 1388 if (pDevice->m_pAlphaMask) {
1389 pDevice->m_pAlphaMask->SetPixel(x, y, alpha << 24); 1389 pDevice->m_pAlphaMask->SetPixel(x, y, alpha << 24);
1390 } 1390 }
1391 return TRUE; 1391 return true;
1392 } 1392 }
1393 FX_BOOL CFX_AggDeviceDriver::SetPixel(int x, int y, FX_DWORD color, int alpha_fl ag, void* pIccTransform) 1393 bool CFX_AggDeviceDriver::SetPixel(int x, int y, FX_DWORD color, int alpha_flag, void* pIccTransform)
1394 { 1394 {
1395 if (m_pBitmap->GetBuffer() == NULL) { 1395 if (m_pBitmap->GetBuffer() == NULL) {
1396 return TRUE; 1396 return true;
1397 } 1397 }
1398 if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodec Module()->GetIccModule()) { 1398 if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodec Module()->GetIccModule()) {
1399 pIccTransform = NULL; 1399 pIccTransform = NULL;
1400 } 1400 }
1401 if (m_pClipRgn == NULL) { 1401 if (m_pClipRgn == NULL) {
1402 if (m_bRgbByteOrder) { 1402 if (m_bRgbByteOrder) {
1403 RgbByteOrderSetPixel(m_pBitmap, x, y, color); 1403 RgbByteOrderSetPixel(m_pBitmap, x, y, color);
1404 } else { 1404 } else {
1405 return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTransfor m); 1405 return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTransfor m);
1406 } 1406 }
1407 } else if (m_pClipRgn->GetBox().Contains(x, y)) { 1407 } else if (m_pClipRgn->GetBox().Contains(x, y)) {
1408 if (m_pClipRgn->GetType() == CFX_ClipRgn::RectI) { 1408 if (m_pClipRgn->GetType() == CFX_ClipRgn::RectI) {
1409 if (m_bRgbByteOrder) { 1409 if (m_bRgbByteOrder) {
1410 RgbByteOrderSetPixel(m_pBitmap, x, y, color); 1410 RgbByteOrderSetPixel(m_pBitmap, x, y, color);
1411 } else { 1411 } else {
1412 return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTran sform); 1412 return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTran sform);
1413 } 1413 }
1414 } else if (m_pClipRgn->GetType() == CFX_ClipRgn::MaskF) { 1414 } else if (m_pClipRgn->GetType() == CFX_ClipRgn::MaskF) {
1415 const CFX_DIBitmap* pMask = m_pClipRgn->GetMask(); 1415 const CFX_DIBitmap* pMask = m_pClipRgn->GetMask();
1416 FX_BOOL bCMYK = FXGETFLAG_COLORTYPE(alpha_flag); 1416 bool bCMYK = FXGETFLAG_COLORTYPE(alpha_flag);
1417 int new_alpha = bCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A( color); 1417 int new_alpha = bCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A( color);
1418 new_alpha = new_alpha * pMask->GetScanline(y)[x] / 255; 1418 new_alpha = new_alpha * pMask->GetScanline(y)[x] / 255;
1419 if (m_bRgbByteOrder) { 1419 if (m_bRgbByteOrder) {
1420 RgbByteOrderSetPixel(m_pBitmap, x, y, (color & 0xffffff) | (new_ alpha << 24)); 1420 RgbByteOrderSetPixel(m_pBitmap, x, y, (color & 0xffffff) | (new_ alpha << 24));
1421 return TRUE; 1421 return true;
1422 } 1422 }
1423 if (bCMYK) { 1423 if (bCMYK) {
1424 FXSETFLAG_ALPHA_FILL(alpha_flag, new_alpha); 1424 FXSETFLAG_ALPHA_FILL(alpha_flag, new_alpha);
1425 } else { 1425 } else {
1426 color = (color & 0xffffff) | (new_alpha << 24); 1426 color = (color & 0xffffff) | (new_alpha << 24);
1427 } 1427 }
1428 return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTransfor m); 1428 return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTransfor m);
1429 } 1429 }
1430 } 1430 }
1431 return TRUE; 1431 return true;
1432 } 1432 }
1433 FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, int alpha_flag, void* pIccTransform, int blend_type) 1433 bool CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect, FX_DWORD fill_color, in t alpha_flag, void* pIccTransform, int blend_type)
1434 { 1434 {
1435 if (blend_type != FXDIB_BLEND_NORMAL) { 1435 if (blend_type != FXDIB_BLEND_NORMAL) {
1436 return FALSE; 1436 return false;
1437 } 1437 }
1438 if (m_pBitmap->GetBuffer() == NULL) { 1438 if (m_pBitmap->GetBuffer() == NULL) {
1439 return TRUE; 1439 return true;
1440 } 1440 }
1441 FX_RECT clip_rect; 1441 FX_RECT clip_rect;
1442 GetClipBox(&clip_rect); 1442 GetClipBox(&clip_rect);
1443 FX_RECT draw_rect = clip_rect; 1443 FX_RECT draw_rect = clip_rect;
1444 if (pRect) { 1444 if (pRect) {
1445 draw_rect.Intersect(*pRect); 1445 draw_rect.Intersect(*pRect);
1446 } 1446 }
1447 if (draw_rect.IsEmpty()) { 1447 if (draw_rect.IsEmpty()) {
1448 return TRUE; 1448 return true;
1449 } 1449 }
1450 if (m_pClipRgn == NULL || m_pClipRgn->GetType() == CFX_ClipRgn::RectI) { 1450 if (m_pClipRgn == NULL || m_pClipRgn->GetType() == CFX_ClipRgn::RectI) {
1451 if (m_bRgbByteOrder) { 1451 if (m_bRgbByteOrder) {
1452 RgbByteOrderCompositeRect(m_pBitmap, draw_rect.left, draw_rect.top, draw_rect.Width(), draw_rect.Height(), fill_color); 1452 RgbByteOrderCompositeRect(m_pBitmap, draw_rect.left, draw_rect.top, draw_rect.Width(), draw_rect.Height(), fill_color);
1453 } else { 1453 } else {
1454 m_pBitmap->CompositeRect(draw_rect.left, draw_rect.top, draw_rect.Wi dth(), draw_rect.Height(), fill_color, alpha_flag, pIccTransform); 1454 m_pBitmap->CompositeRect(draw_rect.left, draw_rect.top, draw_rect.Wi dth(), draw_rect.Height(), fill_color, alpha_flag, pIccTransform);
1455 } 1455 }
1456 return TRUE; 1456 return true;
1457 } 1457 }
1458 m_pBitmap->CompositeMask(draw_rect.left, draw_rect.top, draw_rect.Width(), d raw_rect.Height(), (const CFX_DIBitmap*)m_pClipRgn->GetMask(), 1458 m_pBitmap->CompositeMask(draw_rect.left, draw_rect.top, draw_rect.Width(), d raw_rect.Height(), (const CFX_DIBitmap*)m_pClipRgn->GetMask(),
1459 fill_color, draw_rect.left - clip_rect.left, draw_r ect.top - clip_rect.top, FXDIB_BLEND_NORMAL, NULL, m_bRgbByteOrder, alpha_flag, pIccTransform); 1459 fill_color, draw_rect.left - clip_rect.left, draw_r ect.top - clip_rect.top, FXDIB_BLEND_NORMAL, NULL, m_bRgbByteOrder, alpha_flag, pIccTransform);
1460 return TRUE; 1460 return true;
1461 } 1461 }
1462 FX_BOOL CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect) 1462 bool CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect)
1463 { 1463 {
1464 if (m_pClipRgn == NULL) { 1464 if (m_pClipRgn == NULL) {
1465 pRect->left = pRect->top = 0; 1465 pRect->left = pRect->top = 0;
1466 pRect->right = GetDeviceCaps(FXDC_PIXEL_WIDTH); 1466 pRect->right = GetDeviceCaps(FXDC_PIXEL_WIDTH);
1467 pRect->bottom = GetDeviceCaps(FXDC_PIXEL_HEIGHT); 1467 pRect->bottom = GetDeviceCaps(FXDC_PIXEL_HEIGHT);
1468 return TRUE; 1468 return true;
1469 } 1469 }
1470 *pRect = m_pClipRgn->GetBox(); 1470 *pRect = m_pClipRgn->GetBox();
1471 return TRUE; 1471 return true;
1472 } 1472 }
1473 FX_BOOL»CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform, FX_BOOL bDEdge) 1473 bool» CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform, bool bDEdge)
1474 { 1474 {
1475 if (m_pBitmap->GetBuffer() == NULL) { 1475 if (m_pBitmap->GetBuffer() == NULL) {
1476 return TRUE; 1476 return true;
1477 } 1477 }
1478 if (bDEdge) { 1478 if (bDEdge) {
1479 if (m_bRgbByteOrder) { 1479 if (m_bRgbByteOrder) {
1480 RgbByteOrderTransferBitmap(pBitmap, 0, 0, pBitmap->GetWidth(), pBitm ap->GetHeight(), m_pBitmap, left, top); 1480 RgbByteOrderTransferBitmap(pBitmap, 0, 0, pBitmap->GetWidth(), pBitm ap->GetHeight(), m_pBitmap, left, top);
1481 } else { 1481 } else {
1482 return pBitmap->TransferBitmap(0, 0, pBitmap->GetWidth(), pBitmap->G etHeight(), m_pBitmap, left, top, pIccTransform); 1482 return pBitmap->TransferBitmap(0, 0, pBitmap->GetWidth(), pBitmap->G etHeight(), m_pBitmap, left, top, pIccTransform);
1483 } 1483 }
1484 return TRUE; 1484 return true;
1485 } 1485 }
1486 FX_RECT rect(left, top, left + pBitmap->GetWidth(), top + pBitmap->GetHeight ()); 1486 FX_RECT rect(left, top, left + pBitmap->GetWidth(), top + pBitmap->GetHeight ());
1487 CFX_DIBitmap *pBack = NULL; 1487 CFX_DIBitmap *pBack = NULL;
1488 if (m_pOriDevice) { 1488 if (m_pOriDevice) {
1489 pBack = m_pOriDevice->Clone(&rect); 1489 pBack = m_pOriDevice->Clone(&rect);
1490 if (!pBack) { 1490 if (!pBack) {
1491 return TRUE; 1491 return true;
1492 } 1492 }
1493 pBack->CompositeBitmap(0, 0, pBack->GetWidth(), pBack->GetHeight(), m_pB itmap, 0, 0); 1493 pBack->CompositeBitmap(0, 0, pBack->GetWidth(), pBack->GetHeight(), m_pB itmap, 0, 0);
1494 } else { 1494 } else {
1495 pBack = m_pBitmap->Clone(&rect); 1495 pBack = m_pBitmap->Clone(&rect);
1496 } 1496 }
1497 if (!pBack) { 1497 if (!pBack) {
1498 return TRUE; 1498 return true;
1499 } 1499 }
1500 FX_BOOL bRet = TRUE; 1500 bool bRet = true;
1501 left = left >= 0 ? 0 : left; 1501 left = left >= 0 ? 0 : left;
1502 top = top >= 0 ? 0 : top; 1502 top = top >= 0 ? 0 : top;
1503 if (m_bRgbByteOrder) { 1503 if (m_bRgbByteOrder) {
1504 RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(), p Back, left, top); 1504 RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(), p Back, left, top);
1505 } else { 1505 } else {
1506 bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack, left, top, pIccTransform); 1506 bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack, left, top, pIccTransform);
1507 } 1507 }
1508 delete pBack; 1508 delete pBack;
1509 return bRet; 1509 return bRet;
1510 } 1510 }
1511 FX_BOOL»CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD ar gb, const FX_RECT* pSrcRect, int left, int top, int blend_type, 1511 bool» CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD ar gb, const FX_RECT* pSrcRect, int left, int top, int blend_type,
1512 int alpha_flag, void* pIccTransform) 1512 int alpha_flag, void* pIccTransform)
1513 { 1513 {
1514 if (m_pBitmap->GetBuffer() == NULL) { 1514 if (m_pBitmap->GetBuffer() == NULL) {
1515 return TRUE; 1515 return true;
1516 } 1516 }
1517 if (pBitmap->IsAlphaMask()) 1517 if (pBitmap->IsAlphaMask())
1518 return m_pBitmap->CompositeMask(left, top, pSrcRect->Width(), pSrcRect-> Height(), pBitmap, argb, 1518 return m_pBitmap->CompositeMask(left, top, pSrcRect->Width(), pSrcRect-> Height(), pBitmap, argb,
1519 pSrcRect->left, pSrcRect->top, blend_typ e, m_pClipRgn, m_bRgbByteOrder, alpha_flag, pIccTransform); 1519 pSrcRect->left, pSrcRect->top, blend_typ e, m_pClipRgn, m_bRgbByteOrder, alpha_flag, pIccTransform);
1520 return m_pBitmap->CompositeBitmap(left, top, pSrcRect->Width(), pSrcRect->He ight(), pBitmap, 1520 return m_pBitmap->CompositeBitmap(left, top, pSrcRect->Width(), pSrcRect->He ight(), pBitmap,
1521 pSrcRect->left, pSrcRect->top, blend_type, m_pClipRgn, m_bRgbByteOrder, pIccTransform); 1521 pSrcRect->left, pSrcRect->top, blend_type, m_pClipRgn, m_bRgbByteOrder, pIccTransform);
1522 } 1522 }
1523 FX_BOOL»CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWOR D argb, int dest_left, int dest_top, 1523 bool» CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWOR D argb, int dest_left, int dest_top,
1524 int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flag s, 1524 int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flag s,
1525 int alpha_flag, void* pIccTransform, int blend_type) 1525 int alpha_flag, void* pIccTransform, int blend_type)
1526 { 1526 {
1527 if (m_pBitmap->GetBuffer() == NULL) { 1527 if (m_pBitmap->GetBuffer() == NULL) {
1528 return TRUE; 1528 return true;
1529 } 1529 }
1530 if (dest_width == pSource->GetWidth() && dest_height == pSource->GetHeight() ) { 1530 if (dest_width == pSource->GetWidth() && dest_height == pSource->GetHeight() ) {
1531 FX_RECT rect(0, 0, dest_width, dest_height); 1531 FX_RECT rect(0, 0, dest_width, dest_height);
1532 return SetDIBits(pSource, argb, &rect, dest_left, dest_top, blend_type, alpha_flag, pIccTransform); 1532 return SetDIBits(pSource, argb, &rect, dest_left, dest_top, blend_type, alpha_flag, pIccTransform);
1533 } 1533 }
1534 FX_RECT dest_rect(dest_left, dest_top, dest_left + dest_width, dest_top + de st_height); 1534 FX_RECT dest_rect(dest_left, dest_top, dest_left + dest_width, dest_top + de st_height);
1535 dest_rect.Normalize(); 1535 dest_rect.Normalize();
1536 FX_RECT dest_clip = dest_rect; 1536 FX_RECT dest_clip = dest_rect;
1537 dest_clip.Intersect(*pClipRect); 1537 dest_clip.Intersect(*pClipRect);
1538 CFX_BitmapComposer composer; 1538 CFX_BitmapComposer composer;
1539 composer.Compose(m_pBitmap, m_pClipRgn, 255, argb, dest_clip, FALSE, FALSE, FALSE, m_bRgbByteOrder, alpha_flag, pIccTransform, blend_type); 1539 composer.Compose(m_pBitmap, m_pClipRgn, 255, argb, dest_clip, false, false, false, m_bRgbByteOrder, alpha_flag, pIccTransform, blend_type);
1540 dest_clip.Offset(-dest_rect.left, -dest_rect.top); 1540 dest_clip.Offset(-dest_rect.left, -dest_rect.top);
1541 CFX_ImageStretcher stretcher; 1541 CFX_ImageStretcher stretcher;
1542 if (stretcher.Start(&composer, pSource, dest_width, dest_height, dest_clip, flags)) { 1542 if (stretcher.Start(&composer, pSource, dest_width, dest_height, dest_clip, flags)) {
1543 stretcher.Continue(NULL); 1543 stretcher.Continue(NULL);
1544 } 1544 }
1545 return TRUE; 1545 return true;
1546 } 1546 }
1547 FX_BOOL»CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitma p_alpha, FX_DWORD argb, 1547 bool» CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitma p_alpha, FX_DWORD argb,
1548 const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle, 1548 const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle,
1549 int alpha_flag, void* pIccTransform, int blend_type) 1549 int alpha_flag, void* pIccTransform, int blend_type)
1550 { 1550 {
1551 if (m_pBitmap->GetBuffer() == NULL) { 1551 if (m_pBitmap->GetBuffer() == NULL) {
1552 return TRUE; 1552 return true;
1553 } 1553 }
1554 CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer; 1554 CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer;
1555 pRenderer->Start(m_pBitmap, m_pClipRgn, pSource, bitmap_alpha, argb, pMatrix , render_flags, m_bRgbByteOrder, alpha_flag, pIccTransform); 1555 pRenderer->Start(m_pBitmap, m_pClipRgn, pSource, bitmap_alpha, argb, pMatrix , render_flags, m_bRgbByteOrder, alpha_flag, pIccTransform);
1556 handle = pRenderer; 1556 handle = pRenderer;
1557 return TRUE; 1557 return true;
1558 } 1558 }
1559 FX_BOOL»CFX_AggDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) 1559 bool» CFX_AggDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause)
1560 { 1560 {
1561 if (m_pBitmap->GetBuffer() == NULL) { 1561 if (m_pBitmap->GetBuffer() == NULL) {
1562 return TRUE; 1562 return true;
1563 } 1563 }
1564 return ((CFX_ImageRenderer*)pHandle)->Continue(pPause); 1564 return ((CFX_ImageRenderer*)pHandle)->Continue(pPause);
1565 } 1565 }
1566 void CFX_AggDeviceDriver::CancelDIBits(void* pHandle) 1566 void CFX_AggDeviceDriver::CancelDIBits(void* pHandle)
1567 { 1567 {
1568 if (m_pBitmap->GetBuffer() == NULL) { 1568 if (m_pBitmap->GetBuffer() == NULL) {
1569 return; 1569 return;
1570 } 1570 }
1571 delete (CFX_ImageRenderer*)pHandle; 1571 delete (CFX_ImageRenderer*)pHandle;
1572 } 1572 }
1573 CFX_FxgeDevice::CFX_FxgeDevice() 1573 CFX_FxgeDevice::CFX_FxgeDevice()
1574 { 1574 {
1575 m_bOwnedBitmap = FALSE; 1575 m_bOwnedBitmap = false;
1576 } 1576 }
1577 FX_BOOL CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL b RgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) 1577 bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, int dither_bits, bool bRgbByt eOrder, CFX_DIBitmap* pOriDevice, bool bGroupKnockout)
1578 { 1578 {
1579 if (pBitmap == NULL) { 1579 if (pBitmap == NULL) {
1580 return FALSE; 1580 return false;
1581 } 1581 }
1582 SetBitmap(pBitmap); 1582 SetBitmap(pBitmap);
1583 IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(pBitmap, dither_bi ts, bRgbByteOrder, pOriDevice, bGroupKnockout); 1583 IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(pBitmap, dither_bi ts, bRgbByteOrder, pOriDevice, bGroupKnockout);
1584 SetDeviceDriver(pDriver); 1584 SetDeviceDriver(pDriver);
1585 return TRUE; 1585 return true;
1586 } 1586 }
1587 FX_BOOL CFX_FxgeDevice::Create(int width, int height, FXDIB_Format format, int d ither_bits, CFX_DIBitmap* pOriDevice) 1587 bool CFX_FxgeDevice::Create(int width, int height, FXDIB_Format format, int dith er_bits, CFX_DIBitmap* pOriDevice)
1588 { 1588 {
1589 m_bOwnedBitmap = TRUE; 1589 m_bOwnedBitmap = true;
1590 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; 1590 CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
1591 if (!pBitmap->Create(width, height, format)) { 1591 if (!pBitmap->Create(width, height, format)) {
1592 delete pBitmap; 1592 delete pBitmap;
1593 return FALSE; 1593 return false;
1594 } 1594 }
1595 SetBitmap(pBitmap); 1595 SetBitmap(pBitmap);
1596 IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(pBitmap, dither_bi ts, FALSE, pOriDevice, FALSE); 1596 IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(pBitmap, dither_bi ts, false, pOriDevice, false);
1597 SetDeviceDriver(pDriver); 1597 SetDeviceDriver(pDriver);
1598 return TRUE; 1598 return true;
1599 } 1599 }
1600 CFX_FxgeDevice::~CFX_FxgeDevice() 1600 CFX_FxgeDevice::~CFX_FxgeDevice()
1601 { 1601 {
1602 if (m_bOwnedBitmap) { 1602 if (m_bOwnedBitmap) {
1603 delete GetBitmap(); 1603 delete GetBitmap();
1604 } 1604 }
1605 } 1605 }
OLDNEW
« no previous file with comments | « core/src/fxge/agg/include/fx_agg_driver.h ('k') | core/src/fxge/android/fpf_skiafont.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698