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

Side by Side Diff: core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp

Issue 1620523002: Change _PDF_RenderItem to CPDF_RenderContext::Layer. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Few more unused decls Created 4 years, 11 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
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 "render_int.h" 7 #include "render_int.h"
8 8
9 #include "core/include/fpdfapi/fpdf_pageobj.h" 9 #include "core/include/fpdfapi/fpdf_pageobj.h"
10 #include "core/include/fpdfapi/fpdf_render.h" 10 #include "core/include/fpdfapi/fpdf_render.h"
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 mtAdjust.MatchRect(bitmap_rect, cell_bbox); 982 mtAdjust.MatchRect(bitmap_rect, cell_bbox);
983 CFX_Matrix mtPattern2Bitmap = *pObject2Device; 983 CFX_Matrix mtPattern2Bitmap = *pObject2Device;
984 mtPattern2Bitmap.Concat(mtAdjust); 984 mtPattern2Bitmap.Concat(mtAdjust);
985 CPDF_RenderOptions options; 985 CPDF_RenderOptions options;
986 if (!pPattern->m_bColored) { 986 if (!pPattern->m_bColored) {
987 options.m_ColorMode = RENDER_COLOR_ALPHA; 987 options.m_ColorMode = RENDER_COLOR_ALPHA;
988 } 988 }
989 flags |= RENDER_FORCE_HALFTONE; 989 flags |= RENDER_FORCE_HALFTONE;
990 options.m_Flags = flags; 990 options.m_Flags = flags;
991 CPDF_RenderContext context(pDoc, pCache); 991 CPDF_RenderContext context(pDoc, pCache);
992 context.DrawObjectList(&bitmap_device, pPattern->m_pForm, &mtPattern2Bitmap, 992 context.AppendLayer(pPattern->m_pForm, &mtPattern2Bitmap);
993 &options); 993 context.Render(&bitmap_device, &options, nullptr);
994 return pBitmap; 994 return pBitmap;
995 } 995 }
996 void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, 996 void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
997 CPDF_PageObject* pPageObj, 997 CPDF_PageObject* pPageObj,
998 const CFX_Matrix* pObj2Device, 998 const CFX_Matrix* pObj2Device,
999 FX_BOOL bStroke) { 999 FX_BOOL bStroke) {
1000 if (!pPattern->Load()) { 1000 if (!pPattern->Load()) {
1001 return; 1001 return;
1002 } 1002 }
1003 m_pDevice->SaveState(); 1003 m_pDevice->SaveState();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 max_row = (clip_box.bottom - orig_y) / height; 1104 max_row = (clip_box.bottom - orig_y) / height;
1105 if (clip_box.bottom <= orig_y) { 1105 if (clip_box.bottom <= orig_y) {
1106 max_row--; 1106 max_row--;
1107 } 1107 }
1108 } 1108 }
1109 FX_FLOAT left_offset = cell_bbox.left - mtPattern2Device.e; 1109 FX_FLOAT left_offset = cell_bbox.left - mtPattern2Device.e;
1110 FX_FLOAT top_offset = cell_bbox.bottom - mtPattern2Device.f; 1110 FX_FLOAT top_offset = cell_bbox.bottom - mtPattern2Device.f;
1111 CFX_DIBitmap* pPatternBitmap = NULL; 1111 CFX_DIBitmap* pPatternBitmap = NULL;
1112 if (width * height < 16) { 1112 if (width * height < 16) {
1113 CFX_DIBitmap* pEnlargedBitmap = 1113 CFX_DIBitmap* pEnlargedBitmap =
1114 DrawPatternBitmap(m_pContext->m_pDocument, m_pContext->m_pPageCache, 1114 DrawPatternBitmap(m_pContext->GetDocument(), m_pContext->GetPageCache(),
1115 pPattern, pObj2Device, 8, 8, m_Options.m_Flags); 1115 pPattern, pObj2Device, 8, 8, m_Options.m_Flags);
1116 pPatternBitmap = pEnlargedBitmap->StretchTo(width, height); 1116 pPatternBitmap = pEnlargedBitmap->StretchTo(width, height);
1117 delete pEnlargedBitmap; 1117 delete pEnlargedBitmap;
1118 } else { 1118 } else {
1119 pPatternBitmap = DrawPatternBitmap( 1119 pPatternBitmap = DrawPatternBitmap(
1120 m_pContext->m_pDocument, m_pContext->m_pPageCache, pPattern, 1120 m_pContext->GetDocument(), m_pContext->GetPageCache(), pPattern,
1121 pObj2Device, width, height, m_Options.m_Flags); 1121 pObj2Device, width, height, m_Options.m_Flags);
1122 } 1122 }
1123 if (!pPatternBitmap) { 1123 if (!pPatternBitmap) {
1124 m_pDevice->RestoreState(); 1124 m_pDevice->RestoreState();
1125 return; 1125 return;
1126 } 1126 }
1127 if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) { 1127 if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) {
1128 pPatternBitmap->ConvertColorScale(m_Options.m_ForeColor, 1128 pPatternBitmap->ConvertColorScale(m_Options.m_ForeColor,
1129 m_Options.m_BackColor); 1129 m_Options.m_BackColor);
1130 } 1130 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 } 1207 }
1208 } 1208 }
1209 if (bStroke) { 1209 if (bStroke) {
1210 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); 1210 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor();
1211 if (StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) { 1211 if (StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) {
1212 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); 1212 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE);
1213 bStroke = FALSE; 1213 bStroke = FALSE;
1214 } 1214 }
1215 } 1215 }
1216 } 1216 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp ('k') | core/src/fpdfapi/fpdf_render/render_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698