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

Side by Side Diff: core/fxge/ge/fx_ge_device.cpp

Issue 2059883004: Remove default arguments from IFX_RenderDeviceDriver. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 6 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/fxge/apple/fx_quartz_device.cpp ('k') | core/fxge/ge/fx_ge_text.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/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 = nullptr; 10 m_pDeviceDriver = nullptr;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 CFX_Matrix* pMatrix = nullptr; 196 CFX_Matrix* pMatrix = nullptr;
197 if (pObject2Device && !pObject2Device->IsIdentity()) { 197 if (pObject2Device && !pObject2Device->IsIdentity()) {
198 pMatrix = (CFX_Matrix*)pObject2Device; 198 pMatrix = (CFX_Matrix*)pObject2Device;
199 } 199 }
200 int smooth_path = FX_ZEROAREA_FILL; 200 int smooth_path = FX_ZEROAREA_FILL;
201 if (fill_mode & FXFILL_NOPATHSMOOTH) { 201 if (fill_mode & FXFILL_NOPATHSMOOTH) {
202 smooth_path |= FXFILL_NOPATHSMOOTH; 202 smooth_path |= FXFILL_NOPATHSMOOTH;
203 } 203 }
204 m_pDeviceDriver->DrawPath(&newPath, pMatrix, &graphState, 0, strokecolor, 204 m_pDeviceDriver->DrawPath(&newPath, pMatrix, &graphState, 0, strokecolor,
205 smooth_path, 0, nullptr, blend_type); 205 smooth_path, blend_type);
206 } 206 }
207 } 207 }
208 if ((fill_mode & 3) && fill_alpha && stroke_alpha < 0xff && 208 if ((fill_mode & 3) && fill_alpha && stroke_alpha < 0xff &&
209 (fill_mode & FX_FILL_STROKE)) { 209 (fill_mode & FX_FILL_STROKE)) {
210 if (m_RenderCaps & FXRC_FILLSTROKE_PATH) { 210 if (m_RenderCaps & FXRC_FILLSTROKE_PATH) {
211 return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState, 211 return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState,
212 fill_color, stroke_color, fill_mode, 0, 212 fill_color, stroke_color, fill_mode,
213 nullptr, blend_type); 213 blend_type);
214 } 214 }
215 return DrawFillStrokePath(pPathData, pObject2Device, pGraphState, 215 return DrawFillStrokePath(pPathData, pObject2Device, pGraphState,
216 fill_color, stroke_color, fill_mode, blend_type); 216 fill_color, stroke_color, fill_mode, blend_type);
217 } 217 }
218 return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState, 218 return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState,
219 fill_color, stroke_color, fill_mode, 0, 219 fill_color, stroke_color, fill_mode,
220 nullptr, blend_type); 220 blend_type);
221 } 221 }
222 222
223 // This can be removed once PDFium entirely relies on Skia 223 // This can be removed once PDFium entirely relies on Skia
224 FX_BOOL CFX_RenderDevice::DrawFillStrokePath( 224 FX_BOOL CFX_RenderDevice::DrawFillStrokePath(
225 const CFX_PathData* pPathData, 225 const CFX_PathData* pPathData,
226 const CFX_Matrix* pObject2Device, 226 const CFX_Matrix* pObject2Device,
227 const CFX_GraphStateData* pGraphState, 227 const CFX_GraphStateData* pGraphState,
228 uint32_t fill_color, 228 uint32_t fill_color,
229 uint32_t stroke_color, 229 uint32_t stroke_color,
230 int fill_mode, 230 int fill_mode,
(...skipping 17 matching lines...) Expand all
248 FX_RECT rect = bbox.GetOutterRect(); 248 FX_RECT rect = bbox.GetOutterRect();
249 CFX_DIBitmap bitmap, Backdrop; 249 CFX_DIBitmap bitmap, Backdrop;
250 if (!CreateCompatibleBitmap(&bitmap, FXSYS_round(rect.Width() * fScaleX), 250 if (!CreateCompatibleBitmap(&bitmap, FXSYS_round(rect.Width() * fScaleX),
251 FXSYS_round(rect.Height() * fScaleY))) { 251 FXSYS_round(rect.Height() * fScaleY))) {
252 return FALSE; 252 return FALSE;
253 } 253 }
254 if (bitmap.HasAlpha()) { 254 if (bitmap.HasAlpha()) {
255 bitmap.Clear(0); 255 bitmap.Clear(0);
256 Backdrop.Copy(&bitmap); 256 Backdrop.Copy(&bitmap);
257 } else { 257 } else {
258 if (!m_pDeviceDriver->GetDIBits(&bitmap, rect.left, rect.top, nullptr)) { 258 if (!m_pDeviceDriver->GetDIBits(&bitmap, rect.left, rect.top))
259 return FALSE; 259 return FALSE;
260 }
261 Backdrop.Copy(&bitmap); 260 Backdrop.Copy(&bitmap);
262 } 261 }
263 CFX_FxgeDevice bitmap_device; 262 CFX_FxgeDevice bitmap_device;
264 bitmap_device.Attach(&bitmap, false, &Backdrop, true); 263 bitmap_device.Attach(&bitmap, false, &Backdrop, true);
265 CFX_Matrix matrix; 264 CFX_Matrix matrix;
266 if (pObject2Device) { 265 if (pObject2Device) {
267 matrix = *pObject2Device; 266 matrix = *pObject2Device;
268 } 267 }
269 matrix.TranslateI(-rect.left, -rect.top); 268 matrix.TranslateI(-rect.left, -rect.top);
270 matrix.Concat(fScaleX, 0, 0, fScaleY, 0, 0); 269 matrix.Concat(fScaleX, 0, 0, fScaleY, 0, 0);
271 if (!bitmap_device.GetDeviceDriver()->DrawPath( 270 if (!bitmap_device.GetDeviceDriver()->DrawPath(
272 pPathData, &matrix, pGraphState, fill_color, stroke_color, 271 pPathData, &matrix, pGraphState, fill_color, stroke_color,
273 fill_mode, 0, nullptr, blend_type)) { 272 fill_mode, blend_type)) {
274 return FALSE; 273 return FALSE;
275 } 274 }
276 FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX), 275 FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX),
277 FXSYS_round(rect.Height() * fScaleY)); 276 FXSYS_round(rect.Height() * fScaleY));
278 return m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, rect.left, 277 return m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, rect.left,
279 rect.top, FXDIB_BLEND_NORMAL); 278 rect.top, FXDIB_BLEND_NORMAL);
280 } 279 }
281 280
282 FX_BOOL CFX_RenderDevice::SetPixel(int x, int y, uint32_t color) { 281 FX_BOOL CFX_RenderDevice::SetPixel(int x, int y, uint32_t color) {
283 if (m_pDeviceDriver->SetPixel(x, y, color, 0, nullptr)) 282 if (m_pDeviceDriver->SetPixel(x, y, color))
284 return TRUE; 283 return TRUE;
285 284
286 FX_RECT rect(x, y, x + 1, y + 1); 285 FX_RECT rect(x, y, x + 1, y + 1);
287 return FillRectWithBlend(&rect, color, FXDIB_BLEND_NORMAL); 286 return FillRectWithBlend(&rect, color, FXDIB_BLEND_NORMAL);
288 } 287 }
289 288
290 FX_BOOL CFX_RenderDevice::FillRectWithBlend(const FX_RECT* pRect, 289 FX_BOOL CFX_RenderDevice::FillRectWithBlend(const FX_RECT* pRect,
291 uint32_t fill_color, 290 uint32_t fill_color,
292 int blend_type) { 291 int blend_type) {
293 if (m_pDeviceDriver->FillRect(pRect, fill_color, 0, nullptr, blend_type)) 292 if (m_pDeviceDriver->FillRectWithBlend(pRect, fill_color, blend_type))
294 return TRUE; 293 return TRUE;
295 294
296 if (!(m_RenderCaps & FXRC_GET_BITS)) 295 if (!(m_RenderCaps & FXRC_GET_BITS))
297 return FALSE; 296 return FALSE;
298 297
299 CFX_DIBitmap bitmap; 298 CFX_DIBitmap bitmap;
300 if (!CreateCompatibleBitmap(&bitmap, pRect->Width(), pRect->Height())) 299 if (!CreateCompatibleBitmap(&bitmap, pRect->Width(), pRect->Height()))
301 return FALSE; 300 return FALSE;
302 301
303 if (!m_pDeviceDriver->GetDIBits(&bitmap, pRect->left, pRect->top)) 302 if (!m_pDeviceDriver->GetDIBits(&bitmap, pRect->left, pRect->top))
(...skipping 10 matching lines...) Expand all
314 } 313 }
315 314
316 FX_BOOL CFX_RenderDevice::DrawCosmeticLineWithFillModeAndBlend(FX_FLOAT x1, 315 FX_BOOL CFX_RenderDevice::DrawCosmeticLineWithFillModeAndBlend(FX_FLOAT x1,
317 FX_FLOAT y1, 316 FX_FLOAT y1,
318 FX_FLOAT x2, 317 FX_FLOAT x2,
319 FX_FLOAT y2, 318 FX_FLOAT y2,
320 uint32_t color, 319 uint32_t color,
321 int fill_mode, 320 int fill_mode,
322 int blend_type) { 321 int blend_type) {
323 if ((color >= 0xff000000) && 322 if ((color >= 0xff000000) &&
324 m_pDeviceDriver->DrawCosmeticLine(x1, y1, x2, y2, color, 0, nullptr, 323 m_pDeviceDriver->DrawCosmeticLine(x1, y1, x2, y2, color, blend_type)) {
325 blend_type)) {
326 return TRUE; 324 return TRUE;
327 } 325 }
328 CFX_GraphStateData graph_state; 326 CFX_GraphStateData graph_state;
329 CFX_PathData path; 327 CFX_PathData path;
330 path.SetPointCount(2); 328 path.SetPointCount(2);
331 path.SetPoint(0, x1, y1, FXPT_MOVETO); 329 path.SetPoint(0, x1, y1, FXPT_MOVETO);
332 path.SetPoint(1, x2, y2, FXPT_LINETO); 330 path.SetPoint(1, x2, y2, FXPT_LINETO);
333 return m_pDeviceDriver->DrawPath(&path, nullptr, &graph_state, 0, color, 331 return m_pDeviceDriver->DrawPath(&path, nullptr, &graph_state, 0, color,
334 fill_mode, 0, nullptr, blend_type); 332 fill_mode, blend_type);
335 } 333 }
336 334
337 FX_BOOL CFX_RenderDevice::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) { 335 FX_BOOL CFX_RenderDevice::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
338 if (!(m_RenderCaps & FXRC_GET_BITS)) 336 if (!(m_RenderCaps & FXRC_GET_BITS))
339 return FALSE; 337 return FALSE;
340 return m_pDeviceDriver->GetDIBits(pBitmap, left, top, nullptr); 338 return m_pDeviceDriver->GetDIBits(pBitmap, left, top);
341 } 339 }
342 340
343 CFX_DIBitmap* CFX_RenderDevice::GetBackDrop() { 341 CFX_DIBitmap* CFX_RenderDevice::GetBackDrop() {
344 return m_pDeviceDriver->GetBackDrop(); 342 return m_pDeviceDriver->GetBackDrop();
345 } 343 }
346 344
347 FX_BOOL CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap, 345 FX_BOOL CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
348 int left, 346 int left,
349 int top, 347 int top,
350 int blend_mode) { 348 int blend_mode) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 if (!background.CompositeBitmap(0, 0, bg_pixel_width, bg_pixel_height, 384 if (!background.CompositeBitmap(0, 0, bg_pixel_width, bg_pixel_height,
387 pBitmap, src_rect.left, src_rect.top, 385 pBitmap, src_rect.left, src_rect.top,
388 blend_mode, nullptr, FALSE, nullptr)) { 386 blend_mode, nullptr, FALSE, nullptr)) {
389 return FALSE; 387 return FALSE;
390 } 388 }
391 FX_RECT rect(0, 0, bg_pixel_width, bg_pixel_height); 389 FX_RECT rect(0, 0, bg_pixel_width, bg_pixel_height);
392 return m_pDeviceDriver->SetDIBits(&background, 0, &rect, dest_rect.left, 390 return m_pDeviceDriver->SetDIBits(&background, 0, &rect, dest_rect.left,
393 dest_rect.top, FXDIB_BLEND_NORMAL); 391 dest_rect.top, FXDIB_BLEND_NORMAL);
394 } 392 }
395 return m_pDeviceDriver->SetDIBits(pBitmap, 0, &src_rect, dest_rect.left, 393 return m_pDeviceDriver->SetDIBits(pBitmap, 0, &src_rect, dest_rect.left,
396 dest_rect.top, blend_mode, 0, nullptr); 394 dest_rect.top, blend_mode);
397 } 395 }
398 396
399 FX_BOOL CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend( 397 FX_BOOL CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend(
400 const CFX_DIBSource* pBitmap, 398 const CFX_DIBSource* pBitmap,
401 int left, 399 int left,
402 int top, 400 int top,
403 int dest_width, 401 int dest_width,
404 int dest_height, 402 int dest_height,
405 uint32_t flags, 403 uint32_t flags,
406 int blend_mode) { 404 int blend_mode) {
407 FX_RECT dest_rect(left, top, left + dest_width, top + dest_height); 405 FX_RECT dest_rect(left, top, left + dest_width, top + dest_height);
408 FX_RECT clip_box = m_ClipBox; 406 FX_RECT clip_box = m_ClipBox;
409 clip_box.Intersect(dest_rect); 407 clip_box.Intersect(dest_rect);
410 if (clip_box.IsEmpty()) 408 if (clip_box.IsEmpty())
411 return TRUE; 409 return TRUE;
412 return m_pDeviceDriver->StretchDIBits(pBitmap, 0, left, top, dest_width, 410 return m_pDeviceDriver->StretchDIBits(pBitmap, 0, left, top, dest_width,
413 dest_height, &clip_box, flags, 0, 411 dest_height, &clip_box, flags,
414 nullptr, blend_mode); 412 blend_mode);
415 } 413 }
416 414
417 FX_BOOL CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap, 415 FX_BOOL CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap,
418 int left, 416 int left,
419 int top, 417 int top,
420 uint32_t argb) { 418 uint32_t argb) {
421 FX_RECT src_rect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight()); 419 FX_RECT src_rect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight());
422 return m_pDeviceDriver->SetDIBits(pBitmap, argb, &src_rect, left, top, 420 return m_pDeviceDriver->SetDIBits(pBitmap, argb, &src_rect, left, top,
423 FXDIB_BLEND_NORMAL, 0, nullptr); 421 FXDIB_BLEND_NORMAL);
424 } 422 }
425 423
426 FX_BOOL CFX_RenderDevice::StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap, 424 FX_BOOL CFX_RenderDevice::StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
427 int left, 425 int left,
428 int top, 426 int top,
429 int dest_width, 427 int dest_width,
430 int dest_height, 428 int dest_height,
431 uint32_t argb, 429 uint32_t argb,
432 uint32_t flags) { 430 uint32_t flags) {
433 FX_RECT dest_rect(left, top, left + dest_width, top + dest_height); 431 FX_RECT dest_rect(left, top, left + dest_width, top + dest_height);
434 FX_RECT clip_box = m_ClipBox; 432 FX_RECT clip_box = m_ClipBox;
435 clip_box.Intersect(dest_rect); 433 clip_box.Intersect(dest_rect);
436 return m_pDeviceDriver->StretchDIBits(pBitmap, argb, left, top, dest_width, 434 return m_pDeviceDriver->StretchDIBits(pBitmap, argb, left, top, dest_width,
437 dest_height, &clip_box, flags, 0, 435 dest_height, &clip_box, flags,
438 nullptr); 436 FXDIB_BLEND_NORMAL);
439 } 437 }
440 438
441 FX_BOOL CFX_RenderDevice::StartDIBitsWithBlend(const CFX_DIBSource* pBitmap, 439 FX_BOOL CFX_RenderDevice::StartDIBitsWithBlend(const CFX_DIBSource* pBitmap,
442 int bitmap_alpha, 440 int bitmap_alpha,
443 uint32_t argb, 441 uint32_t argb,
444 const CFX_Matrix* pMatrix, 442 const CFX_Matrix* pMatrix,
445 uint32_t flags, 443 uint32_t flags,
446 void*& handle, 444 void*& handle,
447 int blend_mode) { 445 int blend_mode) {
448 return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix, 446 return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix,
449 flags, handle, 0, nullptr, blend_mode); 447 flags, handle, blend_mode);
450 } 448 }
451 449
452 FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) { 450 FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) {
453 return m_pDeviceDriver->ContinueDIBits(handle, pPause); 451 return m_pDeviceDriver->ContinueDIBits(handle, pPause);
454 } 452 }
455 453
456 void CFX_RenderDevice::CancelDIBits(void* handle) { 454 void CFX_RenderDevice::CancelDIBits(void* handle) {
457 m_pDeviceDriver->CancelDIBits(handle); 455 m_pDeviceDriver->CancelDIBits(handle);
458 } 456 }
OLDNEW
« no previous file with comments | « core/fxge/apple/fx_quartz_device.cpp ('k') | core/fxge/ge/fx_ge_text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698