OLD | NEW |
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/fxge/include/fx_ge.h" | 7 #include "core/fxge/include/fx_ge.h" |
8 | 8 |
9 CFX_RenderDevice::CFX_RenderDevice() { | 9 CFX_RenderDevice::CFX_RenderDevice() { |
10 m_pDeviceDriver = NULL; | 10 m_pDeviceDriver = NULL; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 void CFX_RenderDevice::UpdateClipBox() { | 105 void CFX_RenderDevice::UpdateClipBox() { |
106 if (m_pDeviceDriver->GetClipBox(&m_ClipBox)) { | 106 if (m_pDeviceDriver->GetClipBox(&m_ClipBox)) { |
107 return; | 107 return; |
108 } | 108 } |
109 m_ClipBox.left = 0; | 109 m_ClipBox.left = 0; |
110 m_ClipBox.top = 0; | 110 m_ClipBox.top = 0; |
111 m_ClipBox.right = m_Width; | 111 m_ClipBox.right = m_Width; |
112 m_ClipBox.bottom = m_Height; | 112 m_ClipBox.bottom = m_Height; |
113 } | 113 } |
114 | 114 |
115 FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData, | 115 FX_BOOL CFX_RenderDevice::DrawPathWithBlend( |
116 const CFX_Matrix* pObject2Device, | 116 const CFX_PathData* pPathData, |
117 const CFX_GraphStateData* pGraphState, | 117 const CFX_Matrix* pObject2Device, |
118 uint32_t fill_color, | 118 const CFX_GraphStateData* pGraphState, |
119 uint32_t stroke_color, | 119 uint32_t fill_color, |
120 int fill_mode, | 120 uint32_t stroke_color, |
121 int alpha_flag, | 121 int fill_mode, |
122 void* pIccTransform, | 122 int blend_type) { |
123 int blend_type) { | 123 uint8_t stroke_alpha = pGraphState ? FXARGB_A(stroke_color) : 0; |
124 uint8_t fill_alpha, stroke_alpha; | 124 uint8_t fill_alpha = (fill_mode & 3) ? FXARGB_A(fill_color) : 0; |
125 if (FXGETFLAG_COLORTYPE(alpha_flag)) { | |
126 fill_alpha = FXGETFLAG_ALPHA_FILL(alpha_flag); | |
127 stroke_alpha = FXGETFLAG_ALPHA_STROKE(alpha_flag); | |
128 } else { | |
129 fill_alpha = FXARGB_A(fill_color); | |
130 stroke_alpha = FXARGB_A(stroke_color); | |
131 } | |
132 if ((fill_mode & 3) == 0) { | |
133 fill_alpha = 0; | |
134 } | |
135 if (!pGraphState) { | |
136 stroke_alpha = 0; | |
137 } | |
138 if (stroke_alpha == 0 && pPathData->GetPointCount() == 2) { | 125 if (stroke_alpha == 0 && pPathData->GetPointCount() == 2) { |
139 FX_PATHPOINT* pPoints = pPathData->GetPoints(); | 126 FX_PATHPOINT* pPoints = pPathData->GetPoints(); |
140 FX_FLOAT x1, x2, y1, y2; | 127 FX_FLOAT x1, x2, y1, y2; |
141 if (pObject2Device) { | 128 if (pObject2Device) { |
142 pObject2Device->Transform(pPoints[0].m_PointX, pPoints[0].m_PointY, x1, | 129 pObject2Device->Transform(pPoints[0].m_PointX, pPoints[0].m_PointY, x1, |
143 y1); | 130 y1); |
144 pObject2Device->Transform(pPoints[1].m_PointX, pPoints[1].m_PointY, x2, | 131 pObject2Device->Transform(pPoints[1].m_PointX, pPoints[1].m_PointY, x2, |
145 y2); | 132 y2); |
146 } else { | 133 } else { |
147 x1 = pPoints[0].m_PointX; | 134 x1 = pPoints[0].m_PointX; |
148 y1 = pPoints[0].m_PointY; | 135 y1 = pPoints[0].m_PointY; |
149 x2 = pPoints[1].m_PointX; | 136 x2 = pPoints[1].m_PointX; |
150 y2 = pPoints[1].m_PointY; | 137 y2 = pPoints[1].m_PointY; |
151 } | 138 } |
152 DrawCosmeticLine(x1, y1, x2, y2, fill_color, fill_mode, alpha_flag, | 139 DrawCosmeticLineWithFillModeAndBlend(x1, y1, x2, y2, fill_color, fill_mode, |
153 pIccTransform, blend_type); | 140 blend_type); |
154 return TRUE; | 141 return TRUE; |
155 } | 142 } |
156 if ((pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) && | 143 if ((pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) && |
157 stroke_alpha == 0) { | 144 stroke_alpha == 0) { |
158 CFX_FloatRect rect_f; | 145 CFX_FloatRect rect_f; |
159 if (!(fill_mode & FXFILL_RECT_AA) && | 146 if (!(fill_mode & FXFILL_RECT_AA) && |
160 pPathData->IsRect(pObject2Device, &rect_f)) { | 147 pPathData->IsRect(pObject2Device, &rect_f)) { |
161 FX_RECT rect_i = rect_f.GetOutterRect(); | 148 FX_RECT rect_i = rect_f.GetOutterRect(); |
162 int width = (int)FXSYS_ceil(rect_f.right - rect_f.left); | 149 int width = (int)FXSYS_ceil(rect_f.right - rect_f.left); |
163 if (width < 1) { | 150 if (width < 1) { |
(...skipping 18 matching lines...) Expand all Loading... |
182 } | 169 } |
183 } | 170 } |
184 if (rect_i.Height() >= height + 1) { | 171 if (rect_i.Height() >= height + 1) { |
185 if (rect_f.top - (FX_FLOAT)(rect_i.top) > | 172 if (rect_f.top - (FX_FLOAT)(rect_i.top) > |
186 (FX_FLOAT)(rect_i.bottom) - rect_f.bottom) { | 173 (FX_FLOAT)(rect_i.bottom) - rect_f.bottom) { |
187 rect_i.top++; | 174 rect_i.top++; |
188 } else { | 175 } else { |
189 rect_i.bottom--; | 176 rect_i.bottom--; |
190 } | 177 } |
191 } | 178 } |
192 if (FillRect(&rect_i, fill_color, alpha_flag, pIccTransform, | 179 if (FillRectWithBlend(&rect_i, fill_color, blend_type)) { |
193 blend_type)) { | |
194 return TRUE; | 180 return TRUE; |
195 } | 181 } |
196 } | 182 } |
197 } | 183 } |
198 if ((fill_mode & 3) && stroke_alpha == 0 && !(fill_mode & FX_FILL_STROKE) && | 184 if ((fill_mode & 3) && stroke_alpha == 0 && !(fill_mode & FX_FILL_STROKE) && |
199 !(fill_mode & FX_FILL_TEXT_MODE)) { | 185 !(fill_mode & FX_FILL_TEXT_MODE)) { |
200 CFX_PathData newPath; | 186 CFX_PathData newPath; |
201 FX_BOOL bThin = FALSE; | 187 FX_BOOL bThin = FALSE; |
202 if (pPathData->GetZeroAreaPath(newPath, (CFX_Matrix*)pObject2Device, bThin, | 188 if (pPathData->GetZeroAreaPath(newPath, (CFX_Matrix*)pObject2Device, bThin, |
203 m_pDeviceDriver->GetDriverType())) { | 189 m_pDeviceDriver->GetDriverType())) { |
204 CFX_GraphStateData graphState; | 190 CFX_GraphStateData graphState; |
205 graphState.m_LineWidth = 0.0f; | 191 graphState.m_LineWidth = 0.0f; |
206 uint32_t strokecolor = fill_color; | 192 uint32_t strokecolor = fill_color; |
207 if (bThin) { | 193 if (bThin) { |
208 if (FXGETFLAG_COLORTYPE(alpha_flag)) { | 194 strokecolor = (((fill_alpha >> 2) << 24) | (strokecolor & 0x00ffffff)); |
209 FXSETFLAG_ALPHA_STROKE(alpha_flag, fill_alpha >> 2); | |
210 } else { | |
211 strokecolor = | |
212 (((fill_alpha >> 2) << 24) | (strokecolor & 0x00ffffff)); | |
213 } | |
214 } | 195 } |
215 CFX_Matrix* pMatrix = NULL; | 196 CFX_Matrix* pMatrix = NULL; |
216 if (pObject2Device && !pObject2Device->IsIdentity()) { | 197 if (pObject2Device && !pObject2Device->IsIdentity()) { |
217 pMatrix = (CFX_Matrix*)pObject2Device; | 198 pMatrix = (CFX_Matrix*)pObject2Device; |
218 } | 199 } |
219 int smooth_path = FX_ZEROAREA_FILL; | 200 int smooth_path = FX_ZEROAREA_FILL; |
220 if (fill_mode & FXFILL_NOPATHSMOOTH) { | 201 if (fill_mode & FXFILL_NOPATHSMOOTH) { |
221 smooth_path |= FXFILL_NOPATHSMOOTH; | 202 smooth_path |= FXFILL_NOPATHSMOOTH; |
222 } | 203 } |
223 m_pDeviceDriver->DrawPath(&newPath, pMatrix, &graphState, 0, strokecolor, | 204 m_pDeviceDriver->DrawPath(&newPath, pMatrix, &graphState, 0, strokecolor, |
224 smooth_path, alpha_flag, pIccTransform, | 205 smooth_path, 0, nullptr, blend_type); |
225 blend_type); | |
226 } | 206 } |
227 } | 207 } |
228 if ((fill_mode & 3) && fill_alpha && stroke_alpha < 0xff && | 208 if ((fill_mode & 3) && fill_alpha && stroke_alpha < 0xff && |
229 (fill_mode & FX_FILL_STROKE)) { | 209 (fill_mode & FX_FILL_STROKE)) { |
230 if (m_RenderCaps & FXRC_FILLSTROKE_PATH) { | 210 if (m_RenderCaps & FXRC_FILLSTROKE_PATH) { |
231 return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState, | 211 return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState, |
232 fill_color, stroke_color, fill_mode, | 212 fill_color, stroke_color, fill_mode, 0, |
233 alpha_flag, pIccTransform, blend_type); | 213 nullptr, blend_type); |
234 } | 214 } |
235 return DrawFillStrokePath(pPathData, pObject2Device, pGraphState, | 215 return DrawFillStrokePath(pPathData, pObject2Device, pGraphState, |
236 fill_color, stroke_color, fill_mode, alpha_flag, | 216 fill_color, stroke_color, fill_mode, blend_type); |
237 pIccTransform, blend_type); | |
238 } | 217 } |
239 return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState, | 218 return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState, |
240 fill_color, stroke_color, fill_mode, | 219 fill_color, stroke_color, fill_mode, 0, |
241 alpha_flag, pIccTransform, blend_type); | 220 nullptr, blend_type); |
242 } | 221 } |
243 | 222 |
244 // This can be removed once PDFium entirely relies on Skia | 223 // This can be removed once PDFium entirely relies on Skia |
245 FX_BOOL CFX_RenderDevice::DrawFillStrokePath( | 224 FX_BOOL CFX_RenderDevice::DrawFillStrokePath( |
246 const CFX_PathData* pPathData, | 225 const CFX_PathData* pPathData, |
247 const CFX_Matrix* pObject2Device, | 226 const CFX_Matrix* pObject2Device, |
248 const CFX_GraphStateData* pGraphState, | 227 const CFX_GraphStateData* pGraphState, |
249 uint32_t fill_color, | 228 uint32_t fill_color, |
250 uint32_t stroke_color, | 229 uint32_t stroke_color, |
251 int fill_mode, | 230 int fill_mode, |
252 int alpha_flag, | |
253 void* pIccTransform, | |
254 int blend_type) { | 231 int blend_type) { |
255 if (!(m_RenderCaps & FXRC_GET_BITS)) { | 232 if (!(m_RenderCaps & FXRC_GET_BITS)) { |
256 return FALSE; | 233 return FALSE; |
257 } | 234 } |
258 CFX_FloatRect bbox; | 235 CFX_FloatRect bbox; |
259 if (pGraphState) { | 236 if (pGraphState) { |
260 bbox = pPathData->GetBoundingBox(pGraphState->m_LineWidth, | 237 bbox = pPathData->GetBoundingBox(pGraphState->m_LineWidth, |
261 pGraphState->m_MiterLimit); | 238 pGraphState->m_MiterLimit); |
262 } else { | 239 } else { |
263 bbox = pPathData->GetBoundingBox(); | 240 bbox = pPathData->GetBoundingBox(); |
(...skipping 22 matching lines...) Expand all Loading... |
286 CFX_FxgeDevice bitmap_device; | 263 CFX_FxgeDevice bitmap_device; |
287 bitmap_device.Attach(&bitmap, 0, FALSE, &Backdrop, TRUE); | 264 bitmap_device.Attach(&bitmap, 0, FALSE, &Backdrop, TRUE); |
288 CFX_Matrix matrix; | 265 CFX_Matrix matrix; |
289 if (pObject2Device) { | 266 if (pObject2Device) { |
290 matrix = *pObject2Device; | 267 matrix = *pObject2Device; |
291 } | 268 } |
292 matrix.TranslateI(-rect.left, -rect.top); | 269 matrix.TranslateI(-rect.left, -rect.top); |
293 matrix.Concat(fScaleX, 0, 0, fScaleY, 0, 0); | 270 matrix.Concat(fScaleX, 0, 0, fScaleY, 0, 0); |
294 if (!bitmap_device.GetDeviceDriver()->DrawPath( | 271 if (!bitmap_device.GetDeviceDriver()->DrawPath( |
295 pPathData, &matrix, pGraphState, fill_color, stroke_color, | 272 pPathData, &matrix, pGraphState, fill_color, stroke_color, |
296 fill_mode, alpha_flag, pIccTransform, blend_type)) { | 273 fill_mode, 0, nullptr, blend_type)) { |
297 return FALSE; | 274 return FALSE; |
298 } | 275 } |
299 FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX), | 276 FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX), |
300 FXSYS_round(rect.Height() * fScaleY)); | 277 FXSYS_round(rect.Height() * fScaleY)); |
301 return m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, rect.left, | 278 return m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, rect.left, |
302 rect.top, FXDIB_BLEND_NORMAL); | 279 rect.top, FXDIB_BLEND_NORMAL); |
303 } | 280 } |
304 | 281 |
305 FX_BOOL CFX_RenderDevice::SetPixel(int x, | 282 FX_BOOL CFX_RenderDevice::SetPixel(int x, int y, uint32_t color) { |
306 int y, | 283 if (m_pDeviceDriver->SetPixel(x, y, color, 0, nullptr)) |
307 uint32_t color, | |
308 int alpha_flag, | |
309 void* pIccTransform) { | |
310 if (m_pDeviceDriver->SetPixel(x, y, color, alpha_flag, pIccTransform)) { | |
311 return TRUE; | 284 return TRUE; |
312 } | 285 |
313 FX_RECT rect(x, y, x + 1, y + 1); | 286 FX_RECT rect(x, y, x + 1, y + 1); |
314 return FillRect(&rect, color, alpha_flag, pIccTransform); | 287 return FillRectWithBlend(&rect, color, FXDIB_BLEND_NORMAL); |
315 } | 288 } |
316 FX_BOOL CFX_RenderDevice::FillRect(const FX_RECT* pRect, | 289 |
317 uint32_t fill_color, | 290 FX_BOOL CFX_RenderDevice::FillRectWithBlend(const FX_RECT* pRect, |
318 int alpha_flag, | 291 uint32_t fill_color, |
319 void* pIccTransform, | 292 int blend_type) { |
320 int blend_type) { | 293 if (m_pDeviceDriver->FillRect(pRect, fill_color, 0, nullptr, blend_type)) |
321 if (m_pDeviceDriver->FillRect(pRect, fill_color, alpha_flag, pIccTransform, | |
322 blend_type)) { | |
323 return TRUE; | 294 return TRUE; |
324 } | 295 |
325 if (!(m_RenderCaps & FXRC_GET_BITS)) { | 296 if (!(m_RenderCaps & FXRC_GET_BITS)) |
326 return FALSE; | 297 return FALSE; |
327 } | 298 |
328 CFX_DIBitmap bitmap; | 299 CFX_DIBitmap bitmap; |
329 if (!CreateCompatibleBitmap(&bitmap, pRect->Width(), pRect->Height())) { | 300 if (!CreateCompatibleBitmap(&bitmap, pRect->Width(), pRect->Height())) |
330 return FALSE; | 301 return FALSE; |
331 } | 302 |
332 if (!m_pDeviceDriver->GetDIBits(&bitmap, pRect->left, pRect->top)) { | 303 if (!m_pDeviceDriver->GetDIBits(&bitmap, pRect->left, pRect->top)) |
333 return FALSE; | 304 return FALSE; |
334 } | 305 |
335 if (!bitmap.CompositeRect(0, 0, pRect->Width(), pRect->Height(), fill_color, | 306 if (!bitmap.CompositeRect(0, 0, pRect->Width(), pRect->Height(), fill_color, |
336 alpha_flag, pIccTransform)) { | 307 0, nullptr)) { |
337 return FALSE; | 308 return FALSE; |
338 } | 309 } |
339 FX_RECT src_rect(0, 0, pRect->Width(), pRect->Height()); | 310 FX_RECT src_rect(0, 0, pRect->Width(), pRect->Height()); |
340 m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, pRect->left, pRect->top, | 311 m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, pRect->left, pRect->top, |
341 FXDIB_BLEND_NORMAL); | 312 FXDIB_BLEND_NORMAL); |
342 return TRUE; | 313 return TRUE; |
343 } | 314 } |
344 FX_BOOL CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1, | 315 |
345 FX_FLOAT y1, | 316 FX_BOOL CFX_RenderDevice::DrawCosmeticLineWithFillModeAndBlend(FX_FLOAT x1, |
346 FX_FLOAT x2, | 317 FX_FLOAT y1, |
347 FX_FLOAT y2, | 318 FX_FLOAT x2, |
348 uint32_t color, | 319 FX_FLOAT y2, |
349 int fill_mode, | 320 uint32_t color, |
350 int alpha_flag, | 321 int fill_mode, |
351 void* pIccTransform, | 322 int blend_type) { |
352 int blend_type) { | 323 if ((color >= 0xff000000) && |
353 if (((m_RenderCaps & FXRC_ALPHA_PATH) && | 324 m_pDeviceDriver->DrawCosmeticLine(x1, y1, x2, y2, color, 0, nullptr, |
354 (FXGETFLAG_COLORTYPE(alpha_flag) && | 325 blend_type)) { |
355 FXGETFLAG_ALPHA_FILL(alpha_flag) == 0xff)) || | 326 return TRUE; |
356 color >= 0xff000000) { | |
357 if (m_pDeviceDriver->DrawCosmeticLine(x1, y1, x2, y2, color, alpha_flag, | |
358 pIccTransform, blend_type)) { | |
359 return TRUE; | |
360 } | |
361 } | 327 } |
362 CFX_GraphStateData graph_state; | 328 CFX_GraphStateData graph_state; |
363 CFX_PathData path; | 329 CFX_PathData path; |
364 path.SetPointCount(2); | 330 path.SetPointCount(2); |
365 path.SetPoint(0, x1, y1, FXPT_MOVETO); | 331 path.SetPoint(0, x1, y1, FXPT_MOVETO); |
366 path.SetPoint(1, x2, y2, FXPT_LINETO); | 332 path.SetPoint(1, x2, y2, FXPT_LINETO); |
367 return m_pDeviceDriver->DrawPath(&path, NULL, &graph_state, 0, color, | 333 return m_pDeviceDriver->DrawPath(&path, nullptr, &graph_state, 0, color, |
368 fill_mode, alpha_flag, pIccTransform, | 334 fill_mode, 0, nullptr, blend_type); |
369 blend_type); | |
370 } | 335 } |
371 FX_BOOL CFX_RenderDevice::GetDIBits(CFX_DIBitmap* pBitmap, | 336 |
372 int left, | 337 FX_BOOL CFX_RenderDevice::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) { |
373 int top, | 338 if (!(m_RenderCaps & FXRC_GET_BITS)) |
374 void* pIccTransform) { | |
375 if (!(m_RenderCaps & FXRC_GET_BITS)) { | |
376 return FALSE; | 339 return FALSE; |
377 } | 340 return m_pDeviceDriver->GetDIBits(pBitmap, left, top, nullptr); |
378 return m_pDeviceDriver->GetDIBits(pBitmap, left, top, pIccTransform); | |
379 } | 341 } |
| 342 |
380 CFX_DIBitmap* CFX_RenderDevice::GetBackDrop() { | 343 CFX_DIBitmap* CFX_RenderDevice::GetBackDrop() { |
381 return m_pDeviceDriver->GetBackDrop(); | 344 return m_pDeviceDriver->GetBackDrop(); |
382 } | 345 } |
383 FX_BOOL CFX_RenderDevice::SetDIBits(const CFX_DIBSource* pBitmap, | 346 |
384 int left, | 347 FX_BOOL CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap, |
385 int top, | 348 int left, |
386 int blend_mode, | 349 int top, |
387 void* pIccTransform) { | 350 int blend_mode) { |
388 ASSERT(!pBitmap->IsAlphaMask()); | 351 ASSERT(!pBitmap->IsAlphaMask()); |
389 CFX_Matrix ctm = GetCTM(); | 352 CFX_Matrix ctm = GetCTM(); |
390 FX_FLOAT fScaleX = FXSYS_fabs(ctm.a); | 353 FX_FLOAT fScaleX = FXSYS_fabs(ctm.a); |
391 FX_FLOAT fScaleY = FXSYS_fabs(ctm.d); | 354 FX_FLOAT fScaleY = FXSYS_fabs(ctm.d); |
392 FX_RECT dest_rect(left, top, | 355 FX_RECT dest_rect(left, top, |
393 FXSYS_round(left + pBitmap->GetWidth() / fScaleX), | 356 FXSYS_round(left + pBitmap->GetWidth() / fScaleX), |
394 FXSYS_round(top + pBitmap->GetHeight() / fScaleY)); | 357 FXSYS_round(top + pBitmap->GetHeight() / fScaleY)); |
395 dest_rect.Intersect(m_ClipBox); | 358 dest_rect.Intersect(m_ClipBox); |
396 if (dest_rect.IsEmpty()) { | 359 if (dest_rect.IsEmpty()) { |
397 return TRUE; | 360 return TRUE; |
(...skipping 17 matching lines...) Expand all Loading... |
415 bg_pixel_width, bg_pixel_height, | 378 bg_pixel_width, bg_pixel_height, |
416 (m_RenderCaps & FXRC_CMYK_OUTPUT) ? FXDIB_Cmyk : FXDIB_Rgb32)) { | 379 (m_RenderCaps & FXRC_CMYK_OUTPUT) ? FXDIB_Cmyk : FXDIB_Rgb32)) { |
417 return FALSE; | 380 return FALSE; |
418 } | 381 } |
419 if (!m_pDeviceDriver->GetDIBits(&background, dest_rect.left, | 382 if (!m_pDeviceDriver->GetDIBits(&background, dest_rect.left, |
420 dest_rect.top)) { | 383 dest_rect.top)) { |
421 return FALSE; | 384 return FALSE; |
422 } | 385 } |
423 if (!background.CompositeBitmap(0, 0, bg_pixel_width, bg_pixel_height, | 386 if (!background.CompositeBitmap(0, 0, bg_pixel_width, bg_pixel_height, |
424 pBitmap, src_rect.left, src_rect.top, | 387 pBitmap, src_rect.left, src_rect.top, |
425 blend_mode, NULL, FALSE, pIccTransform)) { | 388 blend_mode, nullptr, FALSE, nullptr)) { |
426 return FALSE; | 389 return FALSE; |
427 } | 390 } |
428 FX_RECT src_rect(0, 0, bg_pixel_width, bg_pixel_height); | 391 FX_RECT src_rect(0, 0, bg_pixel_width, bg_pixel_height); |
429 return m_pDeviceDriver->SetDIBits(&background, 0, &src_rect, dest_rect.left, | 392 return m_pDeviceDriver->SetDIBits(&background, 0, &src_rect, dest_rect.left, |
430 dest_rect.top, FXDIB_BLEND_NORMAL); | 393 dest_rect.top, FXDIB_BLEND_NORMAL); |
431 } | 394 } |
432 return m_pDeviceDriver->SetDIBits(pBitmap, 0, &src_rect, dest_rect.left, | 395 return m_pDeviceDriver->SetDIBits(pBitmap, 0, &src_rect, dest_rect.left, |
433 dest_rect.top, blend_mode, 0, | 396 dest_rect.top, blend_mode, 0, nullptr); |
434 pIccTransform); | |
435 } | 397 } |
436 FX_BOOL CFX_RenderDevice::StretchDIBits(const CFX_DIBSource* pBitmap, | 398 |
437 int left, | 399 FX_BOOL CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend( |
438 int top, | 400 const CFX_DIBSource* pBitmap, |
439 int dest_width, | 401 int left, |
440 int dest_height, | 402 int top, |
441 uint32_t flags, | 403 int dest_width, |
442 void* pIccTransform, | 404 int dest_height, |
443 int blend_mode) { | 405 uint32_t flags, |
| 406 int blend_mode) { |
444 FX_RECT dest_rect(left, top, left + dest_width, top + dest_height); | 407 FX_RECT dest_rect(left, top, left + dest_width, top + dest_height); |
445 FX_RECT clip_box = m_ClipBox; | 408 FX_RECT clip_box = m_ClipBox; |
446 clip_box.Intersect(dest_rect); | 409 clip_box.Intersect(dest_rect); |
447 if (clip_box.IsEmpty()) { | 410 if (clip_box.IsEmpty()) |
448 return TRUE; | 411 return TRUE; |
449 } | |
450 return m_pDeviceDriver->StretchDIBits(pBitmap, 0, left, top, dest_width, | 412 return m_pDeviceDriver->StretchDIBits(pBitmap, 0, left, top, dest_width, |
451 dest_height, &clip_box, flags, 0, | 413 dest_height, &clip_box, flags, 0, |
452 pIccTransform, blend_mode); | 414 nullptr, blend_mode); |
453 } | 415 } |
| 416 |
454 FX_BOOL CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap, | 417 FX_BOOL CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap, |
455 int left, | 418 int left, |
456 int top, | 419 int top, |
457 uint32_t argb, | 420 uint32_t argb) { |
458 int alpha_flag, | |
459 void* pIccTransform) { | |
460 FX_RECT src_rect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight()); | 421 FX_RECT src_rect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight()); |
461 return m_pDeviceDriver->SetDIBits(pBitmap, argb, &src_rect, left, top, | 422 return m_pDeviceDriver->SetDIBits(pBitmap, argb, &src_rect, left, top, |
462 FXDIB_BLEND_NORMAL, alpha_flag, | 423 FXDIB_BLEND_NORMAL, 0, nullptr); |
463 pIccTransform); | |
464 } | 424 } |
465 FX_BOOL CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap, | 425 |
466 int left, | 426 FX_BOOL CFX_RenderDevice::StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap, |
467 int top, | 427 int left, |
468 int dest_width, | 428 int top, |
469 int dest_height, | 429 int dest_width, |
470 uint32_t argb, | 430 int dest_height, |
471 uint32_t flags, | 431 uint32_t argb, |
472 int alpha_flag, | 432 uint32_t flags) { |
473 void* pIccTransform) { | |
474 FX_RECT dest_rect(left, top, left + dest_width, top + dest_height); | 433 FX_RECT dest_rect(left, top, left + dest_width, top + dest_height); |
475 FX_RECT clip_box = m_ClipBox; | 434 FX_RECT clip_box = m_ClipBox; |
476 clip_box.Intersect(dest_rect); | 435 clip_box.Intersect(dest_rect); |
477 return m_pDeviceDriver->StretchDIBits(pBitmap, argb, left, top, dest_width, | 436 return m_pDeviceDriver->StretchDIBits(pBitmap, argb, left, top, dest_width, |
478 dest_height, &clip_box, flags, | 437 dest_height, &clip_box, flags, 0, |
479 alpha_flag, pIccTransform); | 438 nullptr); |
480 } | 439 } |
481 FX_BOOL CFX_RenderDevice::StartDIBits(const CFX_DIBSource* pBitmap, | 440 |
482 int bitmap_alpha, | 441 FX_BOOL CFX_RenderDevice::StartDIBitsWithBlend(const CFX_DIBSource* pBitmap, |
483 uint32_t argb, | 442 int bitmap_alpha, |
484 const CFX_Matrix* pMatrix, | 443 uint32_t argb, |
485 uint32_t flags, | 444 const CFX_Matrix* pMatrix, |
486 void*& handle, | 445 uint32_t flags, |
487 int alpha_flag, | 446 void*& handle, |
488 void* pIccTransform, | 447 int blend_mode) { |
489 int blend_mode) { | |
490 return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix, | 448 return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix, |
491 flags, handle, alpha_flag, pIccTransform, | 449 flags, handle, 0, nullptr, blend_mode); |
492 blend_mode); | |
493 } | 450 } |
| 451 |
494 FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) { | 452 FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) { |
495 return m_pDeviceDriver->ContinueDIBits(handle, pPause); | 453 return m_pDeviceDriver->ContinueDIBits(handle, pPause); |
496 } | 454 } |
| 455 |
497 void CFX_RenderDevice::CancelDIBits(void* handle) { | 456 void CFX_RenderDevice::CancelDIBits(void* handle) { |
498 m_pDeviceDriver->CancelDIBits(handle); | 457 m_pDeviceDriver->CancelDIBits(handle); |
499 } | 458 } |
OLD | NEW |