| 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 #include "core/include/fxge/fx_ge.h" | 5 #include "core/include/fxge/fx_ge.h" |
| 6 | 6 |
| 7 #if defined(_SKIA_SUPPORT_) | 7 #if defined(_SKIA_SUPPORT_) |
| 8 #include "core/include/fxcodec/fx_codec.h" | 8 #include "core/include/fxcodec/fx_codec.h" |
| 9 | 9 |
| 10 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" | 10 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" |
| 11 #include "core/fpdfapi/fpdf_page/pageint.h" | 11 #include "core/fpdfapi/fpdf_page/pageint.h" |
| 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
| 14 #include "core/fxge/agg/fx_agg_driver.h" | |
| 15 #include "core/fxge/skia/fx_skia_device.h" | 14 #include "core/fxge/skia/fx_skia_device.h" |
| 16 | 15 |
| 17 #include "third_party/skia/include/core/SkCanvas.h" | 16 #include "third_party/skia/include/core/SkCanvas.h" |
| 18 #include "third_party/skia/include/core/SkColorPriv.h" | 17 #include "third_party/skia/include/core/SkColorPriv.h" |
| 19 #include "third_party/skia/include/core/SkPaint.h" | 18 #include "third_party/skia/include/core/SkPaint.h" |
| 20 #include "third_party/skia/include/core/SkPath.h" | 19 #include "third_party/skia/include/core/SkPath.h" |
| 21 #include "third_party/skia/include/core/SkPictureRecorder.h" | 20 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 22 #include "third_party/skia/include/core/SkStream.h" | 21 #include "third_party/skia/include/core/SkStream.h" |
| 23 #include "third_party/skia/include/core/SkTypeface.h" | 22 #include "third_party/skia/include/core/SkTypeface.h" |
| 24 #include "third_party/skia/include/effects/SkDashPathEffect.h" | 23 #include "third_party/skia/include/effects/SkDashPathEffect.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 return false; | 195 return false; |
| 197 FX_FLOAT boundsEnd = | 196 FX_FLOAT boundsEnd = |
| 198 i < inputs - 1 ? stitchFunc->m_pBounds[i] : stitchFunc->GetDomain(1); | 197 i < inputs - 1 ? stitchFunc->m_pBounds[i] : stitchFunc->GetDomain(1); |
| 199 skPos->push(boundsStart); | 198 skPos->push(boundsStart); |
| 200 skPos->push(boundsEnd); | 199 skPos->push(boundsEnd); |
| 201 boundsStart = boundsEnd; | 200 boundsStart = boundsEnd; |
| 202 } | 201 } |
| 203 return true; | 202 return true; |
| 204 } | 203 } |
| 205 | 204 |
| 205 void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, |
| 206 int dest_left, |
| 207 int dest_top, |
| 208 int width, |
| 209 int height, |
| 210 const CFX_DIBSource* pSrcBitmap, |
| 211 int src_left, |
| 212 int src_top) { |
| 213 if (!pBitmap) |
| 214 return; |
| 215 pBitmap->GetOverlapRect(dest_left, dest_top, width, height, |
| 216 pSrcBitmap->GetWidth(), pSrcBitmap->GetHeight(), |
| 217 src_left, src_top, NULL); |
| 218 if (width == 0 || height == 0) |
| 219 return; |
| 220 int Bpp = pBitmap->GetBPP() / 8; |
| 221 FXDIB_Format dest_format = pBitmap->GetFormat(); |
| 222 FXDIB_Format src_format = pSrcBitmap->GetFormat(); |
| 223 int pitch = pBitmap->GetPitch(); |
| 224 uint8_t* buffer = pBitmap->GetBuffer(); |
| 225 if (dest_format == src_format) { |
| 226 for (int row = 0; row < height; row++) { |
| 227 uint8_t* dest_scan = buffer + (dest_top + row) * pitch + dest_left * Bpp; |
| 228 uint8_t* src_scan = |
| 229 (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; |
| 230 if (Bpp == 4) { |
| 231 for (int col = 0; col < width; col++) { |
| 232 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_scan[3], src_scan[0], |
| 233 src_scan[1], src_scan[2])); |
| 234 dest_scan += 4; |
| 235 src_scan += 4; |
| 236 } |
| 237 } else { |
| 238 for (int col = 0; col < width; col++) { |
| 239 *dest_scan++ = src_scan[2]; |
| 240 *dest_scan++ = src_scan[1]; |
| 241 *dest_scan++ = src_scan[0]; |
| 242 src_scan += 3; |
| 243 } |
| 244 } |
| 245 } |
| 246 return; |
| 247 } |
| 248 uint8_t* dest_buf = buffer + dest_top * pitch + dest_left * Bpp; |
| 249 if (dest_format == FXDIB_Rgb) { |
| 250 if (src_format == FXDIB_Rgb32) { |
| 251 for (int row = 0; row < height; row++) { |
| 252 uint8_t* dest_scan = dest_buf + row * pitch; |
| 253 uint8_t* src_scan = |
| 254 (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 4; |
| 255 for (int col = 0; col < width; col++) { |
| 256 *dest_scan++ = src_scan[2]; |
| 257 *dest_scan++ = src_scan[1]; |
| 258 *dest_scan++ = src_scan[0]; |
| 259 src_scan += 4; |
| 260 } |
| 261 } |
| 262 } else { |
| 263 ASSERT(FALSE); |
| 264 } |
| 265 } else if (dest_format == FXDIB_Argb || dest_format == FXDIB_Rgb32) { |
| 266 if (src_format == FXDIB_Rgb) { |
| 267 for (int row = 0; row < height; row++) { |
| 268 uint8_t* dest_scan = (uint8_t*)(dest_buf + row * pitch); |
| 269 uint8_t* src_scan = |
| 270 (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 3; |
| 271 if (src_format == FXDIB_Argb) { |
| 272 for (int col = 0; col < width; col++) { |
| 273 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, FX_GAMMA(src_scan[0]), |
| 274 FX_GAMMA(src_scan[1]), |
| 275 FX_GAMMA(src_scan[2]))); |
| 276 dest_scan += 4; |
| 277 src_scan += 3; |
| 278 } |
| 279 } else { |
| 280 for (int col = 0; col < width; col++) { |
| 281 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1], |
| 282 src_scan[2])); |
| 283 dest_scan += 4; |
| 284 src_scan += 3; |
| 285 } |
| 286 } |
| 287 } |
| 288 } else if (src_format == FXDIB_Rgb32) { |
| 289 ASSERT(dest_format == FXDIB_Argb); |
| 290 for (int row = 0; row < height; row++) { |
| 291 uint8_t* dest_scan = dest_buf + row * pitch; |
| 292 uint8_t* src_scan = |
| 293 (uint8_t*)(pSrcBitmap->GetScanline(src_top + row) + src_left * 4); |
| 294 for (int col = 0; col < width; col++) { |
| 295 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1], |
| 296 src_scan[2])); |
| 297 src_scan += 4; |
| 298 dest_scan += 4; |
| 299 } |
| 300 } |
| 301 } |
| 302 } else { |
| 303 ASSERT(FALSE); |
| 304 } |
| 305 } |
| 306 |
| 206 } // namespace | 307 } // namespace |
| 207 | 308 |
| 208 // convert a stroking path to scanlines | 309 // convert a stroking path to scanlines |
| 209 void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint, | 310 void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint, |
| 210 const CFX_GraphStateData* pGraphState, | 311 const CFX_GraphStateData* pGraphState, |
| 211 const SkMatrix& matrix) { | 312 const SkMatrix& matrix) { |
| 212 SkPaint::Cap cap; | 313 SkPaint::Cap cap; |
| 213 switch (pGraphState->m_LineCap) { | 314 switch (pGraphState->m_LineCap) { |
| 214 case CFX_GraphStateData::LineCapRound: | 315 case CFX_GraphStateData::LineCapRound: |
| 215 cap = SkPaint::kRound_Cap; | 316 cap = SkPaint::kRound_Cap; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 spaint->setStrokeMiter(pGraphState->m_MiterLimit); | 369 spaint->setStrokeMiter(pGraphState->m_MiterLimit); |
| 269 spaint->setStrokeCap(cap); | 370 spaint->setStrokeCap(cap); |
| 270 spaint->setStrokeJoin(join); | 371 spaint->setStrokeJoin(join); |
| 271 } | 372 } |
| 272 | 373 |
| 273 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, | 374 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, |
| 274 int dither_bits, | 375 int dither_bits, |
| 275 FX_BOOL bRgbByteOrder, | 376 FX_BOOL bRgbByteOrder, |
| 276 CFX_DIBitmap* pOriDevice, | 377 CFX_DIBitmap* pOriDevice, |
| 277 FX_BOOL bGroupKnockout) | 378 FX_BOOL bGroupKnockout) |
| 278 : m_pRecorder(nullptr) { | 379 : m_pBitmap(pBitmap), |
| 279 m_pAggDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, | 380 m_pOriDevice(pOriDevice), |
| 280 pOriDevice, bGroupKnockout); | 381 m_pRecorder(nullptr), |
| 382 m_ditherBits(dither_bits), |
| 383 m_bRgbByteOrder(bRgbByteOrder), |
| 384 m_bGroupKnockout(bGroupKnockout) { |
| 281 SkBitmap skBitmap; | 385 SkBitmap skBitmap; |
| 282 const CFX_DIBitmap* bitmap = m_pAggDriver->GetBitmap(); | |
| 283 SkImageInfo imageInfo = | 386 SkImageInfo imageInfo = |
| 284 SkImageInfo::Make(bitmap->GetWidth(), bitmap->GetHeight(), | 387 SkImageInfo::Make(pBitmap->GetWidth(), pBitmap->GetHeight(), |
| 285 kN32_SkColorType, kOpaque_SkAlphaType); | 388 kN32_SkColorType, kOpaque_SkAlphaType); |
| 286 skBitmap.installPixels(imageInfo, bitmap->GetBuffer(), bitmap->GetPitch(), | 389 skBitmap.installPixels(imageInfo, pBitmap->GetBuffer(), pBitmap->GetPitch(), |
| 287 nullptr, /* to do : set color table */ | 390 nullptr, /* to do : set color table */ |
| 288 nullptr, nullptr); | 391 nullptr, nullptr); |
| 289 m_pCanvas = new SkCanvas(skBitmap); | 392 m_pCanvas = new SkCanvas(skBitmap); |
| 290 m_ditherBits = dither_bits; | |
| 291 } | 393 } |
| 292 | 394 |
| 293 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(int size_x, int size_y) | 395 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(int size_x, int size_y) |
| 294 : m_pRecorder(new SkPictureRecorder) { | 396 : m_pBitmap(nullptr), |
| 295 m_pAggDriver = nullptr; | 397 m_pOriDevice(nullptr), |
| 398 m_pRecorder(new SkPictureRecorder), |
| 399 m_ditherBits(0), |
| 400 m_bRgbByteOrder(FALSE), |
| 401 m_bGroupKnockout(FALSE) { |
| 296 m_pRecorder->beginRecording(SkIntToScalar(size_x), SkIntToScalar(size_y)); | 402 m_pRecorder->beginRecording(SkIntToScalar(size_x), SkIntToScalar(size_y)); |
| 297 m_pCanvas = m_pRecorder->getRecordingCanvas(); | 403 m_pCanvas = m_pRecorder->getRecordingCanvas(); |
| 298 m_ditherBits = 0; | |
| 299 } | 404 } |
| 300 | 405 |
| 301 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(SkPictureRecorder* recorder) | 406 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(SkPictureRecorder* recorder) |
| 302 : m_pRecorder(recorder) { | 407 : m_pBitmap(nullptr), |
| 303 m_pAggDriver = nullptr; | 408 m_pOriDevice(nullptr), |
| 409 m_pRecorder(recorder), |
| 410 m_ditherBits(0), |
| 411 m_bRgbByteOrder(FALSE), |
| 412 m_bGroupKnockout(FALSE) { |
| 304 m_pCanvas = m_pRecorder->getRecordingCanvas(); | 413 m_pCanvas = m_pRecorder->getRecordingCanvas(); |
| 305 m_ditherBits = 0; | |
| 306 } | 414 } |
| 307 | 415 |
| 308 CFX_SkiaDeviceDriver::~CFX_SkiaDeviceDriver() { | 416 CFX_SkiaDeviceDriver::~CFX_SkiaDeviceDriver() { |
| 309 if (!m_pRecorder) | 417 if (!m_pRecorder) |
| 310 delete m_pCanvas; | 418 delete m_pCanvas; |
| 311 delete m_pAggDriver; | |
| 312 } | 419 } |
| 313 | 420 |
| 314 FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, | 421 FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, |
| 315 const FXTEXT_CHARPOS* pCharPos, | 422 const FXTEXT_CHARPOS* pCharPos, |
| 316 CFX_Font* pFont, | 423 CFX_Font* pFont, |
| 317 CFX_FontCache* pCache, | 424 CFX_FontCache* pCache, |
| 318 const CFX_Matrix* pObject2Device, | 425 const CFX_Matrix* pObject2Device, |
| 319 FX_FLOAT font_size, | 426 FX_FLOAT font_size, |
| 320 uint32_t color, | 427 uint32_t color, |
| 321 int alpha_flag, | 428 int alpha_flag, |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 pRect->right = canvasSize.width(); | 677 pRect->right = canvasSize.width(); |
| 571 pRect->bottom = canvasSize.height(); | 678 pRect->bottom = canvasSize.height(); |
| 572 return TRUE; | 679 return TRUE; |
| 573 } | 680 } |
| 574 | 681 |
| 575 FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, | 682 FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, |
| 576 int left, | 683 int left, |
| 577 int top, | 684 int top, |
| 578 void* pIccTransform, | 685 void* pIccTransform, |
| 579 FX_BOOL bDEdge) { | 686 FX_BOOL bDEdge) { |
| 580 return m_pAggDriver && | 687 if (!m_pBitmap->GetBuffer()) |
| 581 m_pAggDriver->GetDIBits(pBitmap, left, top, pIccTransform, bDEdge); | 688 return TRUE; |
| 689 if (bDEdge) { |
| 690 if (m_bRgbByteOrder) { |
| 691 RgbByteOrderTransferBitmap(pBitmap, 0, 0, pBitmap->GetWidth(), |
| 692 pBitmap->GetHeight(), m_pBitmap, left, top); |
| 693 } else { |
| 694 return pBitmap->TransferBitmap(0, 0, pBitmap->GetWidth(), |
| 695 pBitmap->GetHeight(), m_pBitmap, left, top, |
| 696 pIccTransform); |
| 697 } |
| 698 return TRUE; |
| 699 } |
| 700 FX_RECT rect(left, top, left + pBitmap->GetWidth(), |
| 701 top + pBitmap->GetHeight()); |
| 702 CFX_DIBitmap* pBack; |
| 703 if (m_pOriDevice) { |
| 704 pBack = m_pOriDevice->Clone(&rect); |
| 705 if (!pBack) |
| 706 return TRUE; |
| 707 pBack->CompositeBitmap(0, 0, pBack->GetWidth(), pBack->GetHeight(), |
| 708 m_pBitmap, 0, 0); |
| 709 } else { |
| 710 pBack = m_pBitmap->Clone(&rect); |
| 711 if (!pBack) |
| 712 return TRUE; |
| 713 } |
| 714 FX_BOOL bRet = TRUE; |
| 715 left = left >= 0 ? 0 : left; |
| 716 top = top >= 0 ? 0 : top; |
| 717 if (m_bRgbByteOrder) { |
| 718 RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(), |
| 719 pBack, left, top); |
| 720 } else { |
| 721 bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack, |
| 722 left, top, pIccTransform); |
| 723 } |
| 724 delete pBack; |
| 725 return bRet; |
| 582 } | 726 } |
| 583 | 727 |
| 584 FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, | 728 FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, |
| 585 uint32_t argb, | 729 uint32_t argb, |
| 586 const FX_RECT* pSrcRect, | 730 const FX_RECT* pSrcRect, |
| 587 int left, | 731 int left, |
| 588 int top, | 732 int top, |
| 589 int blend_type, | 733 int blend_type, |
| 590 int alpha_flag, | 734 int alpha_flag, |
| 591 void* pIccTransform) { | 735 void* pIccTransform) { |
| 592 return m_pAggDriver && | 736 if (!m_pBitmap->GetBuffer()) |
| 593 m_pAggDriver->SetDIBits(pBitmap, argb, pSrcRect, left, top, blend_type, | 737 return TRUE; |
| 594 alpha_flag, pIccTransform); | 738 if (pBitmap->IsAlphaMask()) { |
| 739 return m_pBitmap->CompositeMask( |
| 740 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, argb, |
| 741 pSrcRect->left, pSrcRect->top, blend_type, nullptr, m_bRgbByteOrder, |
| 742 alpha_flag, pIccTransform); |
| 743 } |
| 744 return m_pBitmap->CompositeBitmap( |
| 745 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, pSrcRect->left, |
| 746 pSrcRect->top, blend_type, nullptr, m_bRgbByteOrder, pIccTransform); |
| 595 } | 747 } |
| 596 | 748 |
| 597 FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, | 749 FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, |
| 598 uint32_t argb, | 750 uint32_t argb, |
| 599 int dest_left, | 751 int dest_left, |
| 600 int dest_top, | 752 int dest_top, |
| 601 int dest_width, | 753 int dest_width, |
| 602 int dest_height, | 754 int dest_height, |
| 603 const FX_RECT* pClipRect, | 755 const FX_RECT* pClipRect, |
| 604 uint32_t flags, | 756 uint32_t flags, |
| 605 int alpha_flag, | 757 int alpha_flag, |
| 606 void* pIccTransform, | 758 void* pIccTransform, |
| 607 int blend_type) { | 759 int blend_type) { |
| 608 return m_pAggDriver && | 760 if (!m_pBitmap->GetBuffer()) |
| 609 m_pAggDriver->StretchDIBits(pSource, argb, dest_left, dest_top, | 761 return TRUE; |
| 610 dest_width, dest_height, pClipRect, flags, | 762 if (dest_width == pSource->GetWidth() && |
| 611 alpha_flag, pIccTransform, blend_type); | 763 dest_height == pSource->GetHeight()) { |
| 764 FX_RECT rect(0, 0, dest_width, dest_height); |
| 765 return SetDIBits(pSource, argb, &rect, dest_left, dest_top, blend_type, |
| 766 alpha_flag, pIccTransform); |
| 767 } |
| 768 FX_RECT dest_rect(dest_left, dest_top, dest_left + dest_width, |
| 769 dest_top + dest_height); |
| 770 dest_rect.Normalize(); |
| 771 FX_RECT dest_clip = dest_rect; |
| 772 dest_clip.Intersect(*pClipRect); |
| 773 CFX_BitmapComposer composer; |
| 774 composer.Compose(m_pBitmap, nullptr, 255, argb, dest_clip, FALSE, FALSE, |
| 775 FALSE, m_bRgbByteOrder, alpha_flag, pIccTransform, |
| 776 blend_type); |
| 777 dest_clip.Offset(-dest_rect.left, -dest_rect.top); |
| 778 CFX_ImageStretcher stretcher; |
| 779 if (stretcher.Start(&composer, pSource, dest_width, dest_height, dest_clip, |
| 780 flags)) { |
| 781 stretcher.Continue(NULL); |
| 782 } |
| 783 return TRUE; |
| 612 } | 784 } |
| 613 | 785 |
| 614 FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, | 786 FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, |
| 615 int bitmap_alpha, | 787 int bitmap_alpha, |
| 616 uint32_t argb, | 788 uint32_t argb, |
| 617 const CFX_Matrix* pMatrix, | 789 const CFX_Matrix* pMatrix, |
| 618 uint32_t render_flags, | 790 uint32_t render_flags, |
| 619 void*& handle, | 791 void*& handle, |
| 620 int alpha_flag, | 792 int alpha_flag, |
| 621 void* pIccTransform, | 793 void* pIccTransform, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 paint.setAntiAlias(true); | 863 paint.setAntiAlias(true); |
| 692 paint.setFilterQuality(kHigh_SkFilterQuality); | 864 paint.setFilterQuality(kHigh_SkFilterQuality); |
| 693 paint.setXfermodeMode(GetSkiaBlendMode(blend_type)); | 865 paint.setXfermodeMode(GetSkiaBlendMode(blend_type)); |
| 694 paint.setAlpha(bitmap_alpha); | 866 paint.setAlpha(bitmap_alpha); |
| 695 m_pCanvas->drawBitmap(skBitmap, 0, 0, &paint); | 867 m_pCanvas->drawBitmap(skBitmap, 0, 0, &paint); |
| 696 m_pCanvas->restore(); | 868 m_pCanvas->restore(); |
| 697 return TRUE; | 869 return TRUE; |
| 698 } | 870 } |
| 699 | 871 |
| 700 FX_BOOL CFX_SkiaDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { | 872 FX_BOOL CFX_SkiaDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { |
| 701 return m_pAggDriver && m_pAggDriver->ContinueDIBits(pHandle, pPause); | 873 if (!m_pBitmap->GetBuffer()) |
| 874 return TRUE; |
| 875 return ((CFX_ImageRenderer*)pHandle)->Continue(pPause); |
| 702 } | 876 } |
| 703 | 877 |
| 704 void CFX_SkiaDeviceDriver::CancelDIBits(void* pHandle) { | 878 void CFX_SkiaDeviceDriver::CancelDIBits(void* pHandle) { |
| 705 if (m_pAggDriver) | 879 if (!m_pBitmap->GetBuffer()) |
| 706 m_pAggDriver->CancelDIBits(pHandle); | 880 return; |
| 881 delete (CFX_ImageRenderer*)pHandle; |
| 707 } | 882 } |
| 708 | 883 |
| 709 CFX_SkiaDevice::CFX_SkiaDevice() { | 884 CFX_SkiaDevice::CFX_SkiaDevice() { |
| 710 m_bOwnedBitmap = FALSE; | 885 m_bOwnedBitmap = FALSE; |
| 711 } | 886 } |
| 712 | 887 |
| 713 SkPictureRecorder* CFX_SkiaDevice::CreateRecorder(int size_x, int size_y) { | 888 SkPictureRecorder* CFX_SkiaDevice::CreateRecorder(int size_x, int size_y) { |
| 714 CFX_SkiaDeviceDriver* skDriver = new CFX_SkiaDeviceDriver(size_x, size_y); | 889 CFX_SkiaDeviceDriver* skDriver = new CFX_SkiaDeviceDriver(size_x, size_y); |
| 715 SetDeviceDriver(skDriver); | 890 SetDeviceDriver(skDriver); |
| 716 return skDriver->GetRecorder(); | 891 return skDriver->GetRecorder(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 SetDeviceDriver(pDriver); | 928 SetDeviceDriver(pDriver); |
| 754 return TRUE; | 929 return TRUE; |
| 755 } | 930 } |
| 756 | 931 |
| 757 CFX_SkiaDevice::~CFX_SkiaDevice() { | 932 CFX_SkiaDevice::~CFX_SkiaDevice() { |
| 758 if (m_bOwnedBitmap && GetBitmap()) | 933 if (m_bOwnedBitmap && GetBitmap()) |
| 759 delete GetBitmap(); | 934 delete GetBitmap(); |
| 760 } | 935 } |
| 761 | 936 |
| 762 #endif | 937 #endif |
| OLD | NEW |