| 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 "SkDashPathEffect.h" | |
| 11 #include "SkRasterClip.h" | |
| 12 #include "SkScan.h" | |
| 13 #include "SkStroke.h" | |
| 14 #include "SkTLazy.h" | |
| 15 | |
| 16 #include "core/src/fxge/agg/include/fx_agg_driver.h" | 10 #include "core/src/fxge/agg/include/fx_agg_driver.h" |
| 17 #include "core/src/fxge/skia/fx_skia_blitter_new.h" | |
| 18 #include "core/src/fxge/skia/fx_skia_device.h" | 11 #include "core/src/fxge/skia/fx_skia_device.h" |
| 19 | 12 |
| 20 extern "C" { | 13 #include "SkCanvas.h" |
| 21 extern void FX_OUTPUT_LOG_FUNC(const char*, ...); | 14 #include "SkDashPathEffect.h" |
| 22 extern int FX_GET_TICK_FUNC(); | 15 #include "SkPaint.h" |
| 23 }; | 16 #include "SkPath.h" |
| 24 | 17 |
| 25 #ifdef _FOXIT_DEBUG_ | 18 static SkPath BuildPath(const CFX_PathData* pPathData, |
| 26 #define FOXIT_DEBUG1(msg) FX_OUTPUT_LOG_FUNC(msg) | 19 const CFX_Matrix* pObject2Device) { |
| 27 #define FOXIT_DEBUG2(msg, para) FX_OUTPUT_LOG_FUNC(msg, para) | 20 SkPath skPath; |
| 28 #define FOXIT_DEBUG3(msg, para1, para2) FX_OUTPUT_LOG_FUNC(msg, para1, para2) | |
| 29 #define FOXIT_DEBUG4(msg, para1, para2, para3) \ | |
| 30 FX_OUTPUT_LOG_FUNC(msg, para1, para2, para3) | |
| 31 #define FOXIT_DEBUG5(msg, para1, para2, para3, param4) \ | |
| 32 FX_OUTPUT_LOG_FUNC(msg, para1, para2, para3, param4) | |
| 33 #else | |
| 34 #define FOXIT_DEBUG1(msg) | |
| 35 #define FOXIT_DEBUG2(msg, para) | |
| 36 #define FOXIT_DEBUG3(msg, para1, para2) | |
| 37 #define FOXIT_DEBUG4(msg, para1, para2, para3) | |
| 38 #define FOXIT_DEBUG5(msg, para1, para2, para3, param4) | |
| 39 #endif | |
| 40 | |
| 41 /// Run-length-encoded supersampling antialiased blitter. | |
| 42 class SuperBlitter_skia { | |
| 43 public: | |
| 44 static void DrawPath(const SkPath& srcPath, | |
| 45 SkBlitter* blitter, | |
| 46 const SkRasterClip& rect, | |
| 47 const SkPaint& origPaint); | |
| 48 }; | |
| 49 FX_BOOL FxSkDrawTreatAsHairline(const SkPaint& paint, SkScalar* coverage) { | |
| 50 if (SkPaint::kStroke_Style != paint.getStyle()) | |
| 51 return FALSE; | |
| 52 FXSYS_assert(coverage); | |
| 53 SkScalar strokeWidth = paint.getStrokeWidth(); | |
| 54 if (0 == strokeWidth) { | |
| 55 *coverage = SK_Scalar1; | |
| 56 return TRUE; | |
| 57 } | |
| 58 // if we get here, we need to try to fake a thick-stroke with a modulated | |
| 59 // hairline | |
| 60 if (!paint.isAntiAlias()) | |
| 61 return FALSE; | |
| 62 if (strokeWidth <= SK_Scalar1) { | |
| 63 *coverage = strokeWidth; | |
| 64 return TRUE; | |
| 65 } | |
| 66 return FALSE; | |
| 67 } | |
| 68 | |
| 69 void SuperBlitter_skia::DrawPath(const SkPath& srcPath, | |
| 70 SkBlitter* blitter, | |
| 71 const SkRasterClip& rect, | |
| 72 const SkPaint& origPaint) { | |
| 73 SkPath* pathPtr = (SkPath*)&srcPath; | |
| 74 bool doFill = true; | |
| 75 SkPath tmpPath; | |
| 76 SkTCopyOnFirstWrite<SkPaint> paint(origPaint); | |
| 77 { | |
| 78 SkScalar coverage; | |
| 79 if (FxSkDrawTreatAsHairline(origPaint, &coverage)) { | |
| 80 if (SK_Scalar1 == coverage) { | |
| 81 paint.writable()->setStrokeWidth(0); | |
| 82 } else if (1) { // xfermodeSupportsCoverageAsAlpha(xfer), we not use | |
| 83 // blend mode here, xfer aways NULL. | |
| 84 U8CPU newAlpha; | |
| 85 // this is the old technique, which we preserve for now so | |
| 86 // we don't change previous results (testing) | |
| 87 // the new way seems fine, its just (a tiny bit) different | |
| 88 int scale = (int)SkScalarMul(coverage, 256); | |
| 89 newAlpha = origPaint.getAlpha() * scale >> 8; | |
| 90 SkPaint* writablePaint = paint.writable(); | |
| 91 writablePaint->setStrokeWidth(0); | |
| 92 writablePaint->setAlpha(newAlpha); | |
| 93 } | |
| 94 } | |
| 95 } | |
| 96 if (paint->getPathEffect() || paint->getStyle() != SkPaint::kFill_Style) { | |
| 97 SkIRect devBounds = rect.getBounds(); | |
| 98 // outset to have slop for antialasing and hairlines | |
| 99 devBounds.outset(1, 1); | |
| 100 SkRect cullRect = SkRect::Make(devBounds); | |
| 101 doFill = paint->getFillPath(*pathPtr, &tmpPath, &cullRect); | |
| 102 pathPtr = &tmpPath; | |
| 103 } | |
| 104 // avoid possibly allocating a new path in transform if we can | |
| 105 SkPath* devPathPtr = pathPtr; | |
| 106 void (*proc)(const SkPath&, const SkRasterClip&, SkBlitter*); | |
| 107 if (doFill) { | |
| 108 if (paint->isAntiAlias()) { | |
| 109 proc = SkScan::AntiFillPath; | |
| 110 } else { | |
| 111 proc = SkScan::FillPath; | |
| 112 } | |
| 113 } else { // hairline | |
| 114 if (paint->isAntiAlias()) { | |
| 115 proc = SkScan::AntiHairPath; | |
| 116 } else { | |
| 117 proc = SkScan::HairPath; | |
| 118 } | |
| 119 } | |
| 120 proc(*devPathPtr, rect, blitter); | |
| 121 } | |
| 122 | |
| 123 class CSkia_PathData { | |
| 124 public: | |
| 125 CSkia_PathData() {} | |
| 126 ~CSkia_PathData() {} | |
| 127 SkPath m_PathData; | |
| 128 | |
| 129 void BuildPath(const CFX_PathData* pPathData, | |
| 130 const CFX_Matrix* pObject2Device); | |
| 131 }; | |
| 132 | |
| 133 void CSkia_PathData::BuildPath(const CFX_PathData* pPathData, | |
| 134 const CFX_Matrix* pObject2Device) { | |
| 135 const CFX_PathData* pFPath = pPathData; | 21 const CFX_PathData* pFPath = pPathData; |
| 136 int nPoints = pFPath->GetPointCount(); | 22 int nPoints = pFPath->GetPointCount(); |
| 137 FX_PATHPOINT* pPoints = pFPath->GetPoints(); | 23 FX_PATHPOINT* pPoints = pFPath->GetPoints(); |
| 138 for (int i = 0; i < nPoints; i++) { | 24 for (int i = 0; i < nPoints; i++) { |
| 139 FX_FIXFLOAT x = pPoints[i].m_PointX, y = pPoints[i].m_PointY; | 25 FX_FLOAT x = pPoints[i].m_PointX; |
| 26 FX_FLOAT y = pPoints[i].m_PointY; |
| 140 if (pObject2Device) | 27 if (pObject2Device) |
| 141 pObject2Device->Transform(x, y); | 28 pObject2Device->Transform(x, y); |
| 142 int point_type = pPoints[i].m_Flag & FXPT_TYPE; | 29 int point_type = pPoints[i].m_Flag & FXPT_TYPE; |
| 143 if (point_type == FXPT_MOVETO) { | 30 if (point_type == FXPT_MOVETO) { |
| 144 m_PathData.moveTo(x, y); | 31 skPath.moveTo(x, y); |
| 145 } else if (point_type == FXPT_LINETO) { | 32 } else if (point_type == FXPT_LINETO) { |
| 146 if (pPoints[i - 1].m_Flag == FXPT_MOVETO && | 33 skPath.lineTo(x, y); |
| 147 (i == nPoints - 1 || pPoints[i + 1].m_Flag == FXPT_MOVETO) && | |
| 148 FXSYS_abs(pPoints[i].m_PointX - pPoints[i - 1].m_PointX) < 0.4f && | |
| 149 FXSYS_abs(pPoints[i].m_PointY - pPoints[i - 1].m_PointY) < 0.4f) | |
| 150 // PDF line includes the destination point, unlike Windows line. | |
| 151 // We received some PDF which actually draws zero length lines. TESTDOC: | |
| 152 // summer cha show.pdf | |
| 153 // Therefore, we have to extend the line by 0.4 pixel here. | |
| 154 // But only for standalone segment. TESTDOC: bug #1434 - maze.pdf; | |
| 155 // TESTDOC: bug#1508 di704P_QIG_111.pdf | |
| 156 x += 0.4; | |
| 157 // TODO: we should actually tell skia vertex generator to process zero | |
| 158 // length stroked line | |
| 159 // (only butts are drawn) | |
| 160 m_PathData.lineTo(x, y); | |
| 161 } else if (point_type == FXPT_BEZIERTO) { | 34 } else if (point_type == FXPT_BEZIERTO) { |
| 162 FX_FIXFLOAT x2 = pPoints[i + 1].m_PointX, y2 = pPoints[i + 1].m_PointY; | 35 FX_FLOAT x2 = pPoints[i + 1].m_PointX, y2 = pPoints[i + 1].m_PointY; |
| 163 FX_FIXFLOAT x3 = pPoints[i + 2].m_PointX, y3 = pPoints[i + 2].m_PointY; | 36 FX_FLOAT x3 = pPoints[i + 2].m_PointX, y3 = pPoints[i + 2].m_PointY; |
| 164 if (pObject2Device) { | 37 if (pObject2Device) { |
| 165 pObject2Device->Transform(x2, y2); | 38 pObject2Device->Transform(x2, y2); |
| 166 pObject2Device->Transform(x3, y3); | 39 pObject2Device->Transform(x3, y3); |
| 167 } | 40 } |
| 168 m_PathData.cubicTo(x, y, x2, y2, x3, y3); | 41 skPath.cubicTo(x, y, x2, y2, x3, y3); |
| 169 i += 2; | 42 i += 2; |
| 170 } | 43 } |
| 171 if (pPoints[i].m_Flag & FXPT_CLOSEFIGURE) | 44 if (pPoints[i].m_Flag & FXPT_CLOSEFIGURE) |
| 172 m_PathData.close(); | 45 skPath.close(); |
| 173 } | 46 } |
| 47 return skPath; |
| 174 } | 48 } |
| 175 | 49 |
| 176 // convert a stroking path to scanlines | 50 // convert a stroking path to scanlines |
| 177 static void SkRasterizeStroke(SkPaint& spaint, | 51 void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint, |
| 178 SkPath* dstPathData, | 52 const CFX_GraphStateData* pGraphState) { |
| 179 SkPath& path_data, | |
| 180 const CFX_Matrix* pObject2Device, | |
| 181 const CFX_GraphStateData* pGraphState, | |
| 182 FX_FIXFLOAT scale = FIX8_ONE, | |
| 183 FX_BOOL bStrokeAdjust = FALSE, | |
| 184 FX_BOOL bTextMode = FALSE) { | |
| 185 SkPaint::Cap cap; | 53 SkPaint::Cap cap; |
| 186 switch (pGraphState->m_LineCap) { | 54 switch (pGraphState->m_LineCap) { |
| 187 case CFX_GraphStateData::LineCapRound: | 55 case CFX_GraphStateData::LineCapRound: |
| 188 cap = SkPaint::kRound_Cap; | 56 cap = SkPaint::kRound_Cap; |
| 189 break; | 57 break; |
| 190 case CFX_GraphStateData::LineCapSquare: | 58 case CFX_GraphStateData::LineCapSquare: |
| 191 cap = SkPaint::kSquare_Cap; | 59 cap = SkPaint::kSquare_Cap; |
| 192 break; | 60 break; |
| 193 default: | 61 default: |
| 194 cap = SkPaint::kButt_Cap; | 62 cap = SkPaint::kButt_Cap; |
| 195 break; | 63 break; |
| 196 } | 64 } |
| 197 SkPaint::Join join; | 65 SkPaint::Join join; |
| 198 switch (pGraphState->m_LineJoin) { | 66 switch (pGraphState->m_LineJoin) { |
| 199 case CFX_GraphStateData::LineJoinRound: | 67 case CFX_GraphStateData::LineJoinRound: |
| 200 join = SkPaint::kRound_Join; | 68 join = SkPaint::kRound_Join; |
| 201 break; | 69 break; |
| 202 case CFX_GraphStateData::LineJoinBevel: | 70 case CFX_GraphStateData::LineJoinBevel: |
| 203 join = SkPaint::kBevel_Join; | 71 join = SkPaint::kBevel_Join; |
| 204 break; | 72 break; |
| 205 default: | 73 default: |
| 206 join = SkPaint::kMiter_Join; | 74 join = SkPaint::kMiter_Join; |
| 207 break; | 75 break; |
| 208 } | 76 } |
| 209 FX_FIXFLOAT width = pGraphState->m_LineWidth * scale; | 77 FX_FLOAT width = pGraphState->m_LineWidth; |
| 210 FX_FIXFLOAT unit = fix32_to_8(fixdiv_8_8_to_32( | |
| 211 FIX8_ONE, (pObject2Device->GetXUnit() + pObject2Device->GetYUnit()) / 2)); | |
| 212 if (width <= unit) | |
| 213 width = unit; | |
| 214 | 78 |
| 215 if (pGraphState->m_DashArray) { | 79 if (pGraphState->m_DashArray) { |
| 216 int count = (pGraphState->m_DashCount + 1) / 2; | 80 int count = (pGraphState->m_DashCount + 1) / 2; |
| 217 SkScalar* intervals = FX_Alloc2D(SkScalar, count, sizeof(SkScalar)); | 81 SkScalar* intervals = FX_Alloc2D(SkScalar, count, sizeof(SkScalar)); |
| 218 // Set dash pattern | 82 // Set dash pattern |
| 219 for (int i = 0; i < count; i++) { | 83 for (int i = 0; i < count; i++) { |
| 220 FX_FIXFLOAT on = pGraphState->m_DashArray[i * 2]; | 84 FX_FLOAT on = pGraphState->m_DashArray[i * 2]; |
| 221 if (on <= 0.000001f) | 85 if (on <= 0.000001f) |
| 222 on = FIX8_ONE / 10; | 86 on = 1.f / 10; |
| 223 FX_FIXFLOAT off = i * 2 + 1 == pGraphState->m_DashCount | 87 FX_FLOAT off = i * 2 + 1 == pGraphState->m_DashCount |
| 224 ? on | 88 ? on |
| 225 : pGraphState->m_DashArray[i * 2 + 1]; | 89 : pGraphState->m_DashArray[i * 2 + 1]; |
| 226 if (off < 0) | 90 if (off < 0) |
| 227 off = 0; | 91 off = 0; |
| 228 intervals[i * 2] = on * scale; | 92 intervals[i * 2] = on; |
| 229 intervals[i * 2 + 1] = off * scale; | 93 intervals[i * 2 + 1] = off; |
| 230 } | 94 } |
| 231 SkDashPathEffect* pEffect = new SkDashPathEffect( | 95 spaint |
| 232 intervals, count * 2, pGraphState->m_DashPhase * scale); | 96 ->setPathEffect(SkDashPathEffect::Create(intervals, count * 2, |
| 233 spaint.setPathEffect(pEffect)->unref(); | 97 pGraphState->m_DashPhase)) |
| 234 spaint.setStrokeWidth(width); | 98 ->unref(); |
| 235 spaint.setStrokeMiter(pGraphState->m_MiterLimit); | |
| 236 spaint.setStrokeCap(cap); | |
| 237 spaint.setStrokeJoin(join); | |
| 238 spaint.getFillPath(path_data, dstPathData); | |
| 239 SkMatrix smatrix; | |
| 240 smatrix.setAll(pObject2Device->a, pObject2Device->c, pObject2Device->e, | |
| 241 pObject2Device->b, pObject2Device->d, pObject2Device->f, 0, | |
| 242 0, 1); | |
| 243 dstPathData->transform(smatrix); | |
| 244 FX_Free(intervals); | |
| 245 } else { | |
| 246 SkStroke stroker; | |
| 247 stroker.setCap(cap); | |
| 248 stroker.setJoin(join); | |
| 249 stroker.setMiterLimit(pGraphState->m_MiterLimit); | |
| 250 stroker.setWidth(width); | |
| 251 stroker.setDoFill(FALSE); | |
| 252 stroker.strokePath(path_data, dstPathData); | |
| 253 SkMatrix smatrix; | |
| 254 smatrix.setAll(pObject2Device->a, pObject2Device->c, pObject2Device->e, | |
| 255 pObject2Device->b, pObject2Device->d, pObject2Device->f, 0, | |
| 256 0, 1); | |
| 257 dstPathData->transform(smatrix); | |
| 258 } | 99 } |
| 100 spaint->setStyle(SkPaint::kStroke_Style); |
| 101 spaint->setAntiAlias(TRUE); |
| 102 spaint->setStrokeWidth(width); |
| 103 spaint->setStrokeMiter(pGraphState->m_MiterLimit); |
| 104 spaint->setStrokeCap(cap); |
| 105 spaint->setStrokeJoin(join); |
| 259 } | 106 } |
| 260 | 107 |
| 261 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, | 108 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, |
| 262 int dither_bits, | 109 int dither_bits, |
| 263 FX_BOOL bRgbByteOrder, | 110 FX_BOOL bRgbByteOrder, |
| 264 CFX_DIBitmap* pOriDevice, | 111 CFX_DIBitmap* pOriDevice, |
| 265 FX_BOOL bGroupKnockout) { | 112 FX_BOOL bGroupKnockout) { |
| 266 m_pAggDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, | 113 m_pAggDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, |
| 267 pOriDevice, bGroupKnockout); | 114 pOriDevice, bGroupKnockout); |
| 115 SkBitmap skBitmap; |
| 116 const CFX_DIBitmap* bitmap = m_pAggDriver->m_pBitmap; |
| 117 SkImageInfo imageInfo = |
| 118 SkImageInfo::Make(bitmap->GetWidth(), bitmap->GetHeight(), |
| 119 kN32_SkColorType, kOpaque_SkAlphaType); |
| 120 skBitmap.installPixels(imageInfo, bitmap->GetBuffer(), bitmap->GetPitch(), |
| 121 nullptr, /* to do : set color table */ |
| 122 nullptr, nullptr); |
| 123 m_canvas = new SkCanvas(skBitmap); |
| 268 } | 124 } |
| 125 |
| 269 CFX_SkiaDeviceDriver::~CFX_SkiaDeviceDriver() { | 126 CFX_SkiaDeviceDriver::~CFX_SkiaDeviceDriver() { |
| 127 #if 0 // TODO(caryclark) : mismatch on allocator ? |
| 128 delete m_canvas; |
| 129 #endif |
| 270 delete m_pAggDriver; | 130 delete m_pAggDriver; |
| 271 } | 131 } |
| 132 |
| 272 FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, | 133 FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, |
| 273 const FXTEXT_CHARPOS* pCharPos, | 134 const FXTEXT_CHARPOS* pCharPos, |
| 274 CFX_Font* pFont, | 135 CFX_Font* pFont, |
| 275 CFX_FontCache* pCache, | 136 CFX_FontCache* pCache, |
| 276 const CFX_Matrix* pObject2Device, | 137 const CFX_Matrix* pObject2Device, |
| 277 FX_FIXFLOAT font_size, | 138 FX_FLOAT font_size, |
| 278 FX_DWORD color, | 139 FX_DWORD color, |
| 279 int alpha_flag, | 140 int alpha_flag, |
| 280 void* pIccTransform) { | 141 void* pIccTransform) { |
| 281 return m_pAggDriver->DrawDeviceText(nChars, pCharPos, pFont, pCache, | 142 return m_pAggDriver->DrawDeviceText(nChars, pCharPos, pFont, pCache, |
| 282 pObject2Device, font_size, color, | 143 pObject2Device, font_size, color, |
| 283 alpha_flag, pIccTransform); | 144 alpha_flag, pIccTransform); |
| 284 } | 145 } |
| 146 |
| 285 int CFX_SkiaDeviceDriver::GetDeviceCaps(int caps_id) { | 147 int CFX_SkiaDeviceDriver::GetDeviceCaps(int caps_id) { |
| 286 return m_pAggDriver->GetDeviceCaps(caps_id); | 148 return m_pAggDriver->GetDeviceCaps(caps_id); |
| 287 } | 149 } |
| 150 |
| 288 void CFX_SkiaDeviceDriver::SaveState() { | 151 void CFX_SkiaDeviceDriver::SaveState() { |
| 152 m_canvas->save(); |
| 289 m_pAggDriver->SaveState(); | 153 m_pAggDriver->SaveState(); |
| 290 } | 154 } |
| 291 | 155 |
| 292 void CFX_SkiaDeviceDriver::RestoreState(FX_BOOL bKeepSaved) { | 156 void CFX_SkiaDeviceDriver::RestoreState(FX_BOOL bKeepSaved) { |
| 293 m_pAggDriver->RestoreState(bKeepSaved); | 157 m_pAggDriver->RestoreState(bKeepSaved); |
| 158 m_canvas->restore(); |
| 294 } | 159 } |
| 295 void CFX_SkiaDeviceDriver::SetClipMask(rasterizer_scanline_aa& rasterizer) { | 160 |
| 161 void CFX_SkiaDeviceDriver::SetClipMask( |
| 162 agg::rasterizer_scanline_aa& rasterizer) { |
| 296 m_pAggDriver->SetClipMask(rasterizer); | 163 m_pAggDriver->SetClipMask(rasterizer); |
| 297 } | 164 } |
| 298 void CFX_SkiaDeviceDriver::SetClipMask(SkPath& skPath, SkPaint* spaint) { | |
| 299 SkIRect clip_box; | |
| 300 clip_box.set(0, 0, fix0_to_8(GetDeviceCaps(FXDC_PIXEL_WIDTH)), | |
| 301 fix0_to_8(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); | |
| 302 clip_box.intersect(m_pAggDriver->m_pClipRgn->GetBox().left, | |
| 303 m_pAggDriver->m_pClipRgn->GetBox().top, | |
| 304 m_pAggDriver->m_pClipRgn->GetBox().right, | |
| 305 m_pAggDriver->m_pClipRgn->GetBox().bottom); | |
| 306 | 165 |
| 307 SkPath* pathPtr = &skPath; | |
| 308 | |
| 309 SkRect path_rect = skPath.getBounds(); | |
| 310 | |
| 311 clip_box.intersect(FXSYS_floor(path_rect.fLeft), FXSYS_floor(path_rect.fTop), | |
| 312 FXSYS_floor(path_rect.fRight) + 1, | |
| 313 FXSYS_floor(path_rect.fBottom) + 1); | |
| 314 CFX_DIBitmapRef mask; | |
| 315 CFX_DIBitmap* pThisLayer = mask.New(); | |
| 316 pThisLayer->Create(clip_box.width(), clip_box.height(), FXDIB_8bppMask); | |
| 317 pThisLayer->Clear(0); | |
| 318 | |
| 319 CFX_SkiaA8Renderer render; | |
| 320 render.Init(pThisLayer, clip_box.fLeft, clip_box.fTop); | |
| 321 | |
| 322 SkRasterClip rasterClip(clip_box); | |
| 323 SuperBlitter_skia::DrawPath(skPath, (SkBlitter*)&render, rasterClip, *spaint); | |
| 324 | |
| 325 // Finally, we have got the mask that we need, intersect with current clip | |
| 326 // region | |
| 327 m_pAggDriver->m_pClipRgn->IntersectMaskF(clip_box.fLeft, clip_box.fTop, mask); | |
| 328 } | |
| 329 FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill( | 166 FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathFill( |
| 330 const CFX_PathData* pPathData, // path info | 167 const CFX_PathData* pPathData, // path info |
| 331 const CFX_Matrix* pObject2Device, // optional transformation | 168 const CFX_Matrix* pObject2Device, // optional transformation |
| 332 int fill_mode // fill mode, WINDING or ALTERNATE | 169 int fill_mode // fill mode, WINDING or ALTERNATE |
| 333 ) { | 170 ) { |
| 334 if (!m_pAggDriver->m_pClipRgn) { | 171 if (!m_pAggDriver->m_pClipRgn) { |
| 335 m_pAggDriver->m_pClipRgn = new CFX_ClipRgn( | 172 m_pAggDriver->m_pClipRgn = new CFX_ClipRgn( |
| 336 GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); | 173 GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); |
| 337 } | 174 } |
| 338 | 175 |
| 339 if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { | 176 if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { |
| 340 CFX_FloatRect rectf; | 177 CFX_FloatRect rectf; |
| 341 if (pPathData->IsRect(pObject2Device, &rectf)) { | 178 if (pPathData->IsRect(pObject2Device, &rectf)) { |
| 342 rectf.Intersect( | 179 rectf.Intersect( |
| 343 CFX_FloatRect(0, 0, (FX_FIXFLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH), | 180 CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH), |
| 344 (FX_FIXFLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); | 181 (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); |
| 345 FX_RECT rect = rectf.GetOutterRect(); | 182 FX_RECT rect = rectf.GetOutterRect(); |
| 346 m_pAggDriver->m_pClipRgn->IntersectRect(rect); | 183 m_pAggDriver->m_pClipRgn->IntersectRect(rect); |
| 347 return TRUE; | 184 return TRUE; |
| 348 } | 185 } |
| 349 } | 186 } |
| 350 CSkia_PathData path_data; | 187 SkPath clip = BuildPath(pPathData, pObject2Device); |
| 351 path_data.BuildPath(pPathData, pObject2Device); | 188 clip.setFillType((fill_mode & 3) == FXFILL_WINDING |
| 352 path_data.m_PathData.close(); | 189 ? SkPath::kWinding_FillType |
| 353 path_data.m_PathData.setFillType((fill_mode & 3) == FXFILL_WINDING | 190 : SkPath::kEvenOdd_FillType); |
| 354 ? SkPath::kWinding_FillType | 191 const CFX_Matrix& m = *pObject2Device; |
| 355 : SkPath::kEvenOdd_FillType); | 192 #if 0 |
| 356 | 193 // TODO(caryclark) : don't clip quite yet |
| 357 SkPaint spaint; | 194 // need to understand how to save/restore to balance the clip |
| 358 spaint.setColor(0xffffffff); | 195 printf("m:(%g,%g,%g) (%g,%g,%g)\n", m.a, m.b, m.c, m.d, m.e, m.f); |
| 359 spaint.setAntiAlias(TRUE); | 196 clip.dump(); |
| 360 spaint.setStyle(SkPaint::kFill_Style); | 197 SkMatrix skMatrix; |
| 361 | 198 skMatrix.setAll(m.a, m.b, m.c, m.d, m.e, m.f, 0, 0, 1); |
| 362 SetClipMask(path_data.m_PathData, &spaint); | 199 m_canvas->setMatrix(skMatrix); |
| 200 m_canvas->clipPath(clip, SkRegion::kReplace_Op); |
| 201 #endif |
| 363 | 202 |
| 364 return TRUE; | 203 return TRUE; |
| 365 } | 204 } |
| 366 | 205 |
| 367 FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathStroke( | 206 FX_BOOL CFX_SkiaDeviceDriver::SetClip_PathStroke( |
| 368 const CFX_PathData* pPathData, // path info | 207 const CFX_PathData* pPathData, // path info |
| 369 const CFX_Matrix* pObject2Device, // optional transformation | 208 const CFX_Matrix* pObject2Device, // optional transformation |
| 370 const CFX_GraphStateData* pGraphState // graphic state, for pen attributes | 209 const CFX_GraphStateData* pGraphState // graphic state, for pen attributes |
| 371 ) { | 210 ) { |
| 372 if (!m_pAggDriver->m_pClipRgn) { | 211 if (!m_pAggDriver->m_pClipRgn) { |
| 373 m_pAggDriver->m_pClipRgn = new CFX_ClipRgn( | 212 m_pAggDriver->m_pClipRgn = new CFX_ClipRgn( |
| 374 GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); | 213 GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); |
| 375 } | 214 } |
| 376 | 215 |
| 377 // build path data | 216 // build path data |
| 378 CSkia_PathData path_data; | 217 SkPath skPath = BuildPath(pPathData, NULL); |
| 379 path_data.BuildPath(pPathData, NULL); | 218 skPath.setFillType(SkPath::kWinding_FillType); |
| 380 path_data.m_PathData.setFillType(SkPath::kWinding_FillType); | |
| 381 | 219 |
| 382 SkPaint spaint; | 220 SkPaint spaint; |
| 383 spaint.setColor(0xffffffff); | 221 PaintStroke(&spaint, pGraphState); |
| 384 spaint.setStyle(SkPaint::kStroke_Style); | |
| 385 spaint.setAntiAlias(TRUE); | |
| 386 | |
| 387 SkPath dst_path; | 222 SkPath dst_path; |
| 388 SkRasterizeStroke(spaint, &dst_path, path_data.m_PathData, pObject2Device, | 223 spaint.getFillPath(skPath, &dst_path); |
| 389 pGraphState, 1, FALSE, 0); | 224 #if 01 |
| 390 spaint.setStyle(SkPaint::kFill_Style); | 225 SkMatrix skMatrix; |
| 391 SetClipMask(dst_path, &spaint); | 226 const CFX_Matrix& m = *pObject2Device; |
| 392 | 227 skMatrix.setAll(m.a, m.b, m.c, m.d, m.e, m.f, 0, 0, 1); |
| 228 m_canvas->setMatrix(skMatrix); |
| 229 // TODO(caryclark) : don't clip quite yet |
| 230 // need to understand how to save/restore so that clip is later undone |
| 231 m_canvas->clipPath(dst_path, SkRegion::kReplace_Op); |
| 232 #endif |
| 393 return TRUE; | 233 return TRUE; |
| 394 } | 234 } |
| 235 |
| 395 FX_BOOL CFX_SkiaDeviceDriver::RenderRasterizer( | 236 FX_BOOL CFX_SkiaDeviceDriver::RenderRasterizer( |
| 396 rasterizer_scanline_aa& rasterizer, | 237 agg::rasterizer_scanline_aa& rasterizer, |
| 397 FX_DWORD color, | 238 FX_DWORD color, |
| 398 FX_BOOL bFullCover, | 239 FX_BOOL bFullCover, |
| 399 FX_BOOL bGroupKnockout, | 240 FX_BOOL bGroupKnockout, |
| 400 int alpha_flag, | 241 int alpha_flag, |
| 401 void* pIccTransform) { | 242 void* pIccTransform) { |
| 402 return m_pAggDriver->RenderRasterizer( | 243 return m_pAggDriver->RenderRasterizer( |
| 403 rasterizer, color, bFullCover, bGroupKnockout, alpha_flag, pIccTransform); | 244 rasterizer, color, bFullCover, bGroupKnockout, alpha_flag, pIccTransform); |
| 404 } | 245 } |
| 405 FX_BOOL CFX_SkiaDeviceDriver::RenderRasterizerSkia(SkPath& skPath, | |
| 406 const SkPaint& origPaint, | |
| 407 SkIRect& rect, | |
| 408 FX_DWORD color, | |
| 409 FX_BOOL bFullCover, | |
| 410 FX_BOOL bGroupKnockout, | |
| 411 int alpha_flag, | |
| 412 void* pIccTransform, | |
| 413 FX_BOOL bFill) { | |
| 414 CFX_DIBitmap* pt = bGroupKnockout ? m_pAggDriver->GetBackDrop() : NULL; | |
| 415 CFX_SkiaRenderer render; | |
| 416 if (!render.Init(m_pAggDriver->m_pBitmap, pt, m_pAggDriver->m_pClipRgn, color, | |
| 417 bFullCover, m_pAggDriver->m_bRgbByteOrder, alpha_flag, | |
| 418 pIccTransform)) | |
| 419 return FALSE; | |
| 420 | |
| 421 SkRasterClip rasterClip(rect); | |
| 422 SuperBlitter_skia::DrawPath(skPath, (SkBlitter*)&render, rasterClip, | |
| 423 origPaint); | |
| 424 | |
| 425 return TRUE; | |
| 426 } | |
| 427 | 246 |
| 428 FX_BOOL CFX_SkiaDeviceDriver::DrawPath( | 247 FX_BOOL CFX_SkiaDeviceDriver::DrawPath( |
| 429 const CFX_PathData* pPathData, // path info | 248 const CFX_PathData* pPathData, // path info |
| 430 const CFX_Matrix* pObject2Device, // optional transformation | 249 const CFX_Matrix* pObject2Device, // optional transformation |
| 431 const CFX_GraphStateData* pGraphState, // graphic state, for pen attributes | 250 const CFX_GraphStateData* pGraphState, // graphic state, for pen attributes |
| 432 FX_DWORD fill_color, // fill color | 251 FX_DWORD fill_color, // fill color |
| 433 FX_DWORD stroke_color, // stroke color | 252 FX_DWORD stroke_color, // stroke color |
| 434 int fill_mode, // fill mode, WINDING or ALTERNATE. 0 for not filled | 253 int fill_mode, // fill mode, WINDING or ALTERNATE. 0 for not filled |
| 435 int alpha_flag, | 254 int alpha_flag, |
| 436 void* pIccTransform) { | 255 void* pIccTransform, |
| 256 int blend_type) { |
| 437 if (!GetBuffer()) | 257 if (!GetBuffer()) |
| 438 return TRUE; | 258 return TRUE; |
| 439 FOXIT_DEBUG1("CFX_SkiaDeviceDriver::DrawPath: entering"); | |
| 440 SkIRect rect; | 259 SkIRect rect; |
| 441 rect.set(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH), | 260 rect.set(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH), |
| 442 GetDeviceCaps(FXDC_PIXEL_HEIGHT)); | 261 GetDeviceCaps(FXDC_PIXEL_HEIGHT)); |
| 262 SkPath skPath = BuildPath(pPathData, pObject2Device); |
| 263 SkPaint spaint; |
| 264 spaint.setAntiAlias(TRUE); |
| 443 if ((fill_mode & 3) && fill_color) { | 265 if ((fill_mode & 3) && fill_color) { |
| 444 // We have to transform before building path data, otherwise we'll have | 266 skPath.setFillType((fill_mode & 3) == FXFILL_WINDING |
| 445 // flatting problem | 267 ? SkPath::kWinding_FillType |
| 446 // when we enlarge a small path (flatten before transformed) | 268 : SkPath::kEvenOdd_FillType); |
| 447 // TESTDOC: Bug #5115 - DS_S1Dimpact_lr.pdf | |
| 448 // build path data | |
| 449 CSkia_PathData path_data; | |
| 450 path_data.BuildPath(pPathData, pObject2Device); | |
| 451 // path_data.m_PathData.close(); | |
| 452 path_data.m_PathData.setFillType((fill_mode & 3) == FXFILL_WINDING | |
| 453 ? SkPath::kWinding_FillType | |
| 454 : SkPath::kEvenOdd_FillType); | |
| 455 | 269 |
| 456 SkPaint spaint; | |
| 457 spaint.setAntiAlias(TRUE); | |
| 458 spaint.setStyle(SkPaint::kFill_Style); | 270 spaint.setStyle(SkPaint::kFill_Style); |
| 459 spaint.setColor(fill_color); | 271 spaint.setColor(fill_color); |
| 460 if (!RenderRasterizerSkia(path_data.m_PathData, spaint, rect, fill_color, | 272 m_canvas->drawPath(skPath, spaint); |
| 461 fill_mode & FXFILL_FULLCOVER, FALSE, alpha_flag, | |
| 462 pIccTransform)) | |
| 463 return FALSE; | |
| 464 } | 273 } |
| 465 | |
| 466 int stroke_alpha = FXGETFLAG_COLORTYPE(alpha_flag) | 274 int stroke_alpha = FXGETFLAG_COLORTYPE(alpha_flag) |
| 467 ? FXGETFLAG_ALPHA_STROKE(alpha_flag) | 275 ? FXGETFLAG_ALPHA_STROKE(alpha_flag) |
| 468 : FXARGB_A(stroke_color); | 276 : FXARGB_A(stroke_color); |
| 469 | 277 |
| 470 if (pGraphState && stroke_alpha) { | 278 if (pGraphState && stroke_alpha) { |
| 471 // We split the matrix into two parts: first part doing the scaling, so we | |
| 472 // won't have the | |
| 473 // flatness problem, second part doing the transformation, so we don't have | |
| 474 // stroking geo problem. | |
| 475 // TESTDOC: Bug #5253 - test[1].pdf | |
| 476 CFX_Matrix matrix1, matrix2; | |
| 477 if (pObject2Device) { | |
| 478 matrix1.a = FXSYS_fabs(pObject2Device->a) > FXSYS_fabs(pObject2Device->b) | |
| 479 ? FXSYS_fabs(pObject2Device->a) | |
| 480 : FXSYS_fabs(pObject2Device->b); | |
| 481 matrix1.d = matrix1.a; // FXSYS_fabs(pObject2Device->c) > | |
| 482 // FXSYS_fabs(pObject2Device->d) ? | |
| 483 // pObject2Device->c : pObject2Device->d; | |
| 484 matrix2.Set(pObject2Device->a / matrix1.a, pObject2Device->b / matrix1.a, | |
| 485 pObject2Device->c / matrix1.d, pObject2Device->d / matrix1.d, | |
| 486 pObject2Device->e, pObject2Device->f); | |
| 487 } | |
| 488 // build path data | |
| 489 CSkia_PathData path_data; | |
| 490 path_data.BuildPath(pPathData, &matrix1); | |
| 491 path_data.m_PathData.setFillType(SkPath::kWinding_FillType); | |
| 492 | |
| 493 SkPaint spaint; | |
| 494 spaint.setColor(stroke_color); | 279 spaint.setColor(stroke_color); |
| 495 spaint.setStyle(SkPaint::kStroke_Style); | 280 PaintStroke(&spaint, pGraphState); |
| 496 spaint.setAntiAlias(TRUE); | 281 m_canvas->drawPath(skPath, spaint); |
| 497 SkPath dst_path; | |
| 498 SkRasterizeStroke(spaint, &dst_path, path_data.m_PathData, &matrix2, | |
| 499 pGraphState, matrix1.a, FALSE, 0); | |
| 500 spaint.setStyle(SkPaint::kFill_Style); | |
| 501 int fill_flag = FXGETFLAG_COLORTYPE(alpha_flag) << 8 | | |
| 502 FXGETFLAG_ALPHA_STROKE(alpha_flag); | |
| 503 | |
| 504 if (!RenderRasterizerSkia(dst_path, spaint, rect, stroke_color, | |
| 505 fill_mode & FXFILL_FULLCOVER, FALSE, fill_flag, | |
| 506 pIccTransform, FALSE)) | |
| 507 return FALSE; | |
| 508 } | 282 } |
| 509 | 283 |
| 510 return TRUE; | 284 return TRUE; |
| 511 } | 285 } |
| 512 | 286 |
| 513 FX_BOOL CFX_SkiaDeviceDriver::SetPixel(int x, | 287 FX_BOOL CFX_SkiaDeviceDriver::SetPixel(int x, |
| 514 int y, | 288 int y, |
| 515 FX_DWORD color, | 289 FX_DWORD color, |
| 516 int alpha_flag, | 290 int alpha_flag, |
| 517 void* pIccTransform) { | 291 void* pIccTransform) { |
| 518 return m_pAggDriver->SetPixel(x, y, color, alpha_flag, pIccTransform); | 292 return m_pAggDriver->SetPixel(x, y, color, alpha_flag, pIccTransform); |
| 519 } | 293 } |
| 520 | 294 |
| 521 FX_BOOL CFX_SkiaDeviceDriver::FillRect(const FX_RECT* pRect, | 295 FX_BOOL CFX_SkiaDeviceDriver::FillRect(const FX_RECT* pRect, |
| 522 FX_DWORD fill_color, | 296 FX_DWORD fill_color, |
| 523 int alpha_flag, | 297 int alpha_flag, |
| 524 void* pIccTransform) { | 298 void* pIccTransform, |
| 525 return m_pAggDriver->FillRect(pRect, fill_color, alpha_flag, pIccTransform); | 299 int blend_type) { |
| 300 SkPaint spaint; |
| 301 spaint.setAntiAlias(true); |
| 302 spaint.setColor(fill_color); |
| 303 |
| 304 m_canvas->drawRect( |
| 305 SkRect::MakeLTRB(pRect->left, pRect->top, pRect->right, pRect->bottom), |
| 306 spaint); |
| 307 return TRUE; |
| 526 } | 308 } |
| 527 | 309 |
| 528 FX_BOOL CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) { | 310 FX_BOOL CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) { |
| 529 return m_pAggDriver->GetClipBox(pRect); | 311 return m_pAggDriver->GetClipBox(pRect); |
| 530 } | 312 } |
| 531 | 313 |
| 532 FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, | 314 FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, |
| 533 int left, | 315 int left, |
| 534 int top, | 316 int top, |
| 535 void* pIccTransform, | 317 void* pIccTransform, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 551 | 333 |
| 552 FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, | 334 FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, |
| 553 FX_DWORD argb, | 335 FX_DWORD argb, |
| 554 int dest_left, | 336 int dest_left, |
| 555 int dest_top, | 337 int dest_top, |
| 556 int dest_width, | 338 int dest_width, |
| 557 int dest_height, | 339 int dest_height, |
| 558 const FX_RECT* pClipRect, | 340 const FX_RECT* pClipRect, |
| 559 FX_DWORD flags, | 341 FX_DWORD flags, |
| 560 int alpha_flag, | 342 int alpha_flag, |
| 561 void* pIccTransform) { | 343 void* pIccTransform, |
| 344 int blend_type) { |
| 562 return m_pAggDriver->StretchDIBits(pSource, argb, dest_left, dest_top, | 345 return m_pAggDriver->StretchDIBits(pSource, argb, dest_left, dest_top, |
| 563 dest_width, dest_height, pClipRect, flags, | 346 dest_width, dest_height, pClipRect, flags, |
| 564 alpha_flag, pIccTransform); | 347 alpha_flag, pIccTransform, blend_type); |
| 565 } | 348 } |
| 566 | 349 |
| 567 FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, | 350 FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, |
| 568 int bitmap_alpha, | 351 int bitmap_alpha, |
| 569 FX_DWORD argb, | 352 FX_DWORD argb, |
| 570 const CFX_Matrix* pMatrix, | 353 const CFX_Matrix* pMatrix, |
| 571 FX_DWORD render_flags, | 354 FX_DWORD render_flags, |
| 572 void*& handle, | 355 void*& handle, |
| 573 int alpha_flag, | 356 int alpha_flag, |
| 574 void* pIccTransform) { | 357 void* pIccTransform, |
| 358 int blend_type) { |
| 575 return m_pAggDriver->StartDIBits(pSource, bitmap_alpha, argb, pMatrix, | 359 return m_pAggDriver->StartDIBits(pSource, bitmap_alpha, argb, pMatrix, |
| 576 render_flags, handle, alpha_flag, | 360 render_flags, handle, alpha_flag, |
| 577 pIccTransform); | 361 pIccTransform, blend_type); |
| 578 } | 362 } |
| 579 | 363 |
| 580 FX_BOOL CFX_SkiaDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { | 364 FX_BOOL CFX_SkiaDeviceDriver::ContinueDIBits(void* pHandle, IFX_Pause* pPause) { |
| 581 return m_pAggDriver->ContinueDIBits(pHandle, pPause); | 365 return m_pAggDriver->ContinueDIBits(pHandle, pPause); |
| 582 } | 366 } |
| 583 | 367 |
| 584 void CFX_SkiaDeviceDriver::CancelDIBits(void* pHandle) { | 368 void CFX_SkiaDeviceDriver::CancelDIBits(void* pHandle) { |
| 585 m_pAggDriver->CancelDIBits(pHandle); | 369 m_pAggDriver->CancelDIBits(pHandle); |
| 586 } | 370 } |
| 587 | 371 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 613 if (!pBitmap->Create(width, height, format)) { | 397 if (!pBitmap->Create(width, height, format)) { |
| 614 delete pBitmap; | 398 delete pBitmap; |
| 615 return FALSE; | 399 return FALSE; |
| 616 } | 400 } |
| 617 SetBitmap(pBitmap); | 401 SetBitmap(pBitmap); |
| 618 CFX_SkiaDeviceDriver* pDriver = | 402 CFX_SkiaDeviceDriver* pDriver = |
| 619 new CFX_SkiaDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE); | 403 new CFX_SkiaDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE); |
| 620 SetDeviceDriver(pDriver); | 404 SetDeviceDriver(pDriver); |
| 621 return TRUE; | 405 return TRUE; |
| 622 } | 406 } |
| 407 |
| 623 CFX_SkiaDevice::~CFX_SkiaDevice() { | 408 CFX_SkiaDevice::~CFX_SkiaDevice() { |
| 624 if (m_bOwnedBitmap && GetBitmap()) | 409 if (m_bOwnedBitmap && GetBitmap()) |
| 625 delete GetBitmap(); | 410 delete GetBitmap(); |
| 626 } | 411 } |
| 627 | 412 |
| 413 #if 0 |
| 414 #include <stdarg.h> |
| 415 #include <stdio.h> |
| 416 |
| 417 void SkDebugf(const char format[], ...) { |
| 418 va_list args; |
| 419 va_start(args, format); |
| 420 vfprintf(stderr, format, args); |
| 421 va_end(args); |
| 422 } |
| 423 |
| 628 #endif | 424 #endif |
| 425 |
| 426 #endif |
| OLD | NEW |