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

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

Issue 2504863003: fix corpus tests (Closed)
Patch Set: merge with tot Created 4 years, 1 month 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/skia/fx_skia_device.h ('k') | no next file » | 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "core/fxcodec/fx_codec.h" 8 #include "core/fxcodec/fx_codec.h"
9 #include "core/fxcrt/fx_memory.h" 9 #include "core/fxcrt/fx_memory.h"
10 10
11 #include "core/fpdfapi/page/cpdf_shadingpattern.h" 11 #include "core/fpdfapi/page/cpdf_shadingpattern.h"
12 #include "core/fpdfapi/page/pageint.h" 12 #include "core/fpdfapi/page/pageint.h"
13 #include "core/fpdfapi/parser/cpdf_array.h" 13 #include "core/fpdfapi/parser/cpdf_array.h"
14 #include "core/fpdfapi/parser/cpdf_dictionary.h" 14 #include "core/fpdfapi/parser/cpdf_dictionary.h"
15 #include "core/fpdfapi/parser/cpdf_stream_acc.h" 15 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
16 #include "core/fxge/cfx_fxgedevice.h" 16 #include "core/fxge/cfx_fxgedevice.h"
17 #include "core/fxge/cfx_gemodule.h" 17 #include "core/fxge/cfx_gemodule.h"
18 #include "core/fxge/cfx_graphstatedata.h" 18 #include "core/fxge/cfx_graphstatedata.h"
19 #include "core/fxge/cfx_pathdata.h" 19 #include "core/fxge/cfx_pathdata.h"
20 #include "core/fxge/cfx_renderdevice.h" 20 #include "core/fxge/cfx_renderdevice.h"
21 #include "core/fxge/skia/fx_skia_device.h" 21 #include "core/fxge/skia/fx_skia_device.h"
22 22
23 #ifndef _SKIA_SUPPORT_ 23 #ifdef _SKIA_SUPPORT_PATHS_
24 #include "core/fxge/ge/cfx_cliprgn.h" 24 #include "core/fxge/ge/cfx_cliprgn.h"
25 #endif 25 #endif // _SKIA_SUPPORT_PATHS_
26 26
27 #include "third_party/base/ptr_util.h" 27 #include "third_party/base/ptr_util.h"
28 28
29 #include "third_party/skia/include/core/SkCanvas.h" 29 #include "third_party/skia/include/core/SkCanvas.h"
30 #include "third_party/skia/include/core/SkPaint.h" 30 #include "third_party/skia/include/core/SkPaint.h"
31 #include "third_party/skia/include/core/SkPath.h" 31 #include "third_party/skia/include/core/SkPath.h"
32 #include "third_party/skia/include/core/SkStream.h"
32 #include "third_party/skia/include/effects/SkDashPathEffect.h" 33 #include "third_party/skia/include/effects/SkDashPathEffect.h"
33 #include "third_party/skia/include/pathops/SkPathOps.h" 34 #include "third_party/skia/include/pathops/SkPathOps.h"
34 35
35 #ifdef _SKIA_SUPPORT_ 36 #ifdef _SKIA_SUPPORT_
36 #include "third_party/skia/include/core/SkColorFilter.h" 37 #include "third_party/skia/include/core/SkColorFilter.h"
37 #include "third_party/skia/include/core/SkColorPriv.h" 38 #include "third_party/skia/include/core/SkColorPriv.h"
38 #include "third_party/skia/include/core/SkMaskFilter.h" 39 #include "third_party/skia/include/core/SkMaskFilter.h"
39 #include "third_party/skia/include/core/SkPictureRecorder.h" 40 #include "third_party/skia/include/core/SkPictureRecorder.h"
40 #include "third_party/skia/include/core/SkShader.h" 41 #include "third_party/skia/include/core/SkShader.h"
41 #include "third_party/skia/include/core/SkStream.h"
42 #include "third_party/skia/include/core/SkTypeface.h" 42 #include "third_party/skia/include/core/SkTypeface.h"
43 #include "third_party/skia/include/effects/SkGradientShader.h" 43 #include "third_party/skia/include/effects/SkGradientShader.h"
44 #endif 44 #endif // _SKIA_SUPPORT_
45 45
46 #ifdef SK_DEBUG 46 #ifdef SK_DEBUG
47 #include "third_party/skia/include/core/SkClipStack.h" 47 #include "third_party/skia/include/core/SkClipStack.h"
48 #endif 48 #endif // SK_DEBUG
49 49
50 namespace { 50 namespace {
51 51
52 #ifndef _SKIA_SUPPORT_ 52 #ifdef _SKIA_SUPPORT_PATHS_
53 void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, 53 void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap,
54 int dest_left, 54 int dest_left,
55 int dest_top, 55 int dest_top,
56 int width, 56 int width,
57 int height, 57 int height,
58 const CFX_DIBSource* pSrcBitmap, 58 const CFX_DIBSource* pSrcBitmap,
59 int src_left, 59 int src_left,
60 int src_top) { 60 int src_top) {
61 if (!pBitmap) 61 if (!pBitmap)
62 return; 62 return;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 dest_scan += 4; 142 dest_scan += 4;
143 } 143 }
144 } 144 }
145 } 145 }
146 return; 146 return;
147 } 147 }
148 148
149 ASSERT(false); 149 ASSERT(false);
150 } 150 }
151 151
152 #endif 152 #endif // _SKIA_SUPPORT_PATHS_
153 153
154 #define SHOW_SKIA_PATH 0 // set to 1 to print the path contents 154 #define SHOW_SKIA_PATH 0 // set to 1 to print the path contents
155 #define DRAW_SKIA_CLIP 0 // set to 1 to draw a green rectangle around the clip 155 #define DRAW_SKIA_CLIP 0 // set to 1 to draw a green rectangle around the clip
156 156
157 void DebugShowSkiaPath(const SkPath& path) { 157 void DebugShowSkiaPath(const SkPath& path) {
158 #if SHOW_SKIA_PATH 158 #if SHOW_SKIA_PATH
159 char buffer[4096]; 159 char buffer[4096];
160 sk_bzero(buffer, sizeof(buffer)); 160 sk_bzero(buffer, sizeof(buffer));
161 SkMemoryWStream stream(buffer, sizeof(buffer)); 161 SkMemoryWStream stream(buffer, sizeof(buffer));
162 path.dump(&stream, false, false); 162 path.dump(&stream, false, false);
163 printf("%s\n", buffer); 163 printf("%s\n", buffer);
164 #endif // SHOW_SKIA_PATH 164 #endif // SHOW_SKIA_PATH
165 } 165 }
166 166
167 void DebugShowCanvasMatrix(const SkCanvas* canvas) { 167 void DebugShowCanvasMatrix(const SkCanvas* canvas) {
168 #if SHOW_SKIA_PATH 168 #if SHOW_SKIA_PATH
169 SkMatrix matrix = canvas->getTotalMatrix(); 169 SkMatrix matrix = canvas->getTotalMatrix();
170 SkScalar m[9]; 170 SkScalar m[9];
171 matrix.get9(m); 171 matrix.get9(m);
172 printf("(%g,%g,%g) (%g,%g,%g) (%g,%g,%g)\n", m[0], m[1], m[2], m[3], m[4], 172 printf("(%g,%g,%g) (%g,%g,%g) (%g,%g,%g)\n", m[0], m[1], m[2], m[3], m[4],
173 m[5], m[6], m[7], m[8]); 173 m[5], m[6], m[7], m[8]);
174 #endif // SHOW_SKIA_PATH 174 #endif // SHOW_SKIA_PATH
175 } 175 }
176 176
177 void DebugShowCanvasClip(const SkCanvas* canvas) {
178 #if SHOW_SKIA_PATH
179 SkRect local;
180 SkIRect device;
181 canvas->getClipBounds(&local);
182 printf("local bounds %g %g %g %g\n", local.fLeft, local.fTop, local.fRight,
183 local.fBottom);
184 canvas->getClipDeviceBounds(&device);
185 printf("device bounds %d %d %d %d\n", device.fLeft, device.fTop,
186 device.fRight, device.fBottom);
187 const SkClipStack* clipStack = canvas->getClipStack();
188 clipStack->dump();
189 #endif // SHOW_SKIA_PATH
190 }
191
177 #if DRAW_SKIA_CLIP 192 #if DRAW_SKIA_CLIP
178 193
179 SkPaint DebugClipPaint() { 194 SkPaint DebugClipPaint() {
180 SkPaint paint; 195 SkPaint paint;
181 paint.setAntiAlias(true); 196 paint.setAntiAlias(true);
182 paint.setColor(SK_ColorGREEN); 197 paint.setColor(SK_ColorGREEN);
183 paint.setStyle(SkPaint::kStroke_Style); 198 paint.setStyle(SkPaint::kStroke_Style);
184 return paint; 199 return paint;
185 } 200 }
186 201
187 #ifdef _SKIA_SUPPORT_
188 void DebugDrawSkiaClipRect(SkCanvas* canvas, const SkRect& rect) { 202 void DebugDrawSkiaClipRect(SkCanvas* canvas, const SkRect& rect) {
189 SkPaint paint = DebugClipPaint(); 203 SkPaint paint = DebugClipPaint();
190 canvas->drawRect(rect, paint); 204 canvas->drawRect(rect, paint);
191 } 205 }
192 #endif
193 206
194 void DebugDrawSkiaClipPath(SkCanvas* canvas, const SkPath& path) { 207 void DebugDrawSkiaClipPath(SkCanvas* canvas, const SkPath& path) {
195 SkPaint paint = DebugClipPaint(); 208 SkPaint paint = DebugClipPaint();
196 canvas->drawPath(path, paint); 209 canvas->drawPath(path, paint);
197 } 210 }
198 211
199 #else // DRAW_SKIA_CLIP 212 #else // DRAW_SKIA_CLIP
200 213
201 #ifdef _SKIA_SUPPORT_
202 void DebugDrawSkiaClipRect(SkCanvas* canvas, const SkRect& rect) {} 214 void DebugDrawSkiaClipRect(SkCanvas* canvas, const SkRect& rect) {}
203 #endif
204 215
205 void DebugDrawSkiaClipPath(SkCanvas* canvas, const SkPath& path) {} 216 void DebugDrawSkiaClipPath(SkCanvas* canvas, const SkPath& path) {}
206 217
207 #endif // DRAW_SKIA_CLIP 218 #endif // DRAW_SKIA_CLIP
208 219
209 #undef SHOW_SKIA_PATH
210 #undef DRAW_SKIA_CLIP
211
212 #ifdef _SKIA_SUPPORT_ 220 #ifdef _SKIA_SUPPORT_
213 static void DebugValidate(const CFX_DIBitmap* bitmap, 221 static void DebugValidate(const CFX_DIBitmap* bitmap,
214 const CFX_DIBitmap* device) { 222 const CFX_DIBitmap* device) {
215 if (bitmap) { 223 if (bitmap) {
216 SkASSERT(bitmap->GetBPP() == 8 || bitmap->GetBPP() == 32); 224 SkASSERT(bitmap->GetBPP() == 8 || bitmap->GetBPP() == 32);
217 if (bitmap->GetBPP() == 32) { 225 if (bitmap->GetBPP() == 32) {
218 bitmap->DebugVerifyBitmapIsPreMultiplied(); 226 bitmap->DebugVerifyBitmapIsPreMultiplied();
219 } 227 }
220 } 228 }
221 if (device) { 229 if (device) {
222 SkASSERT(device->GetBPP() == 8 || device->GetBPP() == 32); 230 SkASSERT(device->GetBPP() == 8 || device->GetBPP() == 32);
223 if (device->GetBPP() == 32) { 231 if (device->GetBPP() == 32) {
224 device->DebugVerifyBitmapIsPreMultiplied(); 232 device->DebugVerifyBitmapIsPreMultiplied();
225 } 233 }
226 } 234 }
227 } 235 }
228 #endif 236 #endif // _SKIA_SUPPORT_
229 237
230 SkPath BuildPath(const CFX_PathData* pPathData) { 238 SkPath BuildPath(const CFX_PathData* pPathData) {
231 SkPath skPath; 239 SkPath skPath;
232 const CFX_PathData* pFPath = pPathData; 240 const CFX_PathData* pFPath = pPathData;
233 int nPoints = pFPath->GetPointCount(); 241 int nPoints = pFPath->GetPointCount();
234 FX_PATHPOINT* pPoints = pFPath->GetPoints(); 242 FX_PATHPOINT* pPoints = pFPath->GetPoints();
235 for (int i = 0; i < nPoints; i++) { 243 for (int i = 0; i < nPoints; i++) {
236 FX_FLOAT x = pPoints[i].m_PointX; 244 FX_FLOAT x = pPoints[i].m_PointX;
237 FX_FLOAT y = pPoints[i].m_PointY; 245 FX_FLOAT y = pPoints[i].m_PointY;
238 int point_type = pPoints[i].m_Flag & FXPT_TYPE; 246 int point_type = pPoints[i].m_Flag & FXPT_TYPE;
239 if (point_type == FXPT_MOVETO) { 247 if (point_type == FXPT_MOVETO) {
240 skPath.moveTo(x, y); 248 skPath.moveTo(x, y);
241 } else if (point_type == FXPT_LINETO) { 249 } else if (point_type == FXPT_LINETO) {
242 skPath.lineTo(x, y); 250 skPath.lineTo(x, y);
243 } else if (point_type == FXPT_BEZIERTO) { 251 } else if (point_type == FXPT_BEZIERTO) {
244 FX_FLOAT x2 = pPoints[i + 1].m_PointX, y2 = pPoints[i + 1].m_PointY; 252 FX_FLOAT x2 = pPoints[i + 1].m_PointX, y2 = pPoints[i + 1].m_PointY;
245 FX_FLOAT x3 = pPoints[i + 2].m_PointX, y3 = pPoints[i + 2].m_PointY; 253 FX_FLOAT x3 = pPoints[i + 2].m_PointX, y3 = pPoints[i + 2].m_PointY;
246 skPath.cubicTo(x, y, x2, y2, x3, y3); 254 skPath.cubicTo(x, y, x2, y2, x3, y3);
247 i += 2; 255 i += 2;
248 } 256 }
249 if (pPoints[i].m_Flag & FXPT_CLOSEFIGURE) 257 if (pPoints[i].m_Flag & FXPT_CLOSEFIGURE)
250 skPath.close(); 258 skPath.close();
251 } 259 }
252 return skPath; 260 return skPath;
253 } 261 }
254 262
255 SkMatrix ToSkMatrix(const CFX_Matrix& m) { 263 SkMatrix ToSkMatrix(const CFX_Matrix& m) {
256 SkMatrix skMatrix; 264 SkMatrix skMatrix;
257 skMatrix.setAll(m.a, m.b, m.e, m.c, m.d, m.f, 0, 0, 1); 265 skMatrix.setAll(m.a, m.c, m.e, m.b, m.d, m.f, 0, 0, 1);
258 return skMatrix; 266 return skMatrix;
259 } 267 }
260 268
261 #ifdef _SKIA_SUPPORT_ 269 #ifdef _SKIA_SUPPORT_
262 // use when pdf's y-axis points up insead of down 270 // use when pdf's y-axis points up insead of down
263 SkMatrix ToFlippedSkMatrix(const CFX_Matrix& m, SkScalar flip) { 271 SkMatrix ToFlippedSkMatrix(const CFX_Matrix& m, SkScalar flip) {
264 SkMatrix skMatrix; 272 SkMatrix skMatrix;
265 skMatrix.setAll(m.a * flip, -m.c * flip, m.e, m.b * flip, -m.d * flip, m.f, 0, 273 skMatrix.setAll(m.a * flip, -m.c * flip, m.e, m.b * flip, -m.d * flip, m.f, 0,
266 0, 1); 274 0, 1);
267 return skMatrix; 275 return skMatrix;
268 } 276 }
269 #endif 277 #endif // _SKIA_SUPPORT_
270 278
271 SkBlendMode GetSkiaBlendMode(int blend_type) { 279 SkBlendMode GetSkiaBlendMode(int blend_type) {
272 switch (blend_type) { 280 switch (blend_type) {
273 case FXDIB_BLEND_MULTIPLY: 281 case FXDIB_BLEND_MULTIPLY:
274 return SkBlendMode::kMultiply; 282 return SkBlendMode::kMultiply;
275 case FXDIB_BLEND_SCREEN: 283 case FXDIB_BLEND_SCREEN:
276 return SkBlendMode::kScreen; 284 return SkBlendMode::kScreen;
277 case FXDIB_BLEND_OVERLAY: 285 case FXDIB_BLEND_OVERLAY:
278 return SkBlendMode::kOverlay; 286 return SkBlendMode::kOverlay;
279 case FXDIB_BLEND_DARKEN: 287 case FXDIB_BLEND_DARKEN:
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 colorType = SkColorType::kUnknown_SkColorType; 591 colorType = SkColorType::kUnknown_SkColorType;
584 } 592 }
585 SkImageInfo imageInfo = 593 SkImageInfo imageInfo =
586 SkImageInfo::Make(width, height, colorType, alphaType); 594 SkImageInfo::Make(width, height, colorType, alphaType);
587 skBitmap->installPixels(imageInfo, buffer, rowBytes, *ctPtr, nullptr, 595 skBitmap->installPixels(imageInfo, buffer, rowBytes, *ctPtr, nullptr,
588 nullptr); 596 nullptr);
589 *widthPtr = width; 597 *widthPtr = width;
590 *heightPtr = height; 598 *heightPtr = height;
591 return true; 599 return true;
592 } 600 }
593 #endif 601 #endif // _SKIA_SUPPORT_
594 602
595 } // namespace 603 } // namespace
596 604
597 // Encapsulate the state used for successive text and path draws so that 605 // Encapsulate the state used for successive text and path draws so that
598 // they can be combined. 606 // they can be combined.
599 class SkiaState { 607 class SkiaState {
600 public: 608 public:
601 enum class Clip { 609 enum class Clip {
602 kSave, 610 kSave,
603 kPath, 611 kPath,
604 }; 612 };
605 613
606 // mark all cached state as uninitialized 614 // mark all cached state as uninitialized
607 SkiaState() 615 SkiaState()
608 : m_pFont(nullptr), 616 : m_pFont(nullptr),
609 m_fontSize(0), 617 m_fontSize(0),
610 m_fillColor(0), 618 m_fillColor(0),
611 m_strokeColor(0), 619 m_strokeColor(0),
612 m_blendType(0), 620 m_blendType(0),
613 m_commandIndex(0), 621 m_commandIndex(0),
614 #if _SKIA_SUPPORT_ 622 #if _SKIA_SUPPORT_
615 m_drawText(false), 623 m_drawText(false),
616 #endif 624 #endif // _SKIA_SUPPORT_
617 m_drawPath(false), 625 m_drawPath(false),
618 m_fillPath(false), 626 m_fillPath(false),
619 m_debugDisable(true) { 627 m_debugDisable(true) {
620 } 628 }
621 629
622 bool DrawPath(const CFX_PathData* pPathData, 630 bool DrawPath(const CFX_PathData* pPathData,
623 const CFX_Matrix* pMatrix, 631 const CFX_Matrix* pMatrix,
624 const CFX_GraphStateData* pDrawState, 632 const CFX_GraphStateData* pDrawState,
625 uint32_t fill_color, 633 uint32_t fill_color,
626 uint32_t stroke_color, 634 uint32_t stroke_color,
627 int fill_mode, 635 int fill_mode,
628 int blend_type, 636 int blend_type,
629 CFX_SkiaDeviceDriver* pDriver) { 637 CFX_SkiaDeviceDriver* pDriver) {
630 if (m_debugDisable) 638 if (m_debugDisable)
631 return false; 639 return false;
632 if (m_commandIndex < m_commands.count()) 640 if (m_commandIndex < m_commands.count())
633 FlushCommands(pDriver); 641 FlushCommands(pDriver);
634 #if _SKIA_SUPPORT_ 642 #if _SKIA_SUPPORT_
635 if (m_drawText) 643 if (m_drawText)
636 FlushText(pDriver); 644 FlushText(pDriver);
637 #endif 645 #endif // _SKIA_SUPPORT_
638 if (m_drawPath && DrawChanged(pMatrix, pDrawState, fill_color, stroke_color, 646 if (m_drawPath && DrawChanged(pMatrix, pDrawState, fill_color, stroke_color,
639 fill_mode, blend_type)) { 647 fill_mode, blend_type)) {
640 FlushPath(pDriver); 648 FlushPath(pDriver);
641 } 649 }
642 if (!m_drawPath) { 650 if (!m_drawPath) {
643 m_skPath.reset(); 651 m_skPath.reset();
644 m_fillPath = (fill_mode & 3) && fill_color; 652 m_fillPath = (fill_mode & 3) && fill_color;
645 m_skPath.setFillType((fill_mode & 3) == FXFILL_ALTERNATE 653 m_skPath.setFillType((fill_mode & 3) == FXFILL_ALTERNATE
646 ? SkPath::kEvenOdd_FillType 654 ? SkPath::kEvenOdd_FillType
647 : SkPath::kWinding_FillType); 655 : SkPath::kWinding_FillType);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 skPaint.setSubpixelText(true); 766 skPaint.setSubpixelText(true);
759 skPaint.setHinting(SkPaint::kNo_Hinting); 767 skPaint.setHinting(SkPaint::kNo_Hinting);
760 SkCanvas* skCanvas = pDriver->SkiaCanvas(); 768 SkCanvas* skCanvas = pDriver->SkiaCanvas();
761 skCanvas->save(); 769 skCanvas->save();
762 skCanvas->concat(skMatrix); 770 skCanvas->concat(skMatrix);
763 skCanvas->drawPosText(m_glyphs.begin(), m_glyphs.count() * 2, 771 skCanvas->drawPosText(m_glyphs.begin(), m_glyphs.count() * 2,
764 m_positions.begin(), skPaint); 772 m_positions.begin(), skPaint);
765 skCanvas->restore(); 773 skCanvas->restore();
766 m_drawText = false; 774 m_drawText = false;
767 } 775 }
768 #endif 776 #endif // _SKIA_SUPPORT_
769 777
770 bool SetClipFill(const CFX_PathData* pPathData, 778 bool SetClipFill(const CFX_PathData* pPathData,
771 const CFX_Matrix* pMatrix, 779 const CFX_Matrix* pMatrix,
772 int fill_mode, 780 int fill_mode,
773 CFX_SkiaDeviceDriver* pDriver) { 781 CFX_SkiaDeviceDriver* pDriver) {
774 if (m_debugDisable) 782 if (m_debugDisable)
775 return false; 783 return false;
776 SkPath skClipPath = BuildPath(pPathData); 784 SkPath skClipPath = BuildPath(pPathData);
777 skClipPath.setFillType((fill_mode & 3) == FXFILL_ALTERNATE 785 skClipPath.setFillType((fill_mode & 3) == FXFILL_ALTERNATE
778 ? SkPath::kEvenOdd_FillType 786 ? SkPath::kEvenOdd_FillType
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 } 959 }
952 return true; 960 return true;
953 } 961 }
954 962
955 void Flush(CFX_SkiaDeviceDriver* pDriver) { 963 void Flush(CFX_SkiaDeviceDriver* pDriver) {
956 if (m_drawPath) 964 if (m_drawPath)
957 FlushPath(pDriver); 965 FlushPath(pDriver);
958 #ifdef _SKIA_SUPPORT_ 966 #ifdef _SKIA_SUPPORT_
959 if (m_drawText) 967 if (m_drawText)
960 FlushText(pDriver); 968 FlushText(pDriver);
961 #endif 969 #endif // _SKIA_SUPPORT_
962 } 970 }
963 971
964 #ifdef SK_DEBUG
965 void Dump(const CFX_SkiaDeviceDriver* pDriver) const { 972 void Dump(const CFX_SkiaDeviceDriver* pDriver) const {
973 #if SHOW_SKIA_PATH
966 SkDebugf("\n\nSkia Save Count %d:\n", pDriver->m_pCanvas->getSaveCount()); 974 SkDebugf("\n\nSkia Save Count %d:\n", pDriver->m_pCanvas->getSaveCount());
967 pDriver->m_pCanvas->getClipStack()->dump(); 975 pDriver->m_pCanvas->getClipStack()->dump();
968 SkDebugf("Cache:\n"); 976 SkDebugf("Cache:\n");
969 for (int index = 0; index < m_commands.count(); ++index) { 977 for (int index = 0; index < m_commands.count(); ++index) {
970 SkDebugf("%s ", m_commandIndex == index ? "-->" : " "); 978 SkDebugf("%s ", m_commandIndex == index ? "-->" : " ");
971 switch (m_commands[index]) { 979 switch (m_commands[index]) {
972 case Clip::kSave: 980 case Clip::kSave:
973 SkDebugf("Save\n"); 981 SkDebugf("Save\n");
974 break; 982 break;
975 case Clip::kPath: 983 case Clip::kPath:
976 m_clips[index].dump(); 984 m_clips[index].dump();
977 break; 985 break;
978 default: 986 default:
979 SkDebugf("unknown\n"); 987 SkDebugf("unknown\n");
980 } 988 }
981 } 989 }
982 if (m_commandIndex == m_commands.count()) 990 if (m_commandIndex == m_commands.count())
983 SkDebugf("-->\n"); 991 SkDebugf("-->\n");
992 #endif // SHOW_SKIA_PATH
984 } 993 }
985 #endif
986 994
987 private: 995 private:
988 SkTArray<SkPath> m_clips; // stack of clips that may be reused 996 SkTArray<SkPath> m_clips; // stack of clips that may be reused
989 SkTDArray<Clip> m_commands; // stack of clip-related commands 997 SkTDArray<Clip> m_commands; // stack of clip-related commands
990 SkTDArray<SkPoint> m_positions; // accumulator for text positions 998 SkTDArray<SkPoint> m_positions; // accumulator for text positions
991 SkTDArray<uint16_t> m_glyphs; // accumulator for text glyphs 999 SkTDArray<uint16_t> m_glyphs; // accumulator for text glyphs
992 SkPath m_skPath; // accumulator for path contours 1000 SkPath m_skPath; // accumulator for path contours
993 SkPath m_skEmptyPath; // used as placehold in the clips array 1001 SkPath m_skEmptyPath; // used as placehold in the clips array
994 CFX_Matrix m_drawMatrix; 1002 CFX_Matrix m_drawMatrix;
995 CFX_GraphStateData m_clipState; 1003 CFX_GraphStateData m_clipState;
996 CFX_GraphStateData m_drawState; 1004 CFX_GraphStateData m_drawState;
997 CFX_Matrix m_clipMatrix; 1005 CFX_Matrix m_clipMatrix;
998 CFX_Font* m_pFont; 1006 CFX_Font* m_pFont;
999 FX_FLOAT m_fontSize; 1007 FX_FLOAT m_fontSize;
1000 uint32_t m_fillColor; 1008 uint32_t m_fillColor;
1001 uint32_t m_strokeColor; 1009 uint32_t m_strokeColor;
1002 int m_blendType; 1010 int m_blendType;
1003 int m_commandIndex; // active position in clip command stack 1011 int m_commandIndex; // active position in clip command stack
1004 #ifdef _SKIA_SUPPORT_ 1012 #ifdef _SKIA_SUPPORT_
1005 bool m_drawText; 1013 bool m_drawText;
1006 #endif 1014 #endif // _SKIA_SUPPORT_
1007 bool m_drawPath; 1015 bool m_drawPath;
1008 bool m_fillPath; 1016 bool m_fillPath;
1009 bool m_debugDisable; // turn off cache for debugging 1017 bool m_debugDisable; // turn off cache for debugging
1010 }; 1018 };
1011 1019
1012 // convert a stroking path to scanlines 1020 // convert a stroking path to scanlines
1013 void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint, 1021 void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint,
1014 const CFX_GraphStateData* pGraphState, 1022 const CFX_GraphStateData* pGraphState,
1015 const SkMatrix& matrix) { 1023 const SkMatrix& matrix) {
1016 SkPaint::Cap cap; 1024 SkPaint::Cap cap;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 } 1083 }
1076 1084
1077 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, 1085 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap,
1078 bool bRgbByteOrder, 1086 bool bRgbByteOrder,
1079 CFX_DIBitmap* pOriDevice, 1087 CFX_DIBitmap* pOriDevice,
1080 bool bGroupKnockout) 1088 bool bGroupKnockout)
1081 : m_pBitmap(pBitmap), 1089 : m_pBitmap(pBitmap),
1082 m_pOriDevice(pOriDevice), 1090 m_pOriDevice(pOriDevice),
1083 m_pRecorder(nullptr), 1091 m_pRecorder(nullptr),
1084 m_pCache(new SkiaState), 1092 m_pCache(new SkiaState),
1085 #ifndef _SKIA_SUPPORT_ 1093 #ifdef _SKIA_SUPPORT_PATHS_
1086 m_pClipRgn(nullptr), 1094 m_pClipRgn(nullptr),
1087 m_FillFlags(0), 1095 m_FillFlags(0),
1088 m_bRgbByteOrder(bRgbByteOrder), 1096 m_bRgbByteOrder(bRgbByteOrder),
1089 #endif 1097 #endif // _SKIA_SUPPORT_PATHS_
1090 m_bGroupKnockout(bGroupKnockout) { 1098 m_bGroupKnockout(bGroupKnockout) {
1091 SkBitmap skBitmap; 1099 SkBitmap skBitmap;
1092 SkASSERT(pBitmap->GetBPP() == 8 || pBitmap->GetBPP() == 32); 1100 SkASSERT(pBitmap->GetBPP() == 8 || pBitmap->GetBPP() == 32);
1093 SkImageInfo imageInfo = SkImageInfo::Make( 1101 SkImageInfo imageInfo = SkImageInfo::Make(
1094 pBitmap->GetWidth(), pBitmap->GetHeight(), 1102 pBitmap->GetWidth(), pBitmap->GetHeight(),
1095 pBitmap->GetBPP() == 8 ? kAlpha_8_SkColorType : kN32_SkColorType, 1103 pBitmap->GetBPP() == 8 ? kAlpha_8_SkColorType : kN32_SkColorType,
1096 kOpaque_SkAlphaType); 1104 kOpaque_SkAlphaType);
1097 skBitmap.installPixels(imageInfo, pBitmap->GetBuffer(), pBitmap->GetPitch(), 1105 skBitmap.installPixels(imageInfo, pBitmap->GetBuffer(), pBitmap->GetPitch(),
1098 nullptr, // FIXME(caryclark) set color table 1106 nullptr, // FIXME(caryclark) set color table
1099 nullptr, nullptr); 1107 nullptr, nullptr);
(...skipping 12 matching lines...) Expand all
1112 } 1120 }
1113 1121
1114 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(SkPictureRecorder* recorder) 1122 CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(SkPictureRecorder* recorder)
1115 : m_pBitmap(nullptr), 1123 : m_pBitmap(nullptr),
1116 m_pOriDevice(nullptr), 1124 m_pOriDevice(nullptr),
1117 m_pRecorder(recorder), 1125 m_pRecorder(recorder),
1118 m_pCache(new SkiaState), 1126 m_pCache(new SkiaState),
1119 m_bGroupKnockout(false) { 1127 m_bGroupKnockout(false) {
1120 m_pCanvas = m_pRecorder->getRecordingCanvas(); 1128 m_pCanvas = m_pRecorder->getRecordingCanvas();
1121 } 1129 }
1122 #endif 1130 #endif // _SKIA_SUPPORT_
1123 1131
1124 CFX_SkiaDeviceDriver::~CFX_SkiaDeviceDriver() { 1132 CFX_SkiaDeviceDriver::~CFX_SkiaDeviceDriver() {
1125 Flush(); 1133 Flush();
1126 if (!m_pRecorder) 1134 if (!m_pRecorder)
1127 delete m_pCanvas; 1135 delete m_pCanvas;
1128 } 1136 }
1129 1137
1130 void CFX_SkiaDeviceDriver::Flush() { 1138 void CFX_SkiaDeviceDriver::Flush() {
1131 m_pCache->Flush(this); 1139 m_pCache->Flush(this);
1132 m_pCache->FlushCommands(this); 1140 m_pCache->FlushCommands(this);
(...skipping 28 matching lines...) Expand all
1161 SkTDArray<uint16_t> glyphs; 1169 SkTDArray<uint16_t> glyphs;
1162 glyphs.setCount(nChars); 1170 glyphs.setCount(nChars);
1163 for (int index = 0; index < nChars; ++index) { 1171 for (int index = 0; index < nChars; ++index) {
1164 const FXTEXT_CHARPOS& cp = pCharPos[index]; 1172 const FXTEXT_CHARPOS& cp = pCharPos[index];
1165 positions[index] = {cp.m_OriginX * flip, cp.m_OriginY * flip}; 1173 positions[index] = {cp.m_OriginX * flip, cp.m_OriginY * flip};
1166 glyphs[index] = (uint16_t)cp.m_GlyphIndex; 1174 glyphs[index] = (uint16_t)cp.m_GlyphIndex;
1167 } 1175 }
1168 m_pCanvas->drawPosText(glyphs.begin(), nChars * 2, positions.begin(), paint); 1176 m_pCanvas->drawPosText(glyphs.begin(), nChars * 2, positions.begin(), paint);
1169 m_pCanvas->restore(); 1177 m_pCanvas->restore();
1170 return true; 1178 return true;
1171 #else 1179 #endif // _SKIA_SUPPORT_
1180
1181 #ifdef _SKIA_SUPPORT_PATHS_
1172 return false; 1182 return false;
1173 #endif 1183 #endif // _SKIA_SUPPORT_PATHS_
1174 } 1184 }
1175 1185
1176 int CFX_SkiaDeviceDriver::GetDeviceCaps(int caps_id) const { 1186 int CFX_SkiaDeviceDriver::GetDeviceCaps(int caps_id) const {
1177 switch (caps_id) { 1187 switch (caps_id) {
1178 case FXDC_DEVICE_CLASS: 1188 case FXDC_DEVICE_CLASS:
1179 return FXDC_DISPLAY; 1189 return FXDC_DISPLAY;
1180 #ifdef _SKIA_SUPPORT_ 1190 #ifdef _SKIA_SUPPORT_
1181 case FXDC_PIXEL_WIDTH: 1191 case FXDC_PIXEL_WIDTH:
1182 return m_pCanvas->imageInfo().width(); 1192 return m_pCanvas->imageInfo().width();
1183 case FXDC_PIXEL_HEIGHT: 1193 case FXDC_PIXEL_HEIGHT:
1184 return m_pCanvas->imageInfo().height(); 1194 return m_pCanvas->imageInfo().height();
1185 case FXDC_BITS_PIXEL: 1195 case FXDC_BITS_PIXEL:
1186 return 32; 1196 return 32;
1187 case FXDC_HORZ_SIZE: 1197 case FXDC_HORZ_SIZE:
1188 case FXDC_VERT_SIZE: 1198 case FXDC_VERT_SIZE:
1189 return 0; 1199 return 0;
1190 case FXDC_RENDER_CAPS: 1200 case FXDC_RENDER_CAPS:
1191 return FXRC_GET_BITS | FXRC_ALPHA_PATH | FXRC_ALPHA_IMAGE | 1201 return FXRC_GET_BITS | FXRC_ALPHA_PATH | FXRC_ALPHA_IMAGE |
1192 FXRC_BLEND_MODE | FXRC_SOFT_CLIP | FXRC_ALPHA_OUTPUT | 1202 FXRC_BLEND_MODE | FXRC_SOFT_CLIP | FXRC_ALPHA_OUTPUT |
1193 FXRC_FILLSTROKE_PATH | FXRC_SHADING; 1203 FXRC_FILLSTROKE_PATH | FXRC_SHADING;
1194 #else 1204 #endif // _SKIA_SUPPORT_
1205
1206 #ifdef _SKIA_SUPPORT_PATHS_
1195 case FXDC_PIXEL_WIDTH: 1207 case FXDC_PIXEL_WIDTH:
1196 return m_pBitmap->GetWidth(); 1208 return m_pBitmap->GetWidth();
1197 case FXDC_PIXEL_HEIGHT: 1209 case FXDC_PIXEL_HEIGHT:
1198 return m_pBitmap->GetHeight(); 1210 return m_pBitmap->GetHeight();
1199 case FXDC_BITS_PIXEL: 1211 case FXDC_BITS_PIXEL:
1200 return m_pBitmap->GetBPP(); 1212 return m_pBitmap->GetBPP();
1201 case FXDC_HORZ_SIZE: 1213 case FXDC_HORZ_SIZE:
1202 case FXDC_VERT_SIZE: 1214 case FXDC_VERT_SIZE:
1203 return 0; 1215 return 0;
1204 case FXDC_RENDER_CAPS: { 1216 case FXDC_RENDER_CAPS: {
1205 int flags = FXRC_GET_BITS | FXRC_ALPHA_PATH | FXRC_ALPHA_IMAGE | 1217 int flags = FXRC_GET_BITS | FXRC_ALPHA_PATH | FXRC_ALPHA_IMAGE |
1206 FXRC_BLEND_MODE | FXRC_SOFT_CLIP; 1218 FXRC_BLEND_MODE | FXRC_SOFT_CLIP;
1207 if (m_pBitmap->HasAlpha()) { 1219 if (m_pBitmap->HasAlpha()) {
1208 flags |= FXRC_ALPHA_OUTPUT; 1220 flags |= FXRC_ALPHA_OUTPUT;
1209 } else if (m_pBitmap->IsAlphaMask()) { 1221 } else if (m_pBitmap->IsAlphaMask()) {
1210 if (m_pBitmap->GetBPP() == 1) { 1222 if (m_pBitmap->GetBPP() == 1) {
1211 flags |= FXRC_BITMASK_OUTPUT; 1223 flags |= FXRC_BITMASK_OUTPUT;
1212 } else { 1224 } else {
1213 flags |= FXRC_BYTEMASK_OUTPUT; 1225 flags |= FXRC_BYTEMASK_OUTPUT;
1214 } 1226 }
1215 } 1227 }
1216 if (m_pBitmap->IsCmykImage()) { 1228 if (m_pBitmap->IsCmykImage()) {
1217 flags |= FXRC_CMYK_OUTPUT; 1229 flags |= FXRC_CMYK_OUTPUT;
1218 } 1230 }
1219 return flags; 1231 return flags;
1220 } 1232 }
1221 #endif 1233 #endif // _SKIA_SUPPORT_PATHS_
1222 } 1234 }
1223 return 0; 1235 return 0;
1224 } 1236 }
1225 1237
1226 void CFX_SkiaDeviceDriver::SaveState() { 1238 void CFX_SkiaDeviceDriver::SaveState() {
1227 #ifdef _SKIA_SUPPORT_
1228 if (!m_pCache->ClipSave(this)) 1239 if (!m_pCache->ClipSave(this))
1229 m_pCanvas->save(); 1240 m_pCanvas->save();
1230 #else 1241
1242 #ifdef _SKIA_SUPPORT_PATHS_
1231 std::unique_ptr<CFX_ClipRgn> pClip; 1243 std::unique_ptr<CFX_ClipRgn> pClip;
1232 if (m_pClipRgn) 1244 if (m_pClipRgn)
1233 pClip = pdfium::MakeUnique<CFX_ClipRgn>(*m_pClipRgn); 1245 pClip = pdfium::MakeUnique<CFX_ClipRgn>(*m_pClipRgn);
1234 m_StateStack.push_back(std::move(pClip)); 1246 m_StateStack.push_back(std::move(pClip));
1235 #endif 1247 #endif // _SKIA_SUPPORT_PATHS_
1236 } 1248 }
1237 1249
1238 void CFX_SkiaDeviceDriver::RestoreState(bool bKeepSaved) { 1250 void CFX_SkiaDeviceDriver::RestoreState(bool bKeepSaved) {
1239 #ifdef _SKIA_SUPPORT_
1240 if (!m_pCache->ClipRestore(this)) 1251 if (!m_pCache->ClipRestore(this))
1241 m_pCanvas->restore(); 1252 m_pCanvas->restore();
1242 if (bKeepSaved) 1253 if (bKeepSaved && !m_pCache->ClipSave(this))
1243 SaveState(); 1254 m_pCanvas->save();
1244 #else 1255
1256 #ifdef _SKIA_SUPPORT_PATHS_
1245 m_pClipRgn.reset(); 1257 m_pClipRgn.reset();
1246 1258
1247 if (m_StateStack.empty()) 1259 if (m_StateStack.empty())
1248 return; 1260 return;
1249 1261
1250 if (bKeepSaved) { 1262 if (bKeepSaved) {
1251 if (m_StateStack.back()) 1263 if (m_StateStack.back())
1252 m_pClipRgn = pdfium::MakeUnique<CFX_ClipRgn>(*m_StateStack.back()); 1264 m_pClipRgn = pdfium::MakeUnique<CFX_ClipRgn>(*m_StateStack.back());
1253 } else { 1265 } else {
1254 m_pClipRgn = std::move(m_StateStack.back()); 1266 m_pClipRgn = std::move(m_StateStack.back());
1255 m_StateStack.pop_back(); 1267 m_StateStack.pop_back();
1256 } 1268 }
1257 #endif 1269 #endif // _SKIA_SUPPORT_PATHS_
1258 } 1270 }
1259 1271
1260 #ifndef _SKIA_SUPPORT_ 1272 #ifdef _SKIA_SUPPORT_PATHS_
1261 void CFX_SkiaDeviceDriver::SetClipMask(const FX_RECT& clipBox, 1273 void CFX_SkiaDeviceDriver::SetClipMask(const FX_RECT& clipBox,
1262 const SkPath& path) { 1274 const SkPath& path) {
1263 FX_RECT path_rect(clipBox.left, clipBox.top, clipBox.right + 1, 1275 FX_RECT path_rect(clipBox.left, clipBox.top, clipBox.right + 1,
1264 clipBox.bottom + 1); 1276 clipBox.bottom + 1);
1265 path_rect.Intersect(m_pClipRgn->GetBox()); 1277 path_rect.Intersect(m_pClipRgn->GetBox());
1266 CFX_DIBitmapRef mask; 1278 CFX_DIBitmapRef mask;
1267 CFX_DIBitmap* pThisLayer = mask.Emplace(); 1279 CFX_DIBitmap* pThisLayer = mask.Emplace();
1268 pThisLayer->Create(path_rect.Width(), path_rect.Height(), FXDIB_8bppMask); 1280 pThisLayer->Create(path_rect.Width(), path_rect.Height(), FXDIB_8bppMask);
1269 pThisLayer->Clear(0); 1281 pThisLayer->Clear(0);
1270 1282
1271 SkImageInfo imageInfo = 1283 SkImageInfo imageInfo =
1272 SkImageInfo::Make(pThisLayer->GetWidth(), pThisLayer->GetHeight(), 1284 SkImageInfo::Make(pThisLayer->GetWidth(), pThisLayer->GetHeight(),
1273 SkColorType::kAlpha_8_SkColorType, kOpaque_SkAlphaType); 1285 SkColorType::kAlpha_8_SkColorType, kOpaque_SkAlphaType);
1274 SkBitmap bitmap; 1286 SkBitmap bitmap;
1275 bitmap.installPixels(imageInfo, pThisLayer->GetBuffer(), 1287 bitmap.installPixels(imageInfo, pThisLayer->GetBuffer(),
1276 pThisLayer->GetPitch(), nullptr, nullptr, nullptr); 1288 pThisLayer->GetPitch(), nullptr, nullptr, nullptr);
1277 SkCanvas* canvas = new SkCanvas(bitmap); 1289 SkCanvas* canvas = new SkCanvas(bitmap);
1278 canvas->translate( 1290 canvas->translate(
1279 clipBox.left, 1291 -path_rect.left,
1280 clipBox.top); // FIXME(caryclark) wrong sign(s)? upside down? 1292 -path_rect.top); // FIXME(caryclark) wrong sign(s)? upside down?
1281 SkPaint paint; 1293 SkPaint paint;
1282 paint.setAntiAlias((m_FillFlags & FXFILL_NOPATHSMOOTH) == 0); 1294 paint.setAntiAlias((m_FillFlags & FXFILL_NOPATHSMOOTH) == 0);
1283 canvas->drawPath(path, paint); 1295 canvas->drawPath(path, paint);
1284 std::unique_ptr<uint8_t, FxFreeDeleter> raw_buf;
1285 raw_buf.reset(
1286 FX_Alloc2D(uint8_t, pThisLayer->GetWidth(), pThisLayer->GetHeight()));
1287 m_pClipRgn->IntersectMaskF(path_rect.left, path_rect.top, mask); 1296 m_pClipRgn->IntersectMaskF(path_rect.left, path_rect.top, mask);
1288 delete canvas; 1297 delete canvas;
1289 } 1298 }
1290 #endif 1299 #endif // _SKIA_SUPPORT_PATHS_
1291 1300
1292 bool CFX_SkiaDeviceDriver::SetClip_PathFill( 1301 bool CFX_SkiaDeviceDriver::SetClip_PathFill(
1293 const CFX_PathData* pPathData, // path info 1302 const CFX_PathData* pPathData, // path info
1294 const CFX_Matrix* pObject2Device, // flips object's y-axis 1303 const CFX_Matrix* pObject2Device, // flips object's y-axis
1295 int fill_mode // fill mode, WINDING or ALTERNATE 1304 int fill_mode // fill mode, WINDING or ALTERNATE
1296 ) { 1305 ) {
1297 CFX_Matrix identity; 1306 CFX_Matrix identity;
1298 const CFX_Matrix* deviceMatrix = pObject2Device ? pObject2Device : &identity; 1307 const CFX_Matrix* deviceMatrix = pObject2Device ? pObject2Device : &identity;
1299 #ifdef _SKIA_SUPPORT_ 1308 #ifdef _SKIA_SUPPORT_
1300 if (m_pCache->SetClipFill(pPathData, deviceMatrix, fill_mode, this)) 1309 if (m_pCache->SetClipFill(pPathData, deviceMatrix, fill_mode, this))
1301 return true; 1310 return true;
1302 #else 1311 #endif // _SKIA_SUPPORT_
1312
1313 #ifdef _SKIA_SUPPORT_PATHS_
1303 m_FillFlags = fill_mode; 1314 m_FillFlags = fill_mode;
1304 if (!m_pClipRgn) { 1315 if (!m_pClipRgn) {
1305 m_pClipRgn = pdfium::MakeUnique<CFX_ClipRgn>( 1316 m_pClipRgn = pdfium::MakeUnique<CFX_ClipRgn>(
1306 GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); 1317 GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT));
1307 } 1318 }
1308 #endif 1319 #endif // _SKIA_SUPPORT_PATHS_
1309 if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { 1320 if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) {
1310 CFX_FloatRect rectf; 1321 CFX_FloatRect rectf;
1311 if (pPathData->IsRect(deviceMatrix, &rectf)) { 1322 if (pPathData->IsRect(deviceMatrix, &rectf)) {
1312 rectf.Intersect( 1323 rectf.Intersect(
1313 CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH), 1324 CFX_FloatRect(0, 0, (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_WIDTH),
1314 (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT))); 1325 (FX_FLOAT)GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
1315 #ifdef _SKIA_SUPPORT_
1316 // note that PDF's y-axis goes up; Skia's y-axis goes down 1326 // note that PDF's y-axis goes up; Skia's y-axis goes down
1317 SkRect skClipRect = 1327 SkRect skClipRect =
1318 SkRect::MakeLTRB(rectf.left, rectf.bottom, rectf.right, rectf.top); 1328 SkRect::MakeLTRB(rectf.left, rectf.bottom, rectf.right, rectf.top);
1319 DebugDrawSkiaClipRect(m_pCanvas, skClipRect); 1329 DebugDrawSkiaClipRect(m_pCanvas, skClipRect);
1320 m_pCanvas->clipRect(skClipRect, SkCanvas::kIntersect_Op, true); 1330 m_pCanvas->clipRect(skClipRect, SkCanvas::kIntersect_Op, true);
1321 #else 1331
1332 #ifdef _SKIA_SUPPORT_PATHS_
1322 FX_RECT rect = rectf.GetOuterRect(); 1333 FX_RECT rect = rectf.GetOuterRect();
1323 m_pClipRgn->IntersectRect(rect); 1334 m_pClipRgn->IntersectRect(rect);
1324 #endif 1335 #endif // _SKIA_SUPPORT_PATHS_
1325 return true; 1336 return true;
1326 } 1337 }
1327 } 1338 }
1328 SkPath skClipPath = BuildPath(pPathData); 1339 SkPath skClipPath = BuildPath(pPathData);
1329 skClipPath.setFillType((fill_mode & 3) == FXFILL_ALTERNATE 1340 skClipPath.setFillType((fill_mode & 3) == FXFILL_ALTERNATE
1330 ? SkPath::kEvenOdd_FillType 1341 ? SkPath::kEvenOdd_FillType
1331 : SkPath::kWinding_FillType); 1342 : SkPath::kWinding_FillType);
1332 SkMatrix skMatrix = ToSkMatrix(*deviceMatrix); 1343 SkMatrix skMatrix = ToSkMatrix(*deviceMatrix);
1333 skClipPath.transform(skMatrix); 1344 skClipPath.transform(skMatrix);
1334 DebugShowSkiaPath(skClipPath); 1345 DebugShowSkiaPath(skClipPath);
1335 DebugDrawSkiaClipPath(m_pCanvas, skClipPath); 1346 DebugDrawSkiaClipPath(m_pCanvas, skClipPath);
1336 m_pCanvas->clipPath(skClipPath, SkCanvas::kIntersect_Op, true); 1347 m_pCanvas->clipPath(skClipPath, SkCanvas::kIntersect_Op, true);
1337 #ifndef _SKIA_SUPPORT_ 1348 #ifdef _SKIA_SUPPORT_PATHS_
1338 FX_RECT clipBox(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH), 1349 FX_RECT clipBox(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH),
1339 GetDeviceCaps(FXDC_PIXEL_HEIGHT)); 1350 GetDeviceCaps(FXDC_PIXEL_HEIGHT));
1340 SetClipMask(clipBox, skClipPath); 1351 SetClipMask(clipBox, skClipPath);
1341 #endif 1352 #endif // _SKIA_SUPPORT_PATHS_
1342 return true; 1353 return true;
1343 } 1354 }
1344 1355
1345 bool CFX_SkiaDeviceDriver::SetClip_PathStroke( 1356 bool CFX_SkiaDeviceDriver::SetClip_PathStroke(
1346 const CFX_PathData* pPathData, // path info 1357 const CFX_PathData* pPathData, // path info
1347 const CFX_Matrix* pObject2Device, // optional transformation 1358 const CFX_Matrix* pObject2Device, // optional transformation
1348 const CFX_GraphStateData* pGraphState // graphic state, for pen attributes 1359 const CFX_GraphStateData* pGraphState // graphic state, for pen attributes
1349 ) { 1360 ) {
1350 #ifdef _SKIA_SUPPORT_ 1361 #ifdef _SKIA_SUPPORT_
1351 if (m_pCache->SetClipStroke(pPathData, pObject2Device, pGraphState, this)) 1362 if (m_pCache->SetClipStroke(pPathData, pObject2Device, pGraphState, this))
1352 return true; 1363 return true;
1353 #else 1364 #endif // _SKIA_SUPPORT_
1365
1366 #ifdef _SKIA_SUPPORT_PATHS_
1354 if (!m_pClipRgn) { 1367 if (!m_pClipRgn) {
1355 m_pClipRgn = pdfium::MakeUnique<CFX_ClipRgn>( 1368 m_pClipRgn = pdfium::MakeUnique<CFX_ClipRgn>(
1356 GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); 1369 GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT));
1357 } 1370 }
1358 #endif 1371 #endif // _SKIA_SUPPORT_PATHS_
1359 // build path data 1372 // build path data
1360 SkPath skPath = BuildPath(pPathData); 1373 SkPath skPath = BuildPath(pPathData);
1361 SkMatrix skMatrix = ToSkMatrix(*pObject2Device); 1374 SkMatrix skMatrix = ToSkMatrix(*pObject2Device);
1362 SkPaint skPaint; 1375 SkPaint skPaint;
1363 PaintStroke(&skPaint, pGraphState, skMatrix); 1376 PaintStroke(&skPaint, pGraphState, skMatrix);
1364 SkPath dst_path; 1377 SkPath dst_path;
1365 skPaint.getFillPath(skPath, &dst_path); 1378 skPaint.getFillPath(skPath, &dst_path);
1366 dst_path.transform(skMatrix); 1379 dst_path.transform(skMatrix);
1367 DebugDrawSkiaClipPath(m_pCanvas, dst_path); 1380 DebugDrawSkiaClipPath(m_pCanvas, dst_path);
1368 #ifdef _SKIA_SUPPORT_ 1381 #ifdef _SKIA_SUPPORT_
1369 m_pCanvas->clipPath(dst_path, SkCanvas::kIntersect_Op, true); 1382 m_pCanvas->clipPath(dst_path, SkCanvas::kIntersect_Op, true);
1370 #else 1383 #endif // _SKIA_SUPPORT_
1384
1385 #ifdef _SKIA_SUPPORT_PATHS_
1371 FX_RECT clipBox(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH), 1386 FX_RECT clipBox(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH),
1372 GetDeviceCaps(FXDC_PIXEL_HEIGHT)); 1387 GetDeviceCaps(FXDC_PIXEL_HEIGHT));
1373 SetClipMask(clipBox, dst_path); 1388 SetClipMask(clipBox, dst_path);
1374 #endif 1389 #endif // _SKIA_SUPPORT_PATHS_
1375 return true; 1390 return true;
1376 } 1391 }
1377 1392
1378 bool CFX_SkiaDeviceDriver::DrawPath( 1393 bool CFX_SkiaDeviceDriver::DrawPath(
1379 const CFX_PathData* pPathData, // path info 1394 const CFX_PathData* pPathData, // path info
1380 const CFX_Matrix* pObject2Device, // optional transformation 1395 const CFX_Matrix* pObject2Device, // optional transformation
1381 const CFX_GraphStateData* pGraphState, // graphic state, for pen attributes 1396 const CFX_GraphStateData* pGraphState, // graphic state, for pen attributes
1382 uint32_t fill_color, // fill color 1397 uint32_t fill_color, // fill color
1383 uint32_t stroke_color, // stroke color 1398 uint32_t stroke_color, // stroke color
1384 int fill_mode, // fill mode, WINDING or ALTERNATE. 0 for not filled 1399 int fill_mode, // fill mode, WINDING or ALTERNATE. 0 for not filled
(...skipping 30 matching lines...) Expand all
1415 if (m_bGroupKnockout) { 1430 if (m_bGroupKnockout) {
1416 skPaint.getFillPath(skPath, &strokePath); 1431 skPaint.getFillPath(skPath, &strokePath);
1417 if (Op(skPath, strokePath, SkPathOp::kDifference_SkPathOp, 1432 if (Op(skPath, strokePath, SkPathOp::kDifference_SkPathOp,
1418 &strokePath)) { 1433 &strokePath)) {
1419 fillPath = &strokePath; 1434 fillPath = &strokePath;
1420 } 1435 }
1421 } 1436 }
1422 } 1437 }
1423 skPaint.setStyle(SkPaint::kFill_Style); 1438 skPaint.setStyle(SkPaint::kFill_Style);
1424 skPaint.setColor(fill_color); 1439 skPaint.setColor(fill_color);
1440 DebugShowSkiaPath(*fillPath);
1441 DebugShowCanvasMatrix(m_pCanvas);
1442 DebugShowCanvasClip(m_pCanvas);
1425 m_pCanvas->drawPath(*fillPath, skPaint); 1443 m_pCanvas->drawPath(*fillPath, skPaint);
1426 } 1444 }
1427 if (pGraphState && stroke_alpha) { 1445 if (pGraphState && stroke_alpha) {
1428 DebugShowSkiaPath(skPath); 1446 DebugShowSkiaPath(skPath);
1429 DebugShowCanvasMatrix(m_pCanvas); 1447 DebugShowCanvasMatrix(m_pCanvas);
1448 DebugShowCanvasClip(m_pCanvas);
1430 skPaint.setStyle(SkPaint::kStroke_Style); 1449 skPaint.setStyle(SkPaint::kStroke_Style);
1431 skPaint.setColor(stroke_color); 1450 skPaint.setColor(stroke_color);
1432 m_pCanvas->drawPath(skPath, skPaint); 1451 m_pCanvas->drawPath(skPath, skPaint);
1433 } 1452 }
1434 m_pCanvas->restore(); 1453 m_pCanvas->restore();
1454 #if defined _SKIA_SUPPORT_PATHS_
1455 if ((fill_mode & 3 && FXARGB_A(fill_color) < 255) ||
1456 (pGraphState && stroke_alpha < 255)) {
1457 m_pBitmap->MarkForUnPreMultiply(true);
1458 }
1459 #endif // _SKIA_SUPPORT_PATHS_
1435 return true; 1460 return true;
1436 } 1461 }
1437 1462
1438 bool CFX_SkiaDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, 1463 bool CFX_SkiaDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
1439 FX_FLOAT y1, 1464 FX_FLOAT y1,
1440 FX_FLOAT x2, 1465 FX_FLOAT x2,
1441 FX_FLOAT y2, 1466 FX_FLOAT y2,
1442 uint32_t color, 1467 uint32_t color,
1443 int blend_type) { 1468 int blend_type) {
1444 return false; 1469 return false;
1445 } 1470 }
1446 1471
1447 bool CFX_SkiaDeviceDriver::FillRectWithBlend(const FX_RECT* pRect, 1472 bool CFX_SkiaDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
1448 uint32_t fill_color, 1473 uint32_t fill_color,
1449 int blend_type) { 1474 int blend_type) {
1450 SkPaint spaint; 1475 SkPaint spaint;
1451 spaint.setAntiAlias(true); 1476 spaint.setAntiAlias(true);
1452 spaint.setColor(fill_color); 1477 spaint.setColor(fill_color);
1453 spaint.setBlendMode(GetSkiaBlendMode(blend_type)); 1478 spaint.setBlendMode(GetSkiaBlendMode(blend_type));
1454 1479 DebugShowCanvasClip(m_pCanvas);
1455 m_pCanvas->drawRect( 1480 DebugShowCanvasMatrix(m_pCanvas);
1456 SkRect::MakeLTRB(pRect->left, pRect->top, pRect->right, pRect->bottom), 1481 SkRect rect =
1457 spaint); 1482 SkRect::MakeLTRB(pRect->left, SkTMin(pRect->top, pRect->bottom),
1483 pRect->right, SkTMax(pRect->bottom, pRect->top));
1484 #if SHOW_SKIA_PATH
1485 printf("fill rect = %g %g %g %g\n\n", rect.fLeft, rect.fTop, rect.fRight,
1486 rect.fBottom);
1487 #endif // SHOW_SKIA_PATH
1488 m_pCanvas->drawRect(rect, spaint);
1458 return true; 1489 return true;
1459 } 1490 }
1460 1491
1461 #ifdef _SKIA_SUPPORT_ 1492 #ifdef _SKIA_SUPPORT_
1462 bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, 1493 bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern,
1463 const CFX_Matrix* pMatrix, 1494 const CFX_Matrix* pMatrix,
1464 const FX_RECT& clip_rect, 1495 const FX_RECT& clip_rect,
1465 int alpha, 1496 int alpha,
1466 bool bAlphaMode) { 1497 bool bAlphaMode) {
1467 if (kAxialShading != pPattern->GetShadingType() && 1498 if (kAxialShading != pPattern->GetShadingType() &&
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 skPath.transform(inverse); 1616 skPath.transform(inverse);
1586 } 1617 }
1587 m_pCanvas->save(); 1618 m_pCanvas->save();
1588 if (!skClip.isEmpty()) 1619 if (!skClip.isEmpty())
1589 m_pCanvas->clipPath(skClip, SkCanvas::kIntersect_Op, true); 1620 m_pCanvas->clipPath(skClip, SkCanvas::kIntersect_Op, true);
1590 m_pCanvas->concat(skMatrix); 1621 m_pCanvas->concat(skMatrix);
1591 m_pCanvas->drawPath(skPath, paint); 1622 m_pCanvas->drawPath(skPath, paint);
1592 m_pCanvas->restore(); 1623 m_pCanvas->restore();
1593 return true; 1624 return true;
1594 } 1625 }
1595 #endif 1626 #endif // _SKIA_SUPPORT_
1596 1627
1597 uint8_t* CFX_SkiaDeviceDriver::GetBuffer() const { 1628 uint8_t* CFX_SkiaDeviceDriver::GetBuffer() const {
1598 return m_pBitmap->GetBuffer(); 1629 return m_pBitmap->GetBuffer();
1599 } 1630 }
1600 1631
1601 bool CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) { 1632 bool CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) {
1602 // TODO(caryclark) call m_canvas->getClipDeviceBounds() instead 1633 // TODO(caryclark) call m_canvas->getClipDeviceBounds() instead
1603 pRect->left = 0; 1634 pRect->left = 0;
1604 pRect->top = 0; 1635 pRect->top = 0;
1605 const SkImageInfo& canvasSize = m_pCanvas->imageInfo(); 1636 const SkImageInfo& canvasSize = m_pCanvas->imageInfo();
(...skipping 24 matching lines...) Expand all
1630 int dstHeight = pBitmap->GetHeight(); 1661 int dstHeight = pBitmap->GetHeight();
1631 int dstRowBytes = dstWidth * sizeof(uint32_t); 1662 int dstRowBytes = dstWidth * sizeof(uint32_t);
1632 SkImageInfo dstImageInfo = SkImageInfo::Make( 1663 SkImageInfo dstImageInfo = SkImageInfo::Make(
1633 dstWidth, dstHeight, SkColorType::kN32_SkColorType, kPremul_SkAlphaType); 1664 dstWidth, dstHeight, SkColorType::kN32_SkColorType, kPremul_SkAlphaType);
1634 SkBitmap skDstBitmap; 1665 SkBitmap skDstBitmap;
1635 skDstBitmap.installPixels(dstImageInfo, dstBuffer, dstRowBytes, nullptr, 1666 skDstBitmap.installPixels(dstImageInfo, dstBuffer, dstRowBytes, nullptr,
1636 nullptr, nullptr); 1667 nullptr, nullptr);
1637 SkCanvas canvas(skDstBitmap); 1668 SkCanvas canvas(skDstBitmap);
1638 canvas.drawBitmap(skSrcBitmap, left, top, nullptr); 1669 canvas.drawBitmap(skSrcBitmap, left, top, nullptr);
1639 return true; 1670 return true;
1640 #else 1671 #endif // _SKIA_SUPPORT_
1672
1673 #ifdef _SKIA_SUPPORT_PATHS_
1641 FX_RECT rect(left, top, left + pBitmap->GetWidth(), 1674 FX_RECT rect(left, top, left + pBitmap->GetWidth(),
1642 top + pBitmap->GetHeight()); 1675 top + pBitmap->GetHeight());
1643 CFX_DIBitmap* pBack = nullptr; 1676 CFX_DIBitmap* pBack = nullptr;
1644 if (m_pOriDevice) { 1677 if (m_pOriDevice) {
1645 pBack = m_pOriDevice->Clone(&rect); 1678 pBack = m_pOriDevice->Clone(&rect);
1646 if (!pBack) 1679 if (!pBack)
1647 return true; 1680 return true;
1648 1681
1649 pBack->CompositeBitmap(0, 0, pBack->GetWidth(), pBack->GetHeight(), 1682 pBack->CompositeBitmap(0, 0, pBack->GetWidth(), pBack->GetHeight(),
1650 m_pBitmap, 0, 0); 1683 m_pBitmap, 0, 0);
1651 } else { 1684 } else {
1652 pBack = m_pBitmap->Clone(&rect); 1685 pBack = m_pBitmap->Clone(&rect);
1653 if (!pBack) 1686 if (!pBack)
1654 return true; 1687 return true;
1655 } 1688 }
1656 1689
1657 bool bRet = true; 1690 bool bRet = true;
1658 left = std::min(left, 0); 1691 left = std::min(left, 0);
1659 top = std::min(top, 0); 1692 top = std::min(top, 0);
1660 if (m_bRgbByteOrder) { 1693 if (m_bRgbByteOrder) {
1661 RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(), 1694 RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(),
1662 pBack, left, top); 1695 pBack, left, top);
1663 } else { 1696 } else {
1664 bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack, 1697 bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack,
1665 left, top); 1698 left, top);
1666 } 1699 }
1667 delete pBack; 1700 delete pBack;
1668 return bRet; 1701 return bRet;
1669 #endif 1702 #endif // _SKIA_SUPPORT_PATHS_
1670 } 1703 }
1671 1704
1672 CFX_DIBitmap* CFX_SkiaDeviceDriver::GetBackDrop() { 1705 CFX_DIBitmap* CFX_SkiaDeviceDriver::GetBackDrop() {
1673 return m_pOriDevice; 1706 return m_pOriDevice;
1674 } 1707 }
1675 1708
1676 bool CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, 1709 bool CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
1677 uint32_t argb, 1710 uint32_t argb,
1678 const FX_RECT* pSrcRect, 1711 const FX_RECT* pSrcRect,
1679 int left, 1712 int left,
1680 int top, 1713 int top,
1681 int blend_type) { 1714 int blend_type) {
1682 if (!m_pBitmap || !m_pBitmap->GetBuffer()) 1715 if (!m_pBitmap || !m_pBitmap->GetBuffer())
1683 return true; 1716 return true;
1684 1717
1685 #ifdef _SKIA_SUPPORT_ 1718 #ifdef _SKIA_SUPPORT_
1686 CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), left, 1719 CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), left,
1687 top + pBitmap->GetHeight()); 1720 top + pBitmap->GetHeight());
1688 void* dummy; 1721 void* dummy;
1689 return StartDIBits(pBitmap, 0xFF, argb, &m, 0, dummy, blend_type); 1722 return StartDIBits(pBitmap, 0xFF, argb, &m, 0, dummy, blend_type);
1690 #else 1723 #endif // _SKIA_SUPPORT_
1724
1725 #ifdef _SKIA_SUPPORT_PATHS_
1691 if (pBitmap->IsAlphaMask()) { 1726 if (pBitmap->IsAlphaMask()) {
1692 return m_pBitmap->CompositeMask( 1727 return m_pBitmap->CompositeMask(
1693 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, argb, 1728 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, argb,
1694 pSrcRect->left, pSrcRect->top, blend_type, m_pClipRgn.get(), 1729 pSrcRect->left, pSrcRect->top, blend_type, m_pClipRgn.get(),
1695 m_bRgbByteOrder, 0, nullptr); 1730 m_bRgbByteOrder, 0, nullptr);
1696 } 1731 }
1697 return m_pBitmap->CompositeBitmap( 1732 return m_pBitmap->CompositeBitmap(
1698 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, pSrcRect->left, 1733 left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, pSrcRect->left,
1699 pSrcRect->top, blend_type, m_pClipRgn.get(), m_bRgbByteOrder, nullptr); 1734 pSrcRect->top, blend_type, m_pClipRgn.get(), m_bRgbByteOrder, nullptr);
1700 #endif 1735 #endif // _SKIA_SUPPORT_PATHS_
1701 } 1736 }
1702 1737
1703 bool CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, 1738 bool CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
1704 uint32_t argb, 1739 uint32_t argb,
1705 int dest_left, 1740 int dest_left,
1706 int dest_top, 1741 int dest_top,
1707 int dest_width, 1742 int dest_width,
1708 int dest_height, 1743 int dest_height,
1709 const FX_RECT* pClipRect, 1744 const FX_RECT* pClipRect,
1710 uint32_t flags, 1745 uint32_t flags,
1711 int blend_type) { 1746 int blend_type) {
1712 #ifdef _SKIA_SUPPORT_ 1747 #ifdef _SKIA_SUPPORT_
1713 if (!m_pBitmap->GetBuffer()) 1748 if (!m_pBitmap->GetBuffer())
1714 return true; 1749 return true;
1715 CFX_Matrix m(dest_width, 0, 0, -dest_height, dest_left, 1750 CFX_Matrix m(dest_width, 0, 0, -dest_height, dest_left,
1716 dest_top + dest_height); 1751 dest_top + dest_height);
1717 1752
1718 m_pCanvas->save(); 1753 m_pCanvas->save();
1719 SkRect skClipRect = SkRect::MakeLTRB(pClipRect->left, pClipRect->bottom, 1754 SkRect skClipRect = SkRect::MakeLTRB(pClipRect->left, pClipRect->bottom,
1720 pClipRect->right, pClipRect->top); 1755 pClipRect->right, pClipRect->top);
1721 m_pCanvas->clipRect(skClipRect, SkCanvas::kIntersect_Op, true); 1756 m_pCanvas->clipRect(skClipRect, SkCanvas::kIntersect_Op, true);
1722 void* dummy; 1757 void* dummy;
1723 bool result = StartDIBits(pSource, 0xFF, argb, &m, 0, dummy, blend_type); 1758 bool result = StartDIBits(pSource, 0xFF, argb, &m, 0, dummy, blend_type);
1724 m_pCanvas->restore(); 1759 m_pCanvas->restore();
1725 1760
1726 return result; 1761 return result;
1727 #else 1762 #endif // _SKIA_SUPPORT_
1763
1764 #ifdef _SKIA_SUPPORT_PATHS_
1728 if (dest_width == pSource->GetWidth() && 1765 if (dest_width == pSource->GetWidth() &&
1729 dest_height == pSource->GetHeight()) { 1766 dest_height == pSource->GetHeight()) {
1730 FX_RECT rect(0, 0, dest_width, dest_height); 1767 FX_RECT rect(0, 0, dest_width, dest_height);
1731 return SetDIBits(pSource, argb, &rect, dest_left, dest_top, blend_type); 1768 return SetDIBits(pSource, argb, &rect, dest_left, dest_top, blend_type);
1732 } 1769 }
1733 FX_RECT dest_rect(dest_left, dest_top, dest_left + dest_width, 1770 FX_RECT dest_rect(dest_left, dest_top, dest_left + dest_width,
1734 dest_top + dest_height); 1771 dest_top + dest_height);
1735 dest_rect.Normalize(); 1772 dest_rect.Normalize();
1736 FX_RECT dest_clip = dest_rect; 1773 FX_RECT dest_clip = dest_rect;
1737 dest_clip.Intersect(*pClipRect); 1774 dest_clip.Intersect(*pClipRect);
1738 CFX_BitmapComposer composer; 1775 CFX_BitmapComposer composer;
1739 composer.Compose(m_pBitmap, m_pClipRgn.get(), 255, argb, dest_clip, false, 1776 composer.Compose(m_pBitmap, m_pClipRgn.get(), 255, argb, dest_clip, false,
1740 false, false, m_bRgbByteOrder, 0, nullptr, blend_type); 1777 false, false, m_bRgbByteOrder, 0, nullptr, blend_type);
1741 dest_clip.Offset(-dest_rect.left, -dest_rect.top); 1778 dest_clip.Offset(-dest_rect.left, -dest_rect.top);
1742 CFX_ImageStretcher stretcher(&composer, pSource, dest_width, dest_height, 1779 CFX_ImageStretcher stretcher(&composer, pSource, dest_width, dest_height,
1743 dest_clip, flags); 1780 dest_clip, flags);
1744 if (stretcher.Start()) 1781 if (stretcher.Start())
1745 stretcher.Continue(nullptr); 1782 stretcher.Continue(nullptr);
1746 return true; 1783 return true;
1747 #endif 1784 #endif // _SKIA_SUPPORT_PATHS_
1748 } 1785 }
1749 1786
1750 bool CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, 1787 bool CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource,
1751 int bitmap_alpha, 1788 int bitmap_alpha,
1752 uint32_t argb, 1789 uint32_t argb,
1753 const CFX_Matrix* pMatrix, 1790 const CFX_Matrix* pMatrix,
1754 uint32_t render_flags, 1791 uint32_t render_flags,
1755 void*& handle, 1792 void*& handle,
1756 int blend_type) { 1793 int blend_type) {
1757 #ifdef _SKIA_SUPPORT_ 1794 #ifdef _SKIA_SUPPORT_
(...skipping 28 matching lines...) Expand all
1786 m_pBitmap->SetPixel(x, y, skBitmap.getColor(src.fX, src.fY)); 1823 m_pBitmap->SetPixel(x, y, skBitmap.getColor(src.fX, src.fY));
1787 } 1824 }
1788 } 1825 }
1789 } else { 1826 } else {
1790 m_pCanvas->drawBitmap(skBitmap, 0, 0, &paint); 1827 m_pCanvas->drawBitmap(skBitmap, 0, 0, &paint);
1791 } 1828 }
1792 m_pCanvas->restore(); 1829 m_pCanvas->restore();
1793 if (ct) 1830 if (ct)
1794 ct->unref(); 1831 ct->unref();
1795 DebugValidate(m_pBitmap, m_pOriDevice); 1832 DebugValidate(m_pBitmap, m_pOriDevice);
1796 #else 1833 #endif // _SKIA_SUPPORT_
1834
1835 #ifdef _SKIA_SUPPORT_PATHS_
1797 if (!m_pBitmap->GetBuffer()) 1836 if (!m_pBitmap->GetBuffer())
1798 return true; 1837 return true;
1799 1838
1800 CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer; 1839 CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer;
1801 pRenderer->Start(m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb, 1840 pRenderer->Start(m_pBitmap, m_pClipRgn.get(), pSource, bitmap_alpha, argb,
1802 pMatrix, render_flags, m_bRgbByteOrder, 0, nullptr); 1841 pMatrix, render_flags, m_bRgbByteOrder, 0, nullptr);
1803 handle = pRenderer; 1842 handle = pRenderer;
1804 #endif 1843 #endif // _SKIA_SUPPORT_PATHS_
1805 return true; 1844 return true;
1806 } 1845 }
1807 1846
1808 bool CFX_SkiaDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) { 1847 bool CFX_SkiaDeviceDriver::ContinueDIBits(void* handle, IFX_Pause* pPause) {
1809 #ifdef _SKIA_SUPPORT_ 1848 #ifdef _SKIA_SUPPORT_
1810 return false; 1849 return false;
1811 #else 1850 #endif // _SKIA_SUPPORT_
1851
1852 #ifdef _SKIA_SUPPORT_PATHS_
1812 if (!m_pBitmap->GetBuffer()) { 1853 if (!m_pBitmap->GetBuffer()) {
1813 return true; 1854 return true;
1814 } 1855 }
1815 return static_cast<CFX_ImageRenderer*>(handle)->Continue(pPause); 1856 return static_cast<CFX_ImageRenderer*>(handle)->Continue(pPause);
1816 #endif 1857 #endif // _SKIA_SUPPORT_PATHS_
1817 } 1858 }
1818 1859
1819 #ifdef _SKIA_SUPPORT_ 1860 #ifdef _SKIA_SUPPORT_
1820 void CFX_SkiaDeviceDriver::PreMultiply(CFX_DIBitmap* pDIBitmap) { 1861 void CFX_SkiaDeviceDriver::PreMultiply(CFX_DIBitmap* pDIBitmap) {
1821 void* buffer = pDIBitmap->GetBuffer(); 1862 void* buffer = pDIBitmap->GetBuffer();
1822 if (!buffer) 1863 if (!buffer)
1823 return; 1864 return;
1824 if (pDIBitmap->GetBPP() != 32) { 1865 if (pDIBitmap->GetBPP() != 32) {
1825 return; 1866 return;
1826 } 1867 }
1827 int height = pDIBitmap->GetHeight(); 1868 int height = pDIBitmap->GetHeight();
1828 int width = pDIBitmap->GetWidth(); 1869 int width = pDIBitmap->GetWidth();
1829 int rowBytes = pDIBitmap->GetPitch(); 1870 int rowBytes = pDIBitmap->GetPitch();
1830 SkImageInfo unpremultipliedInfo = 1871 SkImageInfo unpremultipliedInfo =
1831 SkImageInfo::Make(width, height, kN32_SkColorType, kUnpremul_SkAlphaType); 1872 SkImageInfo::Make(width, height, kN32_SkColorType, kUnpremul_SkAlphaType);
1832 SkPixmap unpremultiplied(unpremultipliedInfo, buffer, rowBytes); 1873 SkPixmap unpremultiplied(unpremultipliedInfo, buffer, rowBytes);
1833 SkImageInfo premultipliedInfo = 1874 SkImageInfo premultipliedInfo =
1834 SkImageInfo::Make(width, height, kN32_SkColorType, kPremul_SkAlphaType); 1875 SkImageInfo::Make(width, height, kN32_SkColorType, kPremul_SkAlphaType);
1835 SkPixmap premultiplied(premultipliedInfo, buffer, rowBytes); 1876 SkPixmap premultiplied(premultipliedInfo, buffer, rowBytes);
1836 unpremultiplied.readPixels(premultiplied); 1877 unpremultiplied.readPixels(premultiplied);
1837 pDIBitmap->DebugVerifyBitmapIsPreMultiplied(); 1878 pDIBitmap->DebugVerifyBitmapIsPreMultiplied();
1838 } 1879 }
1880 #endif // _SKIA_SUPPORT_
1839 1881
1882 #ifdef _SKIA_SUPPORT_PATHS_
1883 void CFX_SkiaDeviceDriver::UnPreMultiply(CFX_DIBitmap* pDIBitmap) {
1884 if (!pDIBitmap->IsMarkedForUnPreMultiply())
1885 return;
1886 pDIBitmap->DebugVerifyBitmapIsPreMultiplied();
1887 void* buffer = pDIBitmap->GetBuffer();
1888 if (!buffer)
1889 return;
1890 if (pDIBitmap->GetBPP() != 32) {
1891 return;
1892 }
1893 int height = pDIBitmap->GetHeight();
1894 int width = pDIBitmap->GetWidth();
1895 int rowBytes = pDIBitmap->GetPitch();
1896 SkImageInfo premultipliedInfo =
1897 SkImageInfo::Make(width, height, kN32_SkColorType, kPremul_SkAlphaType);
1898 SkPixmap premultiplied(premultipliedInfo, buffer, rowBytes);
1899 SkImageInfo unpremultipliedInfo =
1900 SkImageInfo::Make(width, height, kN32_SkColorType, kUnpremul_SkAlphaType);
1901 SkPixmap unpremultiplied(unpremultipliedInfo, buffer, rowBytes);
1902 premultiplied.readPixels(unpremultiplied);
1903 pDIBitmap->MarkForUnPreMultiply(false);
1904 }
1905 #endif // _SKIA_SUPPORT_PATHS_
1906
1907 #ifdef _SKIA_SUPPORT_
1840 bool CFX_SkiaDeviceDriver::DrawBitsWithMask(const CFX_DIBSource* pSource, 1908 bool CFX_SkiaDeviceDriver::DrawBitsWithMask(const CFX_DIBSource* pSource,
1841 const CFX_DIBSource* pMask, 1909 const CFX_DIBSource* pMask,
1842 int bitmap_alpha, 1910 int bitmap_alpha,
1843 const CFX_Matrix* pMatrix, 1911 const CFX_Matrix* pMatrix,
1844 int blend_type) { 1912 int blend_type) {
1845 DebugValidate(m_pBitmap, m_pOriDevice); 1913 DebugValidate(m_pBitmap, m_pOriDevice);
1846 SkColorTable* srcCt = nullptr; 1914 SkColorTable* srcCt = nullptr;
1847 SkColorTable* maskCt = nullptr; 1915 SkColorTable* maskCt = nullptr;
1848 std::unique_ptr<uint8_t, FxFreeDeleter> src8Storage, mask8Storage; 1916 std::unique_ptr<uint8_t, FxFreeDeleter> src8Storage, mask8Storage;
1849 std::unique_ptr<uint32_t, FxFreeDeleter> src32Storage, mask32Storage; 1917 std::unique_ptr<uint32_t, FxFreeDeleter> src32Storage, mask32Storage;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1890 if (!m_pBitmap || !m_pBitmap->GetBuffer()) 1958 if (!m_pBitmap || !m_pBitmap->GetBuffer())
1891 return true; 1959 return true;
1892 CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), dest_left, 1960 CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), dest_left,
1893 dest_top + pBitmap->GetHeight()); 1961 dest_top + pBitmap->GetHeight());
1894 return DrawBitsWithMask(pBitmap, pMask, bitmap_alpha, &m, blend_type); 1962 return DrawBitsWithMask(pBitmap, pMask, bitmap_alpha, &m, blend_type);
1895 } 1963 }
1896 1964
1897 void CFX_SkiaDeviceDriver::Clear(uint32_t color) { 1965 void CFX_SkiaDeviceDriver::Clear(uint32_t color) {
1898 m_pCanvas->clear(color); 1966 m_pCanvas->clear(color);
1899 } 1967 }
1900 #endif 1968 #endif // _SKIA_SUPPORT_
1901 1969
1902 void CFX_SkiaDeviceDriver::Dump() const { 1970 void CFX_SkiaDeviceDriver::Dump() const {
1903 #ifdef SK_DEBUG 1971 #if SHOW_SKIA_PATH
1904 if (m_pCache) 1972 if (m_pCache)
1905 m_pCache->Dump(this); 1973 m_pCache->Dump(this);
1906 #endif 1974 #endif // SHOW_SKIA_PATH
1907 } 1975 }
1908 1976
1909 #ifdef _SKIA_SUPPORT_ 1977 #ifdef _SKIA_SUPPORT_
1910 void CFX_SkiaDeviceDriver::DebugVerifyBitmapIsPreMultiplied() const { 1978 void CFX_SkiaDeviceDriver::DebugVerifyBitmapIsPreMultiplied() const {
1911 if (m_pOriDevice) 1979 if (m_pOriDevice)
1912 m_pOriDevice->DebugVerifyBitmapIsPreMultiplied(); 1980 m_pOriDevice->DebugVerifyBitmapIsPreMultiplied();
1913 } 1981 }
1914 #endif 1982 #endif // _SKIA_SUPPORT_
1983
1984 #ifdef _SKIA_SUPPORT_PATHS_
1985 void CFX_SkiaDeviceDriver::UnPreMultiplyDevice() {
1986 UnPreMultiply(m_pBitmap);
1987 }
1988 #endif // _SKIA_SUPPORT_PATHS_
1915 1989
1916 CFX_FxgeDevice::CFX_FxgeDevice() { 1990 CFX_FxgeDevice::CFX_FxgeDevice() {
1917 #ifdef _SKIA_SUPPORT_ 1991 #ifdef _SKIA_SUPPORT_
1918 m_bOwnedBitmap = false; 1992 m_bOwnedBitmap = false;
1919 #endif 1993 #endif // _SKIA_SUPPORT_
1920 } 1994 }
1921 1995
1922 #ifdef _SKIA_SUPPORT_ 1996 #ifdef _SKIA_SUPPORT_
1923 void CFX_FxgeDevice::Clear(uint32_t color) { 1997 void CFX_FxgeDevice::Clear(uint32_t color) {
1924 CFX_SkiaDeviceDriver* skDriver = 1998 CFX_SkiaDeviceDriver* skDriver =
1925 static_cast<CFX_SkiaDeviceDriver*>(GetDeviceDriver()); 1999 static_cast<CFX_SkiaDeviceDriver*>(GetDeviceDriver());
1926 skDriver->Clear(color); 2000 skDriver->Clear(color);
1927 } 2001 }
1928 2002
1929 SkPictureRecorder* CFX_FxgeDevice::CreateRecorder(int size_x, int size_y) { 2003 SkPictureRecorder* CFX_FxgeDevice::CreateRecorder(int size_x, int size_y) {
1930 CFX_SkiaDeviceDriver* skDriver = new CFX_SkiaDeviceDriver(size_x, size_y); 2004 CFX_SkiaDeviceDriver* skDriver = new CFX_SkiaDeviceDriver(size_x, size_y);
1931 SetDeviceDriver(pdfium::WrapUnique(skDriver)); 2005 SetDeviceDriver(pdfium::WrapUnique(skDriver));
1932 return skDriver->GetRecorder(); 2006 return skDriver->GetRecorder();
1933 } 2007 }
1934 #endif 2008 #endif // _SKIA_SUPPORT_
1935 2009
1936 bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, 2010 bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap,
1937 bool bRgbByteOrder, 2011 bool bRgbByteOrder,
1938 CFX_DIBitmap* pOriDevice, 2012 CFX_DIBitmap* pOriDevice,
1939 bool bGroupKnockout) { 2013 bool bGroupKnockout) {
1940 if (!pBitmap) 2014 if (!pBitmap)
1941 return false; 2015 return false;
1942 SetBitmap(pBitmap); 2016 SetBitmap(pBitmap);
1943 SetDeviceDriver(pdfium::MakeUnique<CFX_SkiaDeviceDriver>( 2017 SetDeviceDriver(pdfium::MakeUnique<CFX_SkiaDeviceDriver>(
1944 pBitmap, bRgbByteOrder, pOriDevice, bGroupKnockout)); 2018 pBitmap, bRgbByteOrder, pOriDevice, bGroupKnockout));
1945 return true; 2019 return true;
1946 } 2020 }
1947 2021
1948 #ifdef _SKIA_SUPPORT_ 2022 #ifdef _SKIA_SUPPORT_
1949 bool CFX_FxgeDevice::AttachRecorder(SkPictureRecorder* recorder) { 2023 bool CFX_FxgeDevice::AttachRecorder(SkPictureRecorder* recorder) {
1950 if (!recorder) 2024 if (!recorder)
1951 return false; 2025 return false;
1952 SetDeviceDriver(pdfium::MakeUnique<CFX_SkiaDeviceDriver>(recorder)); 2026 SetDeviceDriver(pdfium::MakeUnique<CFX_SkiaDeviceDriver>(recorder));
1953 return true; 2027 return true;
1954 } 2028 }
1955 #endif 2029 #endif // _SKIA_SUPPORT_
1956 2030
1957 bool CFX_FxgeDevice::Create(int width, 2031 bool CFX_FxgeDevice::Create(int width,
1958 int height, 2032 int height,
1959 FXDIB_Format format, 2033 FXDIB_Format format,
1960 CFX_DIBitmap* pOriDevice) { 2034 CFX_DIBitmap* pOriDevice) {
1961 m_bOwnedBitmap = true; 2035 m_bOwnedBitmap = true;
1962 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; 2036 CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
1963 if (!pBitmap->Create(width, height, format)) { 2037 if (!pBitmap->Create(width, height, format)) {
1964 delete pBitmap; 2038 delete pBitmap;
1965 return false; 2039 return false;
1966 } 2040 }
1967 SetBitmap(pBitmap); 2041 SetBitmap(pBitmap);
1968 SetDeviceDriver(pdfium::MakeUnique<CFX_SkiaDeviceDriver>(pBitmap, false, 2042 SetDeviceDriver(pdfium::MakeUnique<CFX_SkiaDeviceDriver>(pBitmap, false,
1969 pOriDevice, false)); 2043 pOriDevice, false));
1970 return true; 2044 return true;
1971 } 2045 }
1972 2046
1973 CFX_FxgeDevice::~CFX_FxgeDevice() { 2047 CFX_FxgeDevice::~CFX_FxgeDevice() {
1974 #ifdef _SKIA_SUPPORT_ 2048 #ifdef _SKIA_SUPPORT_
1975 Flush(); 2049 Flush();
1976 // call destructor of CFX_RenderDevice / CFX_SkiaDeviceDriver immediately 2050 // call destructor of CFX_RenderDevice / CFX_SkiaDeviceDriver immediately
1977 if (m_bOwnedBitmap && GetBitmap()) 2051 if (m_bOwnedBitmap && GetBitmap())
1978 delete GetBitmap(); 2052 delete GetBitmap();
1979 #endif 2053 #endif // _SKIA_SUPPORT_
1980 } 2054 }
1981 2055
1982 #ifdef _SKIA_SUPPORT_ 2056 #ifdef _SKIA_SUPPORT_
1983 void CFX_FxgeDevice::DebugVerifyBitmapIsPreMultiplied() const { 2057 void CFX_FxgeDevice::DebugVerifyBitmapIsPreMultiplied() const {
1984 #ifdef SK_DEBUG 2058 #ifdef SK_DEBUG
1985 CFX_SkiaDeviceDriver* skDriver = 2059 CFX_SkiaDeviceDriver* skDriver =
1986 static_cast<CFX_SkiaDeviceDriver*>(GetDeviceDriver()); 2060 static_cast<CFX_SkiaDeviceDriver*>(GetDeviceDriver());
1987 if (skDriver) 2061 if (skDriver)
1988 skDriver->DebugVerifyBitmapIsPreMultiplied(); 2062 skDriver->DebugVerifyBitmapIsPreMultiplied();
1989 #endif 2063 #endif // SK_DEBUG
1990 } 2064 }
1991 2065
1992 bool CFX_FxgeDevice::SetBitsWithMask(const CFX_DIBSource* pBitmap, 2066 bool CFX_FxgeDevice::SetBitsWithMask(const CFX_DIBSource* pBitmap,
1993 const CFX_DIBSource* pMask, 2067 const CFX_DIBSource* pMask,
1994 int left, 2068 int left,
1995 int top, 2069 int top,
1996 int bitmap_alpha, 2070 int bitmap_alpha,
1997 int blend_type) { 2071 int blend_type) {
1998 CFX_SkiaDeviceDriver* skDriver = 2072 CFX_SkiaDeviceDriver* skDriver =
1999 static_cast<CFX_SkiaDeviceDriver*>(GetDeviceDriver()); 2073 static_cast<CFX_SkiaDeviceDriver*>(GetDeviceDriver());
2000 if (skDriver) 2074 if (skDriver)
2001 return skDriver->SetBitsWithMask(pBitmap, pMask, left, top, bitmap_alpha, 2075 return skDriver->SetBitsWithMask(pBitmap, pMask, left, top, bitmap_alpha,
2002 blend_type); 2076 blend_type);
2003 return false; 2077 return false;
2004 } 2078 }
2079 #endif // _SKIA_SUPPORT_
2080
2081 #ifdef _SKIA_SUPPORT_PATHS_
2082 void CFX_FxgeDevice::UnPreMultiplyDevice() {
2083 CFX_SkiaDeviceDriver* skDriver =
2084 static_cast<CFX_SkiaDeviceDriver*>(GetDeviceDriver());
2085 if (skDriver)
2086 skDriver->UnPreMultiplyDevice();
2087 }
2088 #endif // _SKIA_SUPPORT_PATHS_
2005 2089
2006 void CFX_DIBSource::DebugVerifyBitmapIsPreMultiplied(void* opt) const { 2090 void CFX_DIBSource::DebugVerifyBitmapIsPreMultiplied(void* opt) const {
2007 #ifdef SK_DEBUG 2091 #ifdef SK_DEBUG
2008 SkASSERT(32 == GetBPP()); 2092 SkASSERT(32 == GetBPP());
2009 const uint32_t* buffer = (const uint32_t*)(opt ? opt : GetBuffer()); 2093 const uint32_t* buffer = (const uint32_t*)(opt ? opt : GetBuffer());
2010 int width = GetWidth(); 2094 int width = GetWidth();
2011 int height = GetHeight(); 2095 int height = GetHeight();
2012 // verify that input is really premultiplied 2096 // verify that input is really premultiplied
2013 for (int y = 0; y < height; ++y) { 2097 for (int y = 0; y < height; ++y) {
2014 const uint32_t* srcRow = buffer + y * width; 2098 const uint32_t* srcRow = buffer + y * width;
2015 for (int x = 0; x < width; ++x) { 2099 for (int x = 0; x < width; ++x) {
2016 uint8_t a = SkGetPackedA32(srcRow[x]); 2100 uint8_t a = SkGetPackedA32(srcRow[x]);
2017 uint8_t r = SkGetPackedR32(srcRow[x]); 2101 uint8_t r = SkGetPackedR32(srcRow[x]);
2018 uint8_t g = SkGetPackedG32(srcRow[x]); 2102 uint8_t g = SkGetPackedG32(srcRow[x]);
2019 uint8_t b = SkGetPackedB32(srcRow[x]); 2103 uint8_t b = SkGetPackedB32(srcRow[x]);
2020 SkA32Assert(a); 2104 SkA32Assert(a);
2021 SkASSERT(r <= a); 2105 SkASSERT(r <= a);
2022 SkASSERT(g <= a); 2106 SkASSERT(g <= a);
2023 SkASSERT(b <= a); 2107 SkASSERT(b <= a);
2024 } 2108 }
2025 } 2109 }
2026 #endif 2110 #endif // SK_DEBUG
2027 } 2111 }
2028 #endif
2029 2112
2030 #ifndef _SKIA_SUPPORT_ 2113 #ifdef _SKIA_SUPPORT_PATHS_
2031 class CFX_Renderer { 2114 class CFX_Renderer {
2032 private: 2115 private:
2033 int m_Alpha, m_Red, m_Green, m_Blue, m_Gray; 2116 int m_Alpha, m_Red, m_Green, m_Blue, m_Gray;
2034 uint32_t m_Color; 2117 uint32_t m_Color;
2035 bool m_bFullCover; 2118 bool m_bFullCover;
2036 bool m_bRgbByteOrder; 2119 bool m_bRgbByteOrder;
2037 CFX_DIBitmap* m_pOriDevice; 2120 CFX_DIBitmap* m_pOriDevice;
2038 FX_RECT m_ClipBox; 2121 FX_RECT m_ClipBox;
2039 const CFX_DIBitmap* m_pClipMask; 2122 const CFX_DIBitmap* m_pClipMask;
2040 CFX_DIBitmap* m_pDevice; 2123 CFX_DIBitmap* m_pDevice;
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
2849 } 2932 }
2850 } 2933 }
2851 } 2934 }
2852 if (m_pDevice->GetBPP() == 1) { 2935 if (m_pDevice->GetBPP() == 1) {
2853 composite_span = &CFX_Renderer::CompositeSpan1bpp; 2936 composite_span = &CFX_Renderer::CompositeSpan1bpp;
2854 } 2937 }
2855 return true; 2938 return true;
2856 } 2939 }
2857 }; 2940 };
2858 2941
2859 #endif 2942 #endif // _SKIA_SUPPORT_PATHS_
OLDNEW
« no previous file with comments | « core/fxge/skia/fx_skia_device.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698