summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorcaryclark <caryclark@google.com>2016-05-19 07:01:03 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-19 07:01:03 -0700
commit749c14c24f7e8a838efc077a45ca7fe41db3e2ee (patch)
treeaf5fd5b293e505eb04610214f3c22839ccc0a199 /core
parent7b214237e2be6a0d962987d222c73161620c0a27 (diff)
downloadpdfium-749c14c24f7e8a838efc077a45ca7fe41db3e2ee.tar.xz
Remove agg from skia build
This removes the last vestiges of antigrain from a Skia-specific build. R=dsinclair@chromium.org,tsepez@chromium.org,thestig@chromium.org,reed@google.com Review-Url: https://codereview.chromium.org/1998623002
Diffstat (limited to 'core')
-rw-r--r--core/fxge/apple/fx_apple_platform.cpp3
-rw-r--r--core/fxge/apple/fx_quartz_device.cpp4
-rw-r--r--core/fxge/ge/fx_ge_linux.cpp3
-rw-r--r--core/fxge/skia/fx_skia_device.cpp2
-rw-r--r--core/fxge/win32/fx_win32_device.cpp122
5 files changed, 131 insertions, 3 deletions
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp
index e45b238cb5..a641ad5f85 100644
--- a/core/fxge/apple/fx_apple_platform.cpp
+++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -9,7 +9,10 @@
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
+#ifndef _SKIA_SUPPORT_
#include "core/fxge/agg/fx_agg_driver.h"
+#endif
+
#include "core/fxge/apple/apple_int.h"
#include "core/fxge/dib/dib_int.h"
#include "core/fxge/ge/fx_text_int.h"
diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp
index f3a4428ecc..6669899300 100644
--- a/core/fxge/apple/fx_quartz_device.cpp
+++ b/core/fxge/apple/fx_quartz_device.cpp
@@ -5,7 +5,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "core/fxcrt/include/fx_ext.h"
+
+#ifndef _SKIA_SUPPORT_
#include "core/fxge/agg/fx_agg_driver.h"
+#endif
+
#include "core/fxge/dib/dib_int.h"
#include "core/fxge/ge/fx_text_int.h"
#include "core/fxge/include/fx_freetype.h"
diff --git a/core/fxge/ge/fx_ge_linux.cpp b/core/fxge/ge/fx_ge_linux.cpp
index 0bd67b01be..0d5aff75fa 100644
--- a/core/fxge/ge/fx_ge_linux.cpp
+++ b/core/fxge/ge/fx_ge_linux.cpp
@@ -4,7 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#ifndef _SKIA_SUPPORT_
#include "core/fxge/agg/fx_agg_driver.h"
+#endif
+
#include "core/fxge/ge/fx_text_int.h"
#include "core/fxge/include/fx_ge.h"
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 7f47d855c9..d6d8218d57 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -233,7 +233,7 @@ bool AddSamples(const CPDF_Function* pFunc,
return false;
uint32_t sampleSize = sampledFunc->m_nBitsPerSample;
uint32_t sampleCount = encodeInfo.sizes;
- if (sampleCount != 1 << sampleSize)
+ if (sampleCount != 1U << sampleSize)
return false;
if (sampledFunc->m_pSampleStream->GetSize() <
sampleCount * 3 * sampleSize / 8) {
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index 3d96deb9e4..caf271dff3 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -10,7 +10,11 @@
#include <crtdbg.h>
#include "core/fxcodec/include/fx_codec.h"
+
+#ifndef _SKIA_SUPPORT_
#include "core/fxge/agg/fx_agg_driver.h"
+#endif
+
#include "core/fxge/dib/dib_int.h"
#include "core/fxge/ge/fx_text_int.h"
#include "core/fxge/include/fx_font.h"
@@ -807,6 +811,112 @@ static void _SetPathToDC(HDC hDC,
}
EndPath(hDC);
}
+
+#ifdef _SKIA_SUPPORT_
+// TODO(caryclark) This antigrain function is duplicated here to permit
+// removing the last remaining dependency. Eventually, this will be elminiated
+// altogether and replace by Skia code.
+
+struct rect_base {
+ FX_FLOAT x1;
+ FX_FLOAT y1;
+ FX_FLOAT x2;
+ FX_FLOAT y2;
+};
+
+static unsigned clip_liang_barsky(FX_FLOAT x1,
+ FX_FLOAT y1,
+ FX_FLOAT x2,
+ FX_FLOAT y2,
+ const rect_base& clip_box,
+ FX_FLOAT* x,
+ FX_FLOAT* y) {
+ const FX_FLOAT nearzero = 1e-30f;
+ FX_FLOAT deltax = x2 - x1;
+ FX_FLOAT deltay = y2 - y1;
+ unsigned np = 0;
+ if (deltax == 0)
+ deltax = (x1 > clip_box.x1) ? -nearzero : nearzero;
+ FX_FLOAT xin, xout;
+ if (deltax > 0) {
+ xin = clip_box.x1;
+ xout = clip_box.x2;
+ } else {
+ xin = clip_box.x2;
+ xout = clip_box.x1;
+ }
+ FX_FLOAT tinx = (xin - x1) / deltax;
+ if (deltay == 0)
+ deltay = (y1 > clip_box.y1) ? -nearzero : nearzero;
+ FX_FLOAT yin, yout;
+ if (deltay > 0) {
+ yin = clip_box.y1;
+ yout = clip_box.y2;
+ } else {
+ yin = clip_box.y2;
+ yout = clip_box.y1;
+ }
+ FX_FLOAT tiny = (yin - y1) / deltay;
+ FX_FLOAT tin1, tin2;
+ if (tinx < tiny) {
+ tin1 = tinx;
+ tin2 = tiny;
+ } else {
+ tin1 = tiny;
+ tin2 = tinx;
+ }
+ if (tin1 <= 1.0f) {
+ if (0 < tin1) {
+ *x++ = xin;
+ *y++ = yin;
+ ++np;
+ }
+ if (tin2 <= 1.0f) {
+ FX_FLOAT toutx = (xout - x1) / deltax;
+ FX_FLOAT touty = (yout - y1) / deltay;
+ FX_FLOAT tout1 = (toutx < touty) ? toutx : touty;
+ if (tin2 > 0 || tout1 > 0) {
+ if (tin2 <= tout1) {
+ if (tin2 > 0) {
+ if (tinx > tiny) {
+ *x++ = xin;
+ *y++ = y1 + (deltay * tinx);
+ } else {
+ *x++ = x1 + (deltax * tiny);
+ *y++ = yin;
+ }
+ ++np;
+ }
+ if (tout1 < 1.0f) {
+ if (toutx < touty) {
+ *x++ = xout;
+ *y++ = y1 + (deltay * toutx);
+ } else {
+ *x++ = x1 + (deltax * touty);
+ *y++ = yout;
+ }
+ } else {
+ *x++ = x2;
+ *y++ = y2;
+ }
+ ++np;
+ } else {
+ if (tinx > tiny) {
+ *x++ = xin;
+ *y++ = yout;
+ } else {
+ *x++ = xout;
+ *y++ = yin;
+ }
+ ++np;
+ }
+ }
+ }
+ }
+ return np;
+}
+#endif
+
void CGdiDeviceDriver::DrawLine(FX_FLOAT x1,
FX_FLOAT y1,
FX_FLOAT x2,
@@ -819,10 +929,18 @@ void CGdiDeviceDriver::DrawLine(FX_FLOAT x1,
return;
}
if (flag1 || flag2) {
+ FX_FLOAT x[2], y[2];
+ int np;
+#ifdef _SKIA_SUPPORT_
+ // TODO(caryclark) temporary replacement of antigrain in line function
+ // to permit removing antigrain altogether
+ rect_base rect = {0.0f, 0.0f, (FX_FLOAT)(m_Width), (FX_FLOAT)(m_Height)};
+ np = clip_liang_barsky(x1, y1, x2, y2, rect, x, y);
+#else
agg::rect_base<FX_FLOAT> rect(0.0f, 0.0f, (FX_FLOAT)(m_Width),
(FX_FLOAT)(m_Height));
- FX_FLOAT x[2], y[2];
- int np = agg::clip_liang_barsky<FX_FLOAT>(x1, y1, x2, y2, rect, x, y);
+ np = agg::clip_liang_barsky<FX_FLOAT>(x1, y1, x2, y2, rect, x, y);
+#endif
if (np == 0) {
return;
}