Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: base/gfx/bitmap_header.cc

Issue 1612: Implement "iframe shim" behavior for windowed plugins.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/gfx/bitmap_header.h ('k') | base/gfx/bitmap_platform_device_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/gfx/bitmap_header.h"
6
7 namespace gfx {
8
9 void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr) {
10 CreateBitmapHeaderWithColorDepth(width, height, 32, hdr);
11 }
12
13 void CreateBitmapHeaderWithColorDepth(int width, int height, int color_depth,
14 BITMAPINFOHEADER* hdr) {
15 // These values are shared with gfx::PlatformDevice
16 hdr->biSize = sizeof(BITMAPINFOHEADER);
17 hdr->biWidth = width;
18 hdr->biHeight = -height; // minus means top-down bitmap
19 hdr->biPlanes = 1;
20 hdr->biBitCount = color_depth;
21 hdr->biCompression = BI_RGB; // no compression
22 hdr->biSizeImage = 0;
23 hdr->biXPelsPerMeter = 1;
24 hdr->biYPelsPerMeter = 1;
25 hdr->biClrUsed = 0;
26 hdr->biClrImportant = 0;
27 }
28
29
30 void CreateBitmapV4Header(int width, int height, BITMAPV4HEADER* hdr) {
31 // Because bmp v4 header is just an extension, we just create a v3 header and
32 // copy the bits over to the v4 header.
33 BITMAPINFOHEADER header_v3;
34 CreateBitmapHeader(width, height, &header_v3);
35 memset(hdr, 0, sizeof(BITMAPV4HEADER));
36 memcpy(hdr, &header_v3, sizeof(BITMAPINFOHEADER));
37
38 // Correct the size of the header and fill in the mask values.
39 hdr->bV4Size = sizeof(BITMAPV4HEADER);
40 hdr->bV4RedMask = 0x00ff0000;
41 hdr->bV4GreenMask = 0x0000ff00;
42 hdr->bV4BlueMask = 0x000000ff;
43 hdr->bV4AlphaMask = 0xff000000;
44 }
45
46 // Creates a monochrome bitmap header.
47 void CreateMonochromeBitmapHeader(int width,
48 int height,
49 BITMAPINFOHEADER* hdr) {
50 hdr->biSize = sizeof(BITMAPINFOHEADER);
51 hdr->biWidth = width;
52 hdr->biHeight = -height;
53 hdr->biPlanes = 1;
54 hdr->biBitCount = 1;
55 hdr->biCompression = BI_RGB;
56 hdr->biSizeImage = 0;
57 hdr->biXPelsPerMeter = 1;
58 hdr->biYPelsPerMeter = 1;
59 hdr->biClrUsed = 0;
60 hdr->biClrImportant = 0;
61 }
62
63 } // namespace gfx
64
OLDNEW
« no previous file with comments | « base/gfx/bitmap_header.h ('k') | base/gfx/bitmap_platform_device_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698