| Index: ui/gfx/gdi_util.cc
|
| diff --git a/ui/gfx/gdi_util.cc b/ui/gfx/gdi_util.cc
|
| index 24000aef13ea4acd5fed7a590bf8de37c60fe0ac..e94f0e49792b030d4f515612484944e598880e0f 100644
|
| --- a/ui/gfx/gdi_util.cc
|
| +++ b/ui/gfx/gdi_util.cc
|
| @@ -10,40 +10,15 @@
|
| #include <memory>
|
|
|
| #include "base/logging.h"
|
| -
|
| -namespace {
|
| -
|
| -void CreateBitmapHeaderWithColorDepth(LONG width,
|
| - LONG height,
|
| - WORD color_depth,
|
| - BITMAPINFOHEADER* hdr) {
|
| - // These values are shared with gfx::PlatformDevice
|
| - hdr->biSize = sizeof(BITMAPINFOHEADER);
|
| - hdr->biWidth = width;
|
| - hdr->biHeight = -height; // minus means top-down bitmap
|
| - hdr->biPlanes = 1;
|
| - hdr->biBitCount = color_depth;
|
| - hdr->biCompression = BI_RGB; // no compression
|
| - hdr->biSizeImage = 0;
|
| - hdr->biXPelsPerMeter = 1;
|
| - hdr->biYPelsPerMeter = 1;
|
| - hdr->biClrUsed = 0;
|
| - hdr->biClrImportant = 0;
|
| -}
|
| -
|
| -} // namespace
|
| +#include "skia/ext/skia_utils_win.h"
|
|
|
| namespace gfx {
|
|
|
| -void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr) {
|
| - CreateBitmapHeaderWithColorDepth(width, height, 32, hdr);
|
| -}
|
| -
|
| void CreateBitmapV4Header(int width, int height, BITMAPV4HEADER* hdr) {
|
| // Because bmp v4 header is just an extension, we just create a v3 header and
|
| // copy the bits over to the v4 header.
|
| BITMAPINFOHEADER header_v3;
|
| - CreateBitmapHeader(width, height, &header_v3);
|
| + skia::CreateBitmapHeader(width, height, &header_v3);
|
| memset(hdr, 0, sizeof(BITMAPV4HEADER));
|
| memcpy(hdr, &header_v3, sizeof(BITMAPINFOHEADER));
|
|
|
| @@ -55,43 +30,6 @@ void CreateBitmapV4Header(int width, int height, BITMAPV4HEADER* hdr) {
|
| hdr->bV4AlphaMask = 0xff000000;
|
| }
|
|
|
| -// Creates a monochrome bitmap header.
|
| -void CreateMonochromeBitmapHeader(int width,
|
| - int height,
|
| - BITMAPINFOHEADER* hdr) {
|
| - CreateBitmapHeaderWithColorDepth(width, height, 1, hdr);
|
| -}
|
| -
|
| -void SubtractRectanglesFromRegion(HRGN hrgn,
|
| - const std::vector<gfx::Rect>& cutouts) {
|
| - if (cutouts.size()) {
|
| - HRGN cutout = ::CreateRectRgn(0, 0, 0, 0);
|
| - for (size_t i = 0; i < cutouts.size(); i++) {
|
| - ::SetRectRgn(cutout,
|
| - cutouts[i].x(),
|
| - cutouts[i].y(),
|
| - cutouts[i].right(),
|
| - cutouts[i].bottom());
|
| - ::CombineRgn(hrgn, hrgn, cutout, RGN_DIFF);
|
| - }
|
| - ::DeleteObject(cutout);
|
| - }
|
| -}
|
| -
|
| -HRGN ConvertPathToHRGN(const gfx::Path& path) {
|
| - int point_count = path.getPoints(NULL, 0);
|
| - std::unique_ptr<SkPoint[]> points(new SkPoint[point_count]);
|
| - path.getPoints(points.get(), point_count);
|
| - std::unique_ptr<POINT[]> windows_points(new POINT[point_count]);
|
| - for (int i = 0; i < point_count; ++i) {
|
| - windows_points[i].x = SkScalarRoundToInt(points[i].fX);
|
| - windows_points[i].y = SkScalarRoundToInt(points[i].fY);
|
| - }
|
| -
|
| - return ::CreatePolygonRgn(windows_points.get(), point_count, ALTERNATE);
|
| -}
|
| -
|
| -
|
| float CalculatePageScale(HDC dc, int page_width, int page_height) {
|
| int dc_width = GetDeviceCaps(dc, HORZRES);
|
| int dc_height = GetDeviceCaps(dc, VERTRES);
|
|
|