diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-07 20:07:17 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-07 20:07:17 +0000 |
commit | 86281adbe4f9e4c2eae038cf15706bf0d105483e (patch) | |
tree | ae789c433aeb5aa385f7cc5be1ddf7c2740ff668 /skia/ext | |
parent | db41b844f92a7a4a01644bff013e297691f4a8e4 (diff) | |
download | chromium_src-86281adbe4f9e4c2eae038cf15706bf0d105483e.zip chromium_src-86281adbe4f9e4c2eae038cf15706bf0d105483e.tar.gz chromium_src-86281adbe4f9e4c2eae038cf15706bf0d105483e.tar.bz2 |
Move classes depending on Skia out of base/gfx and into app/gfx. Rename
native_theme to native_theme_win since its Windows-specific.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/259047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28300 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext')
-rw-r--r-- | skia/ext/vector_canvas_unittest.cc | 21 | ||||
-rw-r--r-- | skia/ext/vector_platform_device_win.cc | 30 |
2 files changed, 41 insertions, 10 deletions
diff --git a/skia/ext/vector_canvas_unittest.cc b/skia/ext/vector_canvas_unittest.cc index 4cebf7b..59c6d0b 100644 --- a/skia/ext/vector_canvas_unittest.cc +++ b/skia/ext/vector_canvas_unittest.cc @@ -15,7 +15,6 @@ #include "app/gfx/codec/png_codec.h" #include "base/command_line.h" #include "base/file_util.h" -#include "base/gfx/gdi_util.h" #include "base/path_service.h" #include "base/string_util.h" #include "skia/ext/vector_canvas.h" @@ -43,7 +42,7 @@ class Context { private: HDC context_; - DISALLOW_EVIL_CONSTRUCTORS(Context); + DISALLOW_COPY_AND_ASSIGN(Context); }; // Lightweight HBITMAP management. @@ -51,7 +50,17 @@ class Bitmap { public: Bitmap(const Context& context, int x, int y) { BITMAPINFOHEADER hdr; - gfx::CreateBitmapHeader(x, y, &hdr); + hdr.biSize = sizeof(BITMAPINFOHEADER); + hdr.biWidth = x; + hdr.biHeight = -y; // Minus means top-down bitmap. + hdr.biPlanes = 1; + hdr.biBitCount = 32; + hdr.biCompression = BI_RGB; // No compression. + hdr.biSizeImage = 0; + hdr.biXPelsPerMeter = 1; + hdr.biYPelsPerMeter = 1; + hdr.biClrUsed = 0; + hdr.biClrImportant = 0; bitmap_ = CreateDIBSection(context.context(), reinterpret_cast<BITMAPINFO*>(&hdr), 0, &data_, NULL, 0); @@ -67,7 +76,7 @@ class Bitmap { void* data_; - DISALLOW_EVIL_CONSTRUCTORS(Bitmap); + DISALLOW_COPY_AND_ASSIGN(Bitmap); }; // Lightweight raw-bitmap management. The image, once initialized, is immuable. @@ -198,7 +207,7 @@ class Image { // Flag to signal if the comparison functions should ignore the alpha channel. const bool ignore_alpha_; - DISALLOW_EVIL_CONSTRUCTORS(Image); + DISALLOW_COPY_AND_ASSIGN(Image); }; // Base for tests. Capability to process an image. @@ -294,7 +303,7 @@ class ImageTest : public testing::Test { // Path to directory used to contain the test data. std::wstring test_dir_; - DISALLOW_EVIL_CONSTRUCTORS(ImageTest); + DISALLOW_COPY_AND_ASSIGN(ImageTest); }; // Premultiply the Alpha channel on the R, B and G channels. diff --git a/skia/ext/vector_platform_device_win.cc b/skia/ext/vector_platform_device_win.cc index 48375da..c89badd 100644 --- a/skia/ext/vector_platform_device_win.cc +++ b/skia/ext/vector_platform_device_win.cc @@ -6,12 +6,25 @@ #include "skia/ext/vector_platform_device_win.h" -#include "base/gfx/gdi_util.h" #include "skia/ext/skia_utils_win.h" #include "third_party/skia/include/core/SkUtils.h" namespace skia { +static void FillBitmapInfoHeader(int width, int height, BITMAPINFOHEADER* hdr) { + hdr->biSize = sizeof(BITMAPINFOHEADER); + hdr->biWidth = width; + hdr->biHeight = -height; // Minus means top-down bitmap. + hdr->biPlanes = 1; + hdr->biBitCount = 32; + hdr->biCompression = BI_RGB; // no compression + hdr->biSizeImage = 0; + hdr->biXPelsPerMeter = 1; + hdr->biYPelsPerMeter = 1; + hdr->biClrUsed = 0; + hdr->biClrImportant = 0; +} + VectorPlatformDevice* VectorPlatformDevice::create(HDC dc, int width, int height) { InitializeDC(dc); @@ -562,9 +575,18 @@ void VectorPlatformDevice::InternalDrawBitmap(const SkBitmap& bitmap, if (!src_size_x || !src_size_y) return; - // Create a BMP v4 header that we can serialize. + // Create a BMP v4 header that we can serialize. We use the shared "V3" + // fillter to fill the stardard items, then add in the "V4" stuff we want. BITMAPV4HEADER bitmap_header; - gfx::CreateBitmapV4Header(src_size_x, src_size_y, &bitmap_header); + memset(&bitmap_header, 0, sizeof(BITMAPV4HEADER)); + FillBitmapInfoHeader(src_size_x, src_size_y, + reinterpret_cast<BITMAPINFOHEADER*>(&bitmap_header)); + bitmap_header.bV4Size = sizeof(BITMAPV4HEADER); + bitmap_header.bV4RedMask = 0x00ff0000; + bitmap_header.bV4GreenMask = 0x0000ff00; + bitmap_header.bV4BlueMask = 0x000000ff; + bitmap_header.bV4AlphaMask = 0xff000000; + HDC dc = getBitmapDC(); SkAutoLockPixels lock(bitmap); SkASSERT(bitmap.getConfig() == SkBitmap::kARGB_8888_Config); @@ -589,7 +611,7 @@ void VectorPlatformDevice::InternalDrawBitmap(const SkBitmap& bitmap, } BITMAPINFOHEADER hdr; - gfx::CreateBitmapHeader(src_size_x, src_size_y, &hdr); + FillBitmapInfoHeader(src_size_x, src_size_y, &hdr); if (is_translucent) { // The image must be loaded as a bitmap inside a device context. HDC bitmap_dc = ::CreateCompatibleDC(dc); |