Separate agg-authored code from fx-authored code.

Creates a separate library so we can apply less-strict warnings to
the code we can't change from upstream vs. the code we can change,
reducing noise in the standalone build.

Remove needless foo.{cpp,h} files that merely perform indirection
via #include "some_other_path/foo.{cpp,h}".

BUG=pdfium:166
R=brucedawson@chromium.org, thestig@chromium.org

Review URL: https://codereview.chromium.org/1152743007.
diff --git a/BUILD.gn b/BUILD.gn
index 54e9594..d0f2920 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -558,6 +558,9 @@
 }
 
 static_library("fxge") {
+  deps = [
+    "third_party:fx_agg",
+  ]
   sources = [
     "core/include/fxge/fpf.h",
     "core/include/fxge/fx_dib.h",
@@ -567,22 +570,7 @@
     "core/include/fxge/fx_ge_apple.h",
     "core/include/fxge/fx_ge_win32.h",
     "core/src/fxge/agg/include/fx_agg_driver.h",
-    "core/src/fxge/agg/include/fxfx_agg_basics.h",
-    "core/src/fxge/agg/include/fxfx_agg_clip_liang_barsky.h",
-    "core/src/fxge/agg/include/fxfx_agg_conv_dash.h",
-    "core/src/fxge/agg/include/fxfx_agg_conv_stroke.h",
-    "core/src/fxge/agg/include/fxfx_agg_curves.h",
-    "core/src/fxge/agg/include/fxfx_agg_path_storage.h",
-    "core/src/fxge/agg/include/fxfx_agg_rasterizer_scanline_aa.h",
-    "core/src/fxge/agg/include/fxfx_agg_renderer_scanline.h",
-    "core/src/fxge/agg/include/fxfx_agg_rendering_buffer.h",
-    "core/src/fxge/agg/include/fxfx_agg_scanline_u.h",
-    "core/src/fxge/agg/src/fxfx_agg_curves.cpp",
-    "core/src/fxge/agg/src/fxfx_agg_driver.cpp",
-    "core/src/fxge/agg/src/fxfx_agg_path_storage.cpp",
-    "core/src/fxge/agg/src/fxfx_agg_rasterizer_scanline_aa.cpp",
-    "core/src/fxge/agg/src/fxfx_agg_vcgen_dash.cpp",
-    "core/src/fxge/agg/src/fxfx_agg_vcgen_stroke.cpp",
+    "core/src/fxge/agg/src/fx_agg_driver.cpp",
     "core/src/fxge/android/fpf_skiafont.cpp",
     "core/src/fxge/android/fpf_skiafont.h",
     "core/src/fxge/android/fpf_skiafontmgr.cpp",
diff --git a/core/src/fxge/agg/DEPS b/core/src/fxge/agg/DEPS
new file mode 100644
index 0000000..25d9e11
--- /dev/null
+++ b/core/src/fxge/agg/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+  '+third_party/agg23',
+]
diff --git a/core/src/fxge/agg/include/fx_agg_driver.h b/core/src/fxge/agg/include/fx_agg_driver.h
index 803227e..29b56c7 100644
--- a/core/src/fxge/agg/include/fx_agg_driver.h
+++ b/core/src/fxge/agg/include/fx_agg_driver.h
@@ -7,8 +7,9 @@
 #ifndef FX_AGG_DRIVER_H_
 #define FX_AGG_DRIVER_H_
 
-#include "fxfx_agg_path_storage.h"
-#include "fxfx_agg_rasterizer_scanline_aa.h"
+#include "../../../../../third_party/agg23/agg_clip_liang_barsky.h"
+#include "../../../../../third_party/agg23/agg_path_storage.h"
+#include "../../../../../third_party/agg23/agg_rasterizer_scanline_aa.h"
 
 class CAgg_PathData 
 {
diff --git a/core/src/fxge/agg/include/fxfx_agg_basics.h b/core/src/fxge/agg/include/fxfx_agg_basics.h
deleted file mode 100644
index e27a843..0000000
--- a/core/src/fxge/agg/include/fxfx_agg_basics.h
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FXFX_AGG_BASICS_H_
-#define FXFX_AGG_BASICS_H_
-
-#include "../agg23/agg_basics.h"
-
-#endif  // FXFX_AGG_BASICS_H_
diff --git a/core/src/fxge/agg/include/fxfx_agg_clip_liang_barsky.h b/core/src/fxge/agg/include/fxfx_agg_clip_liang_barsky.h
deleted file mode 100644
index 2b64bf9..0000000
--- a/core/src/fxge/agg/include/fxfx_agg_clip_liang_barsky.h
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FXFX_AGG_CLIP_LIANG_BARSKY_H_
-#define FXFX_AGG_CLIP_LIANG_BARSKY_H_
-
-#include "../agg23/agg_clip_liang_barsky.h"
-
-#endif  // FXFX_AGG_CLIP_LIANG_BARSKY_H_
diff --git a/core/src/fxge/agg/include/fxfx_agg_conv_dash.h b/core/src/fxge/agg/include/fxfx_agg_conv_dash.h
deleted file mode 100644
index fb1e42d..0000000
--- a/core/src/fxge/agg/include/fxfx_agg_conv_dash.h
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FXFX_AGG_CONV_DASH_H_
-#define FXFX_AGG_CONV_DASH_H_
-
-#include "../agg23/agg_conv_dash.h"
-
-#endif  // FXFX_AGG_CONV_DASH_H_
diff --git a/core/src/fxge/agg/include/fxfx_agg_conv_stroke.h b/core/src/fxge/agg/include/fxfx_agg_conv_stroke.h
deleted file mode 100644
index 531df50..0000000
--- a/core/src/fxge/agg/include/fxfx_agg_conv_stroke.h
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FXFX_AGG_CONV_STROKE_H_
-#define FXFX_AGG_CONV_STROKE_H_
-
-#include "../agg23/agg_conv_stroke.h"
-
-#endif  // FXFX_AGG_CONV_STROKE_H_
diff --git a/core/src/fxge/agg/include/fxfx_agg_curves.h b/core/src/fxge/agg/include/fxfx_agg_curves.h
deleted file mode 100644
index 1879958..0000000
--- a/core/src/fxge/agg/include/fxfx_agg_curves.h
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FXFX_AGG_CURVES_H_
-#define FXFX_AGG_CURVES_H_
-
-#include "../agg23/agg_curves.h"
-
-#endif  // FXFX_AGG_CURVES_H_
diff --git a/core/src/fxge/agg/include/fxfx_agg_path_storage.h b/core/src/fxge/agg/include/fxfx_agg_path_storage.h
deleted file mode 100644
index ab7a85b..0000000
--- a/core/src/fxge/agg/include/fxfx_agg_path_storage.h
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FXFX_AGG_PATH_STORAGE_H_
-#define FXFX_AGG_PATH_STORAGE_H_
-
-#include "../agg23/agg_path_storage.h"
-
-#endif  // FXFX_AGG_PATH_STORAGE_H_
diff --git a/core/src/fxge/agg/include/fxfx_agg_rasterizer_scanline_aa.h b/core/src/fxge/agg/include/fxfx_agg_rasterizer_scanline_aa.h
deleted file mode 100644
index a445298..0000000
--- a/core/src/fxge/agg/include/fxfx_agg_rasterizer_scanline_aa.h
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FXFX_AGG_RASTERIZER_SCANLINE_AA_H_
-#define FXFX_AGG_RASTERIZER_SCANLINE_AA_H_
-
-#include "../agg23/agg_rasterizer_scanline_aa.h"
-
-#endif  // FXFX_AGG_RASTERIZER_SCANLINE_AA_H_
diff --git a/core/src/fxge/agg/include/fxfx_agg_renderer_scanline.h b/core/src/fxge/agg/include/fxfx_agg_renderer_scanline.h
deleted file mode 100644
index 1775dab..0000000
--- a/core/src/fxge/agg/include/fxfx_agg_renderer_scanline.h
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FXFX_AGG_RENDER_SCANLINE_H_
-#define FXFX_AGG_RENDER_SCANLINE_H_
-
-#include "../agg23/agg_renderer_scanline.h"
-
-#endif  // FXFX_AGG_RENDER_SCANLINE_H_
diff --git a/core/src/fxge/agg/include/fxfx_agg_rendering_buffer.h b/core/src/fxge/agg/include/fxfx_agg_rendering_buffer.h
deleted file mode 100644
index 0eb48b8..0000000
--- a/core/src/fxge/agg/include/fxfx_agg_rendering_buffer.h
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FXFX_AGG_RENDERING_BUFFER_H_
-#define FXFX_AGG_RENDERING_BUFFER_H_
-
-#include "../agg23/agg_rendering_buffer.h"
-
-#endif  // FXFX_AGG_RENDERING_BUFFER_H_
diff --git a/core/src/fxge/agg/include/fxfx_agg_scanline_u.h b/core/src/fxge/agg/include/fxfx_agg_scanline_u.h
deleted file mode 100644
index c850f62..0000000
--- a/core/src/fxge/agg/include/fxfx_agg_scanline_u.h
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FXFX_AGG_SCANLINE_U_H_
-#define FXFX_AGG_SCANLINE_U_H_
-
-#include "../agg23/agg_scanline_u.h"
-
-#endif  // FXFX_AGG_SCANLINE_U_H_
diff --git a/core/src/fxge/agg/agg23/fx_agg_driver.cpp b/core/src/fxge/agg/src/fx_agg_driver.cpp
similarity index 98%
rename from core/src/fxge/agg/agg23/fx_agg_driver.cpp
rename to core/src/fxge/agg/src/fx_agg_driver.cpp
index 0198872..18a1fa4 100644
--- a/core/src/fxge/agg/agg23/fx_agg_driver.cpp
+++ b/core/src/fxge/agg/src/fx_agg_driver.cpp
@@ -8,14 +8,14 @@
 #include "../../dib/dib_int.h"
 #include "../../ge/text_int.h"
 #include "../../../../include/fxcodec/fx_codec.h"
-#include "agg_pixfmt_gray.h"
-#include "agg_path_storage.h"
-#include "agg_scanline_u.h"
-#include "agg_rasterizer_scanline_aa.h"
-#include "agg_renderer_scanline.h"
-#include "agg_curves.h"
-#include "agg_conv_stroke.h"
-#include "agg_conv_dash.h"
+#include "../../../../../third_party/agg23/agg_pixfmt_gray.h"
+#include "../../../../../third_party/agg23/agg_path_storage.h"
+#include "../../../../../third_party/agg23/agg_scanline_u.h"
+#include "../../../../../third_party/agg23/agg_rasterizer_scanline_aa.h"
+#include "../../../../../third_party/agg23/agg_renderer_scanline.h"
+#include "../../../../../third_party/agg23/agg_curves.h"
+#include "../../../../../third_party/agg23/agg_conv_stroke.h"
+#include "../../../../../third_party/agg23/agg_conv_dash.h"
 #include "../include/fx_agg_driver.h"
 void _HardClip(FX_FLOAT& x, FX_FLOAT& y)
 {
diff --git a/core/src/fxge/agg/src/fxfx_agg_curves.cpp b/core/src/fxge/agg/src/fxfx_agg_curves.cpp
deleted file mode 100644
index 83817f7..0000000
--- a/core/src/fxge/agg/src/fxfx_agg_curves.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../agg23/fx_agg_curves.cpp"
diff --git a/core/src/fxge/agg/src/fxfx_agg_driver.cpp b/core/src/fxge/agg/src/fxfx_agg_driver.cpp
deleted file mode 100644
index a4e6a30..0000000
--- a/core/src/fxge/agg/src/fxfx_agg_driver.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../agg23/fx_agg_driver.cpp"
diff --git a/core/src/fxge/agg/src/fxfx_agg_path_storage.cpp b/core/src/fxge/agg/src/fxfx_agg_path_storage.cpp
deleted file mode 100644
index fabc526..0000000
--- a/core/src/fxge/agg/src/fxfx_agg_path_storage.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../agg23/fx_agg_path_storage.cpp"
diff --git a/core/src/fxge/agg/src/fxfx_agg_rasterizer_scanline_aa.cpp b/core/src/fxge/agg/src/fxfx_agg_rasterizer_scanline_aa.cpp
deleted file mode 100644
index 229e3ba..0000000
--- a/core/src/fxge/agg/src/fxfx_agg_rasterizer_scanline_aa.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../agg23/fx_agg_rasterizer_scanline_aa.cpp"
diff --git a/core/src/fxge/agg/src/fxfx_agg_vcgen_dash.cpp b/core/src/fxge/agg/src/fxfx_agg_vcgen_dash.cpp
deleted file mode 100644
index 4a259c0..0000000
--- a/core/src/fxge/agg/src/fxfx_agg_vcgen_dash.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../agg23/fx_agg_vcgen_dash.cpp"
diff --git a/core/src/fxge/agg/src/fxfx_agg_vcgen_stroke.cpp b/core/src/fxge/agg/src/fxfx_agg_vcgen_stroke.cpp
deleted file mode 100644
index 2311e1a..0000000
--- a/core/src/fxge/agg/src/fxfx_agg_vcgen_stroke.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
- 
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "../agg23/fx_agg_vcgen_stroke.cpp"
diff --git a/core/src/fxge/apple/fx_apple_platform.cpp b/core/src/fxge/apple/fx_apple_platform.cpp
index 07c5b6c..9db807c 100644
--- a/core/src/fxge/apple/fx_apple_platform.cpp
+++ b/core/src/fxge/apple/fx_apple_platform.cpp
@@ -6,15 +6,16 @@
 
 #include "../../../include/fxcrt/fx_system.h"
 #include "../../../include/fxge/fx_ge.h"
+
 #if _FXM_PLATFORM_  == _FXM_PLATFORM_APPLE_
-#include "apple_int.h"
-#include "../../../include/fxge/fx_ge_apple.h"
-#include "../agg/include/fxfx_agg_clip_liang_barsky.h"
-#include "../ge/text_int.h"
-#include "../dib/dib_int.h"
-#include "../agg/include/fx_agg_driver.h"
+
 #include "../../../include/fxge/fx_freetype.h"
-#if _FXM_PLATFORM_  == _FXM_PLATFORM_APPLE_
+#include "../../../include/fxge/fx_ge_apple.h"
+#include "../agg/include/fx_agg_driver.h"
+#include "../dib/dib_int.h"
+#include "../ge/text_int.h"
+#include "apple_int.h"
+
 void CFX_AggDeviceDriver::InitPlatform()
 {
     CQuartz2D & quartz2d = ((CApplePlatform *) CFX_GEModule::Get()->GetPlatformData())->_quartz2d;
@@ -169,5 +170,5 @@
         m_pPlatformFont = NULL;
     }
 }
-#endif
-#endif
+
+#endif  // _FXM_PLATFORM_  == _FXM_PLATFORM_APPLE_
diff --git a/core/src/fxge/apple/fx_quartz_device.cpp b/core/src/fxge/apple/fx_quartz_device.cpp
index 0638e15..8f0f4db 100644
--- a/core/src/fxge/apple/fx_quartz_device.cpp
+++ b/core/src/fxge/apple/fx_quartz_device.cpp
@@ -5,12 +5,12 @@
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
 #include "../../../include/fxcrt/fx_ext.h"
-#include "../../../include/fxge/fx_ge.h"
-#include "../agg/include/fxfx_agg_clip_liang_barsky.h"
-#include "../ge/text_int.h"
-#include "../dib/dib_int.h"
-#include "../agg/include/fx_agg_driver.h"
 #include "../../../include/fxge/fx_freetype.h"
+#include "../../../include/fxge/fx_ge.h"
+#include "../agg/include/fx_agg_driver.h"
+#include "../dib/dib_int.h"
+#include "../ge/text_int.h"
+
 #if _FXM_PLATFORM_  == _FXM_PLATFORM_APPLE_
 #include "apple_int.h"
 #include "../../../include/fxge/fx_ge_apple.h"
@@ -1125,4 +1125,4 @@
     m_bOwnedBitmap = TRUE;
     return Attach(pBitmap);
 }
-#endif
+#endif  // _FXM_PLATFORM_  == _FXM_PLATFORM_APPLE_
diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp
index 4bd0468..631ff8e 100644
--- a/core/src/fxge/ge/fx_ge_linux.cpp
+++ b/core/src/fxge/ge/fx_ge_linux.cpp
@@ -7,6 +7,7 @@
 #include "../../../include/fxge/fx_ge.h"
 #include "../agg/include/fx_agg_driver.h"
 #include "text_int.h"
+
 #if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_
 static const struct {
     const FX_CHAR*	m_pName;
@@ -228,4 +229,4 @@
 void CFX_GEModule::DestroyPlatform()
 {
 }
-#endif
+#endif  // _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_
diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp
index 8815029..f9da1cc 100644
--- a/core/src/fxge/win32/fx_win32_device.cpp
+++ b/core/src/fxge/win32/fx_win32_device.cpp
@@ -5,17 +5,19 @@
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
 #include "../../../include/fxge/fx_ge.h"
+
 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
-#include "../../../include/fxge/fx_ge_win32.h"
 #include <crtdbg.h>
-#include "../agg/include/fxfx_agg_clip_liang_barsky.h"
+
+#include "../../../include/fxcodec/fx_codec.h"
+#include "../../../include/fxge/fx_freetype.h"
+#include "../../../include/fxge/fx_ge_win32.h"
+#include "../agg/include/fx_agg_driver.h"
+#include "../dib/dib_int.h"
+#include "../ge/text_int.h"
 #include "dwrite_int.h"
 #include "win32_int.h"
-#include "../ge/text_int.h"
-#include "../dib/dib_int.h"
-#include "../agg/include/fx_agg_driver.h"
-#include "../../../include/fxge/fx_freetype.h"
-#include "../../../include/fxcodec/fx_codec.h"
+
 class CWin32FontInfo final : public IFX_SystemFontInfo
 {
 public:
@@ -1200,4 +1202,5 @@
     }
     delete GetBitmap();
 }
-#endif
+
+#endif  // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
diff --git a/pdfium.gyp b/pdfium.gyp
index c8894aa..3bcd1f6 100644
--- a/pdfium.gyp
+++ b/pdfium.gyp
@@ -551,7 +551,12 @@
     {
       'target_name': 'fxge',
       'type': 'static_library',
-      'ldflags': [ '-L<(PRODUCT_DIR)',],
+      'ldflags': [
+        '-L<(PRODUCT_DIR)',
+      ],
+      'dependencies': [
+        'third_party/third_party.gyp:fx_agg',
+      ],
       'sources': [
         'core/include/fxge/fpf.h',
         'core/include/fxge/fx_dib.h',
@@ -560,23 +565,8 @@
         'core/include/fxge/fx_ge.h',
         'core/include/fxge/fx_ge_apple.h',
         'core/include/fxge/fx_ge_win32.h',
-        'core/src/fxge/agg/include/fxfx_agg_basics.h',
-        'core/src/fxge/agg/include/fxfx_agg_clip_liang_barsky.h',
-        'core/src/fxge/agg/include/fxfx_agg_conv_dash.h',
-        'core/src/fxge/agg/include/fxfx_agg_conv_stroke.h',
-        'core/src/fxge/agg/include/fxfx_agg_curves.h',
-        'core/src/fxge/agg/include/fxfx_agg_path_storage.h',
-        'core/src/fxge/agg/include/fxfx_agg_rasterizer_scanline_aa.h',
-        'core/src/fxge/agg/include/fxfx_agg_renderer_scanline.h',
-        'core/src/fxge/agg/include/fxfx_agg_rendering_buffer.h',
-        'core/src/fxge/agg/include/fxfx_agg_scanline_u.h',
         'core/src/fxge/agg/include/fx_agg_driver.h',
-        'core/src/fxge/agg/src/fxfx_agg_curves.cpp',
-        'core/src/fxge/agg/src/fxfx_agg_driver.cpp',
-        'core/src/fxge/agg/src/fxfx_agg_path_storage.cpp',
-        'core/src/fxge/agg/src/fxfx_agg_rasterizer_scanline_aa.cpp',
-        'core/src/fxge/agg/src/fxfx_agg_vcgen_dash.cpp',
-        'core/src/fxge/agg/src/fxfx_agg_vcgen_stroke.cpp',
+        'core/src/fxge/agg/src/fx_agg_driver.cpp',
         'core/src/fxge/android/fpf_skiafont.cpp',
         'core/src/fxge/android/fpf_skiafont.h',
         'core/src/fxge/android/fpf_skiafontmgr.cpp',
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index 18baeb2..bcb7cba 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -30,6 +30,31 @@
   ]
 }
 
+source_set("fx_agg") {
+  configs -= [ "//build/config/compiler:chromium_code" ]
+  configs += [
+    "//build/config/compiler:no_chromium_code",
+    "//third_party/pdfium:pdfium_config",
+  ]
+  sources = [
+    "agg23/agg_basics.h",
+    "agg23/agg_clip_liang_barsky.h",
+    "agg23/agg_conv_dash.h",
+    "agg23/agg_conv_stroke.h",
+    "agg23/agg_curves.cpp",
+    "agg23/agg_curves.h",
+    "agg23/agg_path_storage.cpp",
+    "agg23/agg_path_storage.h",
+    "agg23/agg_rasterizer_scanline_aa.cpp",
+    "agg23/agg_rasterizer_scanline_aa.h",
+    "agg23/agg_renderer_scanline.h",
+    "agg23/agg_rendering_buffer.h",
+    "agg23/agg_scanline_u.h",
+    "agg23/agg_vcgen_dash.cpp",
+    "agg23/agg_vcgen_stroke.cpp",
+  ]
+}
+
 source_set("freetype") {
   configs -= [ "//build/config/compiler:chromium_code" ]
   configs += [
diff --git a/core/src/fxge/agg/agg23/agg_array.h b/third_party/agg23/agg_array.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_array.h
rename to third_party/agg23/agg_array.h
diff --git a/core/src/fxge/agg/agg23/agg_basics.h b/third_party/agg23/agg_basics.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_basics.h
rename to third_party/agg23/agg_basics.h
diff --git a/core/src/fxge/agg/agg23/agg_clip_liang_barsky.h b/third_party/agg23/agg_clip_liang_barsky.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_clip_liang_barsky.h
rename to third_party/agg23/agg_clip_liang_barsky.h
diff --git a/core/src/fxge/agg/agg23/agg_color_gray.h b/third_party/agg23/agg_color_gray.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_color_gray.h
rename to third_party/agg23/agg_color_gray.h
diff --git a/core/src/fxge/agg/agg23/agg_conv_adaptor_vcgen.h b/third_party/agg23/agg_conv_adaptor_vcgen.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_conv_adaptor_vcgen.h
rename to third_party/agg23/agg_conv_adaptor_vcgen.h
diff --git a/core/src/fxge/agg/agg23/agg_conv_dash.h b/third_party/agg23/agg_conv_dash.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_conv_dash.h
rename to third_party/agg23/agg_conv_dash.h
diff --git a/core/src/fxge/agg/agg23/agg_conv_stroke.h b/third_party/agg23/agg_conv_stroke.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_conv_stroke.h
rename to third_party/agg23/agg_conv_stroke.h
diff --git a/core/src/fxge/agg/agg23/fx_agg_curves.cpp b/third_party/agg23/agg_curves.cpp
similarity index 98%
rename from core/src/fxge/agg/agg23/fx_agg_curves.cpp
rename to third_party/agg23/agg_curves.cpp
index 861320e..5a2d563 100644
--- a/core/src/fxge/agg/agg23/fx_agg_curves.cpp
+++ b/third_party/agg23/agg_curves.cpp
@@ -18,7 +18,7 @@
 //          mcseemagg@yahoo.com
 //          http://www.antigrain.com
 //----------------------------------------------------------------------------
-#include "../../../../include/fxcrt/fx_basic.h"
+#include "../../core/include/fxcrt/fx_basic.h"
 #include "agg_curves.h"
 #include "agg_math.h"
 namespace agg
diff --git a/core/src/fxge/agg/agg23/agg_curves.h b/third_party/agg23/agg_curves.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_curves.h
rename to third_party/agg23/agg_curves.h
diff --git a/core/src/fxge/agg/agg23/agg_math.h b/third_party/agg23/agg_math.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_math.h
rename to third_party/agg23/agg_math.h
diff --git a/core/src/fxge/agg/agg23/agg_math_stroke.h b/third_party/agg23/agg_math_stroke.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_math_stroke.h
rename to third_party/agg23/agg_math_stroke.h
diff --git a/core/src/fxge/agg/agg23/fx_agg_path_storage.cpp b/third_party/agg23/agg_path_storage.cpp
similarity index 98%
rename from core/src/fxge/agg/agg23/fx_agg_path_storage.cpp
rename to third_party/agg23/agg_path_storage.cpp
index 8a87621..f5c9843 100644
--- a/core/src/fxge/agg/agg23/fx_agg_path_storage.cpp
+++ b/third_party/agg23/agg_path_storage.cpp
@@ -22,7 +22,7 @@
 // Class path_storage
 //
 //----------------------------------------------------------------------------
-#include "../../../../include/fxcrt/fx_basic.h"
+#include "../../core/include/fxcrt/fx_basic.h"
 #include "agg_path_storage.h"
 #include "agg_math.h"
 namespace agg
diff --git a/core/src/fxge/agg/agg23/agg_path_storage.h b/third_party/agg23/agg_path_storage.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_path_storage.h
rename to third_party/agg23/agg_path_storage.h
diff --git a/core/src/fxge/agg/agg23/agg_pixfmt_gray.h b/third_party/agg23/agg_pixfmt_gray.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_pixfmt_gray.h
rename to third_party/agg23/agg_pixfmt_gray.h
diff --git a/core/src/fxge/agg/agg23/fx_agg_rasterizer_scanline_aa.cpp b/third_party/agg23/agg_rasterizer_scanline_aa.cpp
similarity index 99%
rename from core/src/fxge/agg/agg23/fx_agg_rasterizer_scanline_aa.cpp
rename to third_party/agg23/agg_rasterizer_scanline_aa.cpp
index b26e259..8216e60 100644
--- a/core/src/fxge/agg/agg23/fx_agg_rasterizer_scanline_aa.cpp
+++ b/third_party/agg23/agg_rasterizer_scanline_aa.cpp
@@ -46,7 +46,7 @@
 // All other code is very different from the original.
 //
 //----------------------------------------------------------------------------
-#include "../../../../include/fxcrt/fx_ext.h"
+#include "../../core/include/fxcrt/fx_ext.h"
 #include <limits.h>
 #include "agg_rasterizer_scanline_aa.h"
 namespace agg
diff --git a/core/src/fxge/agg/agg23/agg_rasterizer_scanline_aa.h b/third_party/agg23/agg_rasterizer_scanline_aa.h
similarity index 99%
rename from core/src/fxge/agg/agg23/agg_rasterizer_scanline_aa.h
rename to third_party/agg23/agg_rasterizer_scanline_aa.h
index e06322c..da1900d 100644
--- a/core/src/fxge/agg/agg23/agg_rasterizer_scanline_aa.h
+++ b/third_party/agg23/agg_rasterizer_scanline_aa.h
@@ -29,7 +29,7 @@
 //----------------------------------------------------------------------------
 #ifndef AGG_RASTERIZER_SCANLINE_AA_INCLUDED
 #define AGG_RASTERIZER_SCANLINE_AA_INCLUDED
-#include "../../../../include/fxge/fx_ge.h"
+#include "../../core/include/fxge/fx_ge.h"
 #include "agg_basics.h"
 #include "agg_math.h"
 #include "agg_array.h"
diff --git a/core/src/fxge/agg/agg23/agg_render_scanlines.h b/third_party/agg23/agg_render_scanlines.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_render_scanlines.h
rename to third_party/agg23/agg_render_scanlines.h
diff --git a/core/src/fxge/agg/agg23/agg_renderer_base.h b/third_party/agg23/agg_renderer_base.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_renderer_base.h
rename to third_party/agg23/agg_renderer_base.h
diff --git a/core/src/fxge/agg/agg23/agg_renderer_scanline.h b/third_party/agg23/agg_renderer_scanline.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_renderer_scanline.h
rename to third_party/agg23/agg_renderer_scanline.h
diff --git a/core/src/fxge/agg/agg23/agg_rendering_buffer.h b/third_party/agg23/agg_rendering_buffer.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_rendering_buffer.h
rename to third_party/agg23/agg_rendering_buffer.h
diff --git a/core/src/fxge/agg/agg23/agg_scanline_u.h b/third_party/agg23/agg_scanline_u.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_scanline_u.h
rename to third_party/agg23/agg_scanline_u.h
diff --git a/core/src/fxge/agg/agg23/agg_shorten_path.h b/third_party/agg23/agg_shorten_path.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_shorten_path.h
rename to third_party/agg23/agg_shorten_path.h
diff --git a/core/src/fxge/agg/agg23/fx_agg_vcgen_dash.cpp b/third_party/agg23/agg_vcgen_dash.cpp
similarity index 98%
rename from core/src/fxge/agg/agg23/fx_agg_vcgen_dash.cpp
rename to third_party/agg23/agg_vcgen_dash.cpp
index 0b6c290..43f8edf 100644
--- a/core/src/fxge/agg/agg23/fx_agg_vcgen_dash.cpp
+++ b/third_party/agg23/agg_vcgen_dash.cpp
@@ -17,7 +17,7 @@
 // Line dash generator
 //
 //----------------------------------------------------------------------------
-#include "../../../../include/fxcrt/fx_basic.h"
+#include "../../core/include/fxcrt/fx_basic.h"
 #include "agg_vcgen_dash.h"
 #include "agg_shorten_path.h"
 namespace agg
diff --git a/core/src/fxge/agg/agg23/agg_vcgen_dash.h b/third_party/agg23/agg_vcgen_dash.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_vcgen_dash.h
rename to third_party/agg23/agg_vcgen_dash.h
diff --git a/core/src/fxge/agg/agg23/fx_agg_vcgen_stroke.cpp b/third_party/agg23/agg_vcgen_stroke.cpp
similarity index 98%
rename from core/src/fxge/agg/agg23/fx_agg_vcgen_stroke.cpp
rename to third_party/agg23/agg_vcgen_stroke.cpp
index 425ac45..9b8cb66 100644
--- a/core/src/fxge/agg/agg23/fx_agg_vcgen_stroke.cpp
+++ b/third_party/agg23/agg_vcgen_stroke.cpp
@@ -22,7 +22,7 @@
 // Stroke generator
 //
 //----------------------------------------------------------------------------
-#include "../../../../include/fxcrt/fx_basic.h"
+#include "../../core/include/fxcrt/fx_basic.h"
 #include "agg_vcgen_stroke.h"
 namespace agg
 {
diff --git a/core/src/fxge/agg/agg23/agg_vcgen_stroke.h b/third_party/agg23/agg_vcgen_stroke.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_vcgen_stroke.h
rename to third_party/agg23/agg_vcgen_stroke.h
diff --git a/core/src/fxge/agg/agg23/agg_vertex_sequence.h b/third_party/agg23/agg_vertex_sequence.h
similarity index 100%
rename from core/src/fxge/agg/agg23/agg_vertex_sequence.h
rename to third_party/agg23/agg_vertex_sequence.h
diff --git a/third_party/third_party.gyp b/third_party/third_party.gyp
index b697865..8538001 100644
--- a/third_party/third_party.gyp
+++ b/third_party/third_party.gyp
@@ -21,6 +21,33 @@
       ],
     },
     {
+      'target_name': 'fx_agg',
+      'type': 'static_library',
+      'sources': [
+        'agg23/agg_basics.h',
+        'agg23/agg_clip_liang_barsky.h',
+        'agg23/agg_conv_dash.h',
+        'agg23/agg_conv_stroke.h',
+        'agg23/agg_curves.cpp',
+        'agg23/agg_curves.h',
+        'agg23/agg_path_storage.cpp',
+        'agg23/agg_path_storage.h',
+        'agg23/agg_rasterizer_scanline_aa.cpp',
+        'agg23/agg_rasterizer_scanline_aa.h',
+        'agg23/agg_renderer_scanline.h',
+        'agg23/agg_rendering_buffer.h',
+        'agg23/agg_scanline_u.h',
+        'agg23/agg_vcgen_dash.cpp',
+        'agg23/agg_vcgen_stroke.cpp',
+      ],
+      'conditions': [
+        ['os_posix==1', {
+          # library contains several enum vs non-enum conditionals.
+          'cflags': [ '-Wno-extra', ],
+        }],
+      ],
+    },
+    {
       'target_name': 'freetype',
       'type': 'static_library',
       'defines': [