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

Side by Side Diff: core/fxge/skia/fx_skia_device.cpp

Issue 1975143002: allow Skia to be the default graphics engine (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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/include/fx_ge.h ('k') | fpdfsdk/fpdf_progressive.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 #include "core/fxge/include/fx_ge.h" 5 #include "core/fxge/include/fx_ge.h"
6 6
7 #if defined(_SKIA_SUPPORT_) 7 #if defined(_SKIA_SUPPORT_)
8 #include "core/fxcodec/include/fx_codec.h" 8 #include "core/fxcodec/include/fx_codec.h"
9 9
10 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" 10 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h"
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 return TRUE; 1132 return TRUE;
1133 return ((CFX_ImageRenderer*)pHandle)->Continue(pPause); 1133 return ((CFX_ImageRenderer*)pHandle)->Continue(pPause);
1134 } 1134 }
1135 1135
1136 void CFX_SkiaDeviceDriver::CancelDIBits(void* pHandle) { 1136 void CFX_SkiaDeviceDriver::CancelDIBits(void* pHandle) {
1137 if (!m_pBitmap->GetBuffer()) 1137 if (!m_pBitmap->GetBuffer())
1138 return; 1138 return;
1139 delete (CFX_ImageRenderer*)pHandle; 1139 delete (CFX_ImageRenderer*)pHandle;
1140 } 1140 }
1141 1141
1142 CFX_SkiaDevice::CFX_SkiaDevice() { 1142 CFX_FxgeDevice::CFX_FxgeDevice() {
1143 m_bOwnedBitmap = FALSE; 1143 m_bOwnedBitmap = FALSE;
1144 } 1144 }
1145 1145
1146 SkPictureRecorder* CFX_SkiaDevice::CreateRecorder(int size_x, int size_y) { 1146 SkPictureRecorder* CFX_FxgeDevice::CreateRecorder(int size_x, int size_y) {
1147 CFX_SkiaDeviceDriver* skDriver = new CFX_SkiaDeviceDriver(size_x, size_y); 1147 CFX_SkiaDeviceDriver* skDriver = new CFX_SkiaDeviceDriver(size_x, size_y);
1148 SetDeviceDriver(skDriver); 1148 SetDeviceDriver(skDriver);
1149 return skDriver->GetRecorder(); 1149 return skDriver->GetRecorder();
1150 } 1150 }
1151 1151
1152 FX_BOOL CFX_SkiaDevice::Attach(CFX_DIBitmap* pBitmap, 1152 bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap,
1153 int dither_bits, 1153 int dither_bits,
1154 FX_BOOL bRgbByteOrder, 1154 bool bRgbByteOrder,
1155 CFX_DIBitmap* pOriDevice, 1155 CFX_DIBitmap* pOriDevice,
1156 FX_BOOL bGroupKnockout) { 1156 bool bGroupKnockout) {
1157 if (!pBitmap) 1157 if (!pBitmap)
1158 return FALSE; 1158 return false;
1159 SetBitmap(pBitmap); 1159 SetBitmap(pBitmap);
1160 SetDeviceDriver(new CFX_SkiaDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, 1160 SetDeviceDriver(new CFX_SkiaDeviceDriver(pBitmap, dither_bits, bRgbByteOrder,
1161 pOriDevice, bGroupKnockout)); 1161 pOriDevice, bGroupKnockout));
1162 return TRUE; 1162 return true;
1163 } 1163 }
1164 1164
1165 FX_BOOL CFX_SkiaDevice::AttachRecorder(SkPictureRecorder* recorder) { 1165 bool CFX_FxgeDevice::AttachRecorder(SkPictureRecorder* recorder) {
1166 if (!recorder) 1166 if (!recorder)
1167 return FALSE; 1167 return false;
1168 SetDeviceDriver(new CFX_SkiaDeviceDriver(recorder)); 1168 SetDeviceDriver(new CFX_SkiaDeviceDriver(recorder));
1169 return TRUE; 1169 return true;
1170 } 1170 }
1171 1171
1172 FX_BOOL CFX_SkiaDevice::Create(int width, 1172 bool CFX_FxgeDevice::Create(int width,
1173 int height, 1173 int height,
1174 FXDIB_Format format, 1174 FXDIB_Format format,
1175 int dither_bits, 1175 int dither_bits,
1176 CFX_DIBitmap* pOriDevice) { 1176 CFX_DIBitmap* pOriDevice) {
1177 m_bOwnedBitmap = TRUE; 1177 m_bOwnedBitmap = TRUE;
1178 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; 1178 CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
1179 if (!pBitmap->Create(width, height, format)) { 1179 if (!pBitmap->Create(width, height, format)) {
1180 delete pBitmap; 1180 delete pBitmap;
1181 return FALSE; 1181 return false;
1182 } 1182 }
1183 SetBitmap(pBitmap); 1183 SetBitmap(pBitmap);
1184 CFX_SkiaDeviceDriver* pDriver = 1184 CFX_SkiaDeviceDriver* pDriver =
1185 new CFX_SkiaDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE); 1185 new CFX_SkiaDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE);
1186 SetDeviceDriver(pDriver); 1186 SetDeviceDriver(pDriver);
1187 return TRUE; 1187 return true;
1188 } 1188 }
1189 1189
1190 CFX_SkiaDevice::~CFX_SkiaDevice() { 1190 CFX_FxgeDevice::~CFX_FxgeDevice() {
1191 if (m_bOwnedBitmap && GetBitmap()) 1191 if (m_bOwnedBitmap && GetBitmap())
1192 delete GetBitmap(); 1192 delete GetBitmap();
1193 } 1193 }
1194 1194
1195 #endif 1195 #endif
OLDNEW
« no previous file with comments | « core/fxge/include/fx_ge.h ('k') | fpdfsdk/fpdf_progressive.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698