Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / widget / windows / nsWindowGfx.h
blobc9298166668cbc5001bf4edb0e0fb453a4c19c6b
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef WindowGfx_h__
7 #define WindowGfx_h__
9 /*
10 * nsWindowGfx - Painting and aceleration.
13 #include "nsWindow.h"
14 #include <imgIContainer.h>
16 class nsISVGPaintContext;
18 class nsWindowGfx {
19 public:
20 enum IconSizeType { kSmallIcon, kRegularIcon };
21 static mozilla::LayoutDeviceIntSize GetIconMetrics(IconSizeType aSizeType);
23 /**
24 * Renders an imgIContainer to a HICON.
25 * aContainer - the image to render.
26 * aSVGContext - Optional CSS context properties to apply. Ignored if the
27 * container is not an SVG image.
28 * aIsCursor - true if this icon will be used as a mouse cursor.
29 * aHotSpot - the position of the hot spot for a mouse cursor.
30 * aScaledSize - the size of the icon to generate.
31 * aIcon - Out parameter for the returned HICON. Required.
33 static nsresult CreateIcon(imgIContainer* aContainer,
34 nsISVGPaintContext* aSVGContext, bool aIsCursor,
35 mozilla::LayoutDeviceIntPoint aHotspot,
36 mozilla::LayoutDeviceIntSize aScaledSize,
37 HICON* aIcon);
39 private:
40 /**
41 * Cursor helpers
43 static uint8_t* Data32BitTo1Bit(uint8_t* aImageData, uint32_t aWidth,
44 uint32_t aHeight);
45 static HBITMAP DataToBitmap(uint8_t* aImageData, uint32_t aWidth,
46 uint32_t aHeight, uint32_t aDepth);
49 #endif // WindowGfx_h__