summaryrefslogtreecommitdiff
path: root/core/fxge/skia/fx_skia_device.h
diff options
context:
space:
mode:
authorcaryclark <caryclark@google.com>2016-08-15 10:09:46 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-15 10:09:46 -0700
commitc4f3c0f183c9ce472cd22e831075c3897e14c3af (patch)
tree1dbc77920dc04eac93ba031dd552ee712c6a1afc /core/fxge/skia/fx_skia_device.h
parent845cac29d76e03960e1de9a019bba67ced84792a (diff)
downloadpdfium-c4f3c0f183c9ce472cd22e831075c3897e14c3af.tar.xz
add native draw bitmap with alpha mask
PDFs draw bitmaps with alpha by supplying an image alpha mask along side the image color data. The alpha mask may not be the same scale as the image data. Skia doesn't have a direct mapping for this draw call, but can come close by using the internal SkCompositeShader class. This scales the alpha mask to match the size of the image data, then puts both in the composite shader to draw. There are more things to do: - Allow Alpha8 or Gray8 to draw scaled to a matching device (blit doesn't work today) Temporary code marked with a TODO implements this functionality. - Refactor PDFium to allow SkComposeShader's components to take a matrix. The latter goal will defer drawing so that PDFium doesn't resize the mask, discarding resolution, before Skia has a chance to record it. Additionally fix drawing text with a negative font size. R=reed@google.com,dsinclair@chromium.org,herb@chromium.org Review-Url: https://codereview.chromium.org/2182763002
Diffstat (limited to 'core/fxge/skia/fx_skia_device.h')
-rw-r--r--core/fxge/skia/fx_skia_device.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h
index 661cf2e3b9..6e112f5f62 100644
--- a/core/fxge/skia/fx_skia_device.h
+++ b/core/fxge/skia/fx_skia_device.h
@@ -84,6 +84,12 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
int dest_left,
int dest_top,
int blend_type) override;
+ bool SetBitsWithMask(const CFX_DIBSource* pBitmap,
+ const CFX_DIBSource* pMask,
+ int dest_left,
+ int dest_top,
+ int bitmap_alpha,
+ int blend_type) override;
FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
int dest_left,
@@ -106,6 +112,12 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
void CancelDIBits(void* handle) override {}
+ bool DrawBitsWithMask(const CFX_DIBSource* pBitmap,
+ const CFX_DIBSource* pMask,
+ int bitmap_alpha,
+ const CFX_Matrix* pMatrix,
+ int blend_type);
+
FX_BOOL DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
@@ -125,6 +137,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
void PaintStroke(SkPaint* spaint,
const CFX_GraphStateData* pGraphState,
const SkMatrix& matrix);
+ void Clear(uint32_t color);
void Flush();
SkPictureRecorder* GetRecorder() const { return m_pRecorder; }
static void PreMultiply(CFX_DIBitmap* pDIBitmap);