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

Side by Side Diff: core/src/fxge/apple/fx_quartz_device.cpp

Issue 1171733003: Remove typdefs for pointer types in fx_system.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual fixes. Created 5 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/src/fxge/apple/fx_mac_imp.cpp ('k') | core/src/fxge/dib/dib_int.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/fxcrt/fx_ext.h" 7 #include "../../../include/fxcrt/fx_ext.h"
8 #include "../../../include/fxge/fx_ge.h" 8 #include "../../../include/fxge/fx_ge.h"
9 #include "../agg/include/fxfx_agg_clip_liang_barsky.h" 9 #include "../agg/include/fxfx_agg_clip_liang_barsky.h"
10 #include "../ge/text_int.h" 10 #include "../ge/text_int.h"
(...skipping 30 matching lines...) Expand all
41 bmpInfo); 41 bmpInfo);
42 CGColorSpaceRelease(colorSpace); 42 CGColorSpaceRelease(colorSpace);
43 return context; 43 return context;
44 } 44 }
45 void CQuartz2D::destroyGraphics(void* graphics) 45 void CQuartz2D::destroyGraphics(void* graphics)
46 { 46 {
47 if (graphics) { 47 if (graphics) {
48 CGContextRelease((CGContextRef) graphics); 48 CGContextRelease((CGContextRef) graphics);
49 } 49 }
50 } 50 }
51 void* CQuartz2D::CreateFont(FX_LPCBYTE pFontData, FX_DWORD dwFontSize) 51 void* CQuartz2D::CreateFont(const uint8_t* pFontData, FX_DWORD dwFontSize)
52 { 52 {
53 CGDataProviderRef pDataProvider = CGDataProviderCreateWithData(NULL, pFontDa ta, (size_t)dwFontSize, NULL); 53 CGDataProviderRef pDataProvider = CGDataProviderCreateWithData(NULL, pFontDa ta, (size_t)dwFontSize, NULL);
54 if (NULL == pDataProvider) { 54 if (NULL == pDataProvider) {
55 return NULL; 55 return NULL;
56 } 56 }
57 CGFontRef pCGFont = CGFontCreateWithDataProvider(pDataProvider); 57 CGFontRef pCGFont = CGFontCreateWithDataProvider(pDataProvider);
58 CGDataProviderRelease(pDataProvider); 58 CGDataProviderRelease(pDataProvider);
59 return pCGFont; 59 return pCGFont;
60 } 60 }
61 void CQuartz2D::DestroyFont(void* pFont) 61 void CQuartz2D::DestroyFont(void* pFont)
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 height)); 534 height));
535 CGContextRef context = createContextWithBitmap(bitmap); 535 CGContextRef context = createContextWithBitmap(bitmap);
536 CGRect rect = CGContextGetClipBoundingBox(context); 536 CGRect rect = CGContextGetClipBoundingBox(context);
537 CGContextClearRect(context, rect); 537 CGContextClearRect(context, rect);
538 CGContextDrawImage(context, rect, subImage); 538 CGContextDrawImage(context, rect, subImage);
539 CGContextRelease(context); 539 CGContextRelease(context);
540 CGImageRelease(subImage); 540 CGImageRelease(subImage);
541 CGImageRelease(image); 541 CGImageRelease(image);
542 if (bitmap->HasAlpha()) { 542 if (bitmap->HasAlpha()) {
543 for (int row = 0; row < bitmap->GetHeight(); row ++) { 543 for (int row = 0; row < bitmap->GetHeight(); row ++) {
544 FX_LPBYTE pScanline = (FX_LPBYTE)bitmap->GetScanline(row); 544 uint8_t* pScanline = (uint8_t*)bitmap->GetScanline(row);
545 for (int col = 0; col < bitmap->GetWidth(); col ++) { 545 for (int col = 0; col < bitmap->GetWidth(); col ++) {
546 if (pScanline[3] > 0) { 546 if (pScanline[3] > 0) {
547 pScanline[0] = (pScanline[0] * 255.f / pScanline[3] + .5f); 547 pScanline[0] = (pScanline[0] * 255.f / pScanline[3] + .5f);
548 pScanline[1] = (pScanline[1] * 255.f / pScanline[3] + .5f); 548 pScanline[1] = (pScanline[1] * 255.f / pScanline[3] + .5f);
549 pScanline[2] = (pScanline[2] * 255.f / pScanline[3] + .5f); 549 pScanline[2] = (pScanline[2] * 255.f / pScanline[3] + .5f);
550 } 550 }
551 pScanline += 4; 551 pScanline += 4;
552 } 552 }
553 } 553 }
554 } 554 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 } 647 }
648 if (pBitmap1->HasAlpha()) { 648 if (pBitmap1->HasAlpha()) {
649 if (pBitmap1 == pBitmap) { 649 if (pBitmap1 == pBitmap) {
650 pBitmap1 = pBitmap->Clone(); 650 pBitmap1 = pBitmap->Clone();
651 if (!pBitmap1) { 651 if (!pBitmap1) {
652 RestoreState(FALSE); 652 RestoreState(FALSE);
653 return FALSE; 653 return FALSE;
654 } 654 }
655 } 655 }
656 for (int row = 0; row < pBitmap1->GetHeight(); row ++) { 656 for (int row = 0; row < pBitmap1->GetHeight(); row ++) {
657 FX_LPBYTE pScanline = (FX_LPBYTE)pBitmap1->GetScanline(row); 657 uint8_t* pScanline = (uint8_t*)pBitmap1->GetScanline(row);
658 for (int col = 0; col < pBitmap1->GetWidth(); col ++) { 658 for (int col = 0; col < pBitmap1->GetWidth(); col ++) {
659 pScanline[0] = (uint8_t)(pScanline[0] * pScanline[3] / 255.f + . 5f); 659 pScanline[0] = (uint8_t)(pScanline[0] * pScanline[3] / 255.f + . 5f);
660 pScanline[1] = (uint8_t)(pScanline[1] * pScanline[3] / 255.f + . 5f); 660 pScanline[1] = (uint8_t)(pScanline[1] * pScanline[3] / 255.f + . 5f);
661 pScanline[2] = (uint8_t)(pScanline[2] * pScanline[3] / 255.f + . 5f); 661 pScanline[2] = (uint8_t)(pScanline[2] * pScanline[3] / 255.f + . 5f);
662 pScanline += 4; 662 pScanline += 4;
663 } 663 }
664 } 664 }
665 } 665 }
666 CGContextRef ctx = createContextWithBitmap(pBitmap1); 666 CGContextRef ctx = createContextWithBitmap(pBitmap1);
667 CGImageRef image = CGBitmapContextCreateImage(ctx); 667 CGImageRef image = CGBitmapContextCreateImage(ctx);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 } 772 }
773 if (pBitmap1->HasAlpha()) { 773 if (pBitmap1->HasAlpha()) {
774 if (pBitmap1 == pBitmap) { 774 if (pBitmap1 == pBitmap) {
775 pBitmap1 = pBitmap->Clone(); 775 pBitmap1 = pBitmap->Clone();
776 if (!pBitmap1) { 776 if (!pBitmap1) {
777 RestoreState(FALSE); 777 RestoreState(FALSE);
778 return FALSE; 778 return FALSE;
779 } 779 }
780 } 780 }
781 for (int row = 0; row < pBitmap1->GetHeight(); row ++) { 781 for (int row = 0; row < pBitmap1->GetHeight(); row ++) {
782 FX_LPBYTE pScanline = (FX_LPBYTE)pBitmap1->GetScanline(row); 782 uint8_t* pScanline = (uint8_t*)pBitmap1->GetScanline(row);
783 for (int col = 0; col < pBitmap1->GetWidth(); col ++) { 783 for (int col = 0; col < pBitmap1->GetWidth(); col ++) {
784 pScanline[0] = (uint8_t)(pScanline[0] * pScanline[3] / 255.f + . 5f); 784 pScanline[0] = (uint8_t)(pScanline[0] * pScanline[3] / 255.f + . 5f);
785 pScanline[1] = (uint8_t)(pScanline[1] * pScanline[3] / 255.f + . 5f); 785 pScanline[1] = (uint8_t)(pScanline[1] * pScanline[3] / 255.f + . 5f);
786 pScanline[2] = (uint8_t)(pScanline[2] * pScanline[3] / 255.f + . 5f); 786 pScanline[2] = (uint8_t)(pScanline[2] * pScanline[3] / 255.f + . 5f);
787 pScanline += 4; 787 pScanline += 4;
788 } 788 }
789 } 789 }
790 } 790 }
791 CGContextRef ctx = createContextWithBitmap(pBitmap1); 791 CGContextRef ctx = createContextWithBitmap(pBitmap1);
792 CGImageRef image = CGBitmapContextCreateImage(ctx); 792 CGImageRef image = CGBitmapContextCreateImage(ctx);
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 } 1119 }
1120 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; 1120 CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
1121 if (!pBitmap->Create(width, height, format)) { 1121 if (!pBitmap->Create(width, height, format)) {
1122 delete pBitmap; 1122 delete pBitmap;
1123 return FALSE; 1123 return FALSE;
1124 } 1124 }
1125 m_bOwnedBitmap = TRUE; 1125 m_bOwnedBitmap = TRUE;
1126 return Attach(pBitmap); 1126 return Attach(pBitmap);
1127 } 1127 }
1128 #endif 1128 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/apple/fx_mac_imp.cpp ('k') | core/src/fxge/dib/dib_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698