summaryrefslogtreecommitdiff
path: root/core/include/fxge
diff options
context:
space:
mode:
authorcaryclark <caryclark@google.com>2016-03-25 14:08:26 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-25 14:08:26 -0700
commit342f6fa66f6d843fe07d9b6a133656f83c8d62f6 (patch)
treea87e4ca21ea2d4444d98cd0ce28001de9925fa7a /core/include/fxge
parent46c8b1e3202ab5ae3663141dc25bec3b4360322e (diff)
downloadpdfium-342f6fa66f6d843fe07d9b6a133656f83c8d62f6.tar.xz
support gradients and stroke+fill
To draw paths that are stroked and filled with a pair of colors, reduce the fill by the width of the stroke. This is implemented with path ops subtracting the resolved stroke shape from the fill shape. This permits rendering the result without requiring an offscreen bitmap. The implementation for stroke+fill requires a new entry into the graphics engine, so a bit was added to device caps for that. Extract the gradient information out of the axial gradient function descriptions, and when possible, use Skia to draw the linear gradient directly. This requires making the function descriptions non-opaque, and adding a bit to device caps for another entry into the graphics engine. BUG= Review URL: https://codereview.chromium.org/1828283002
Diffstat (limited to 'core/include/fxge')
-rw-r--r--core/include/fxge/fx_ge.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/core/include/fxge/fx_ge.h b/core/include/fxge/fx_ge.h
index 8e9df8c544..d824d08228 100644
--- a/core/include/fxge/fx_ge.h
+++ b/core/include/fxge/fx_ge.h
@@ -14,6 +14,7 @@ class CFX_Font;
class CFX_FontMgr;
class CFX_FontCache;
class CFX_FaceCache;
+class CPDF_ShadingPattern;
class IFX_RenderDeviceDriver;
class CCodec_ModuleMgr;
class SkPictureRecorder;
@@ -215,6 +216,8 @@ class CFX_GraphStateData {
#define FXRC_BITMASK_OUTPUT 0x400
#define FXRC_BYTEMASK_OUTPUT 0x800
#define FXRENDER_IMAGE_LOSSY 0x1000
+#define FXRC_FILLSTROKE_PATH 0x2000
+#define FXRC_SHADING 0x4000
#define FXFILL_ALTERNATE 1
#define FXFILL_WINDING 2
#define FXFILL_FULLCOVER 4
@@ -397,6 +400,15 @@ class CFX_RenderDevice {
private:
void InitDeviceInfo();
void UpdateClipBox();
+ FX_BOOL DrawFillStrokePath(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ FX_DWORD fill_color,
+ FX_DWORD stroke_color,
+ int fill_mode,
+ int alpha_flag,
+ void* pIccTransform,
+ int blend_type);
CFX_DIBitmap* m_pBitmap;
int m_Width;
@@ -587,11 +599,16 @@ class IFX_RenderDeviceDriver {
return FALSE;
}
- virtual void* GetPlatformSurface() { return NULL; }
-
- virtual int GetDriverType() { return 0; }
-
+ virtual void* GetPlatformSurface() const { return NULL; }
+ virtual int GetDriverType() const { return 0; }
virtual void ClearDriver() {}
+
+ virtual FX_BOOL DrawShading(CPDF_ShadingPattern* pPattern,
+ CFX_Matrix* pMatrix,
+ int alpha,
+ FX_BOOL bAlphaMode) {
+ return false;
+ }
};
class IFX_PSOutput {