|
Lines 64-69
bool GraphicsContext::shouldIncludeChild
WebCore/platform/graphics/win/GraphicsContextWin.cpp_sec1
|
| 64 |
return m_data->m_shouldIncludeChildWindows; |
64 |
return m_data->m_shouldIncludeChildWindows; |
| 65 |
} |
65 |
} |
| 66 |
|
66 |
|
|
|
67 |
GraphicsContext::WindowsBitmap::WindowsBitmap(HDC hdc, IntSize size) |
| 68 |
: m_hdc(0) |
| 69 |
, m_size(size) |
| 70 |
{ |
| 71 |
BitmapInfo bitmapInfo = BitmapInfo::create(m_size); |
| 72 |
|
| 73 |
m_bitmap = CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, reinterpret_cast<void**>(&m_bitmapBuffer), 0, 0); |
| 74 |
if (!m_bitmap) |
| 75 |
return; |
| 76 |
|
| 77 |
m_hdc = CreateCompatibleDC(hdc); |
| 78 |
SelectObject(m_hdc, m_bitmap); |
| 79 |
|
| 80 |
BITMAP bmpInfo; |
| 81 |
GetObject(m_bitmap, sizeof(bmpInfo), &bmpInfo); |
| 82 |
m_bytesPerRow = bmpInfo.bmWidthBytes; |
| 83 |
m_bitmapBufferLength = bmpInfo.bmWidthBytes * bmpInfo.bmHeight; |
| 84 |
|
| 85 |
SetGraphicsMode(m_hdc, GM_ADVANCED); |
| 86 |
} |
| 87 |
|
| 88 |
GraphicsContext::WindowsBitmap::~WindowsBitmap() |
| 89 |
{ |
| 90 |
if (!m_bitmap) |
| 91 |
return; |
| 92 |
|
| 93 |
DeleteDC(m_hdc); |
| 94 |
DeleteObject(m_bitmap); |
| 95 |
} |
| 96 |
|
| 97 |
GraphicsContext::WindowsBitmap* GraphicsContext::createWindowsBitmap(IntSize size) |
| 98 |
{ |
| 99 |
return new WindowsBitmap(m_data->m_hdc, size); |
| 100 |
} |
| 101 |
|
| 67 |
HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap) |
102 |
HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap) |
| 68 |
{ |
103 |
{ |
| 69 |
// FIXME: Should a bitmap be created also when a shadow is set? |
104 |
// FIXME: Should a bitmap be created also when a shadow is set? |
|
Lines 90-97
HDC GraphicsContext::getWindowsContext(c
WebCore/platform/graphics/win/GraphicsContextWin.cpp_sec2
|
| 90 |
SetGraphicsMode(bitmapDC, GM_ADVANCED); |
125 |
SetGraphicsMode(bitmapDC, GM_ADVANCED); |
| 91 |
|
126 |
|
| 92 |
// Apply a translation to our context so that the drawing done will be at (0,0) of the bitmap. |
127 |
// Apply a translation to our context so that the drawing done will be at (0,0) of the bitmap. |
| 93 |
TransformationMatrix translate(1.0f, 0.0f, 0.0f, 1.0f, -dstRect.x(), -dstRect.y()); |
128 |
XFORM xform = TransformationMatrix().translate(-dstRect.x(), -dstRect.y()); |
| 94 |
XFORM xform = translate; |
|
|
| 95 |
|
129 |
|
| 96 |
::SetWorldTransform(bitmapDC, &xform); |
130 |
::SetWorldTransform(bitmapDC, &xform); |
| 97 |
|
131 |
|
|
Lines 134-142
void GraphicsContextPlatformPrivate::sca
WebCore/platform/graphics/win/GraphicsContextWin.cpp_sec3
|
| 134 |
if (!m_hdc) |
168 |
if (!m_hdc) |
| 135 |
return; |
169 |
return; |
| 136 |
|
170 |
|
| 137 |
TransformationMatrix scale(size.width(), 0.0f, 0.0f, size.height(), 0.0f, 0.0f); |
171 |
XFORM xform = TransformationMatrix().scale(size.width(), size.height()); |
| 138 |
|
|
|
| 139 |
XFORM xform = scale; |
| 140 |
ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); |
172 |
ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); |
| 141 |
} |
173 |
} |
| 142 |
|
174 |
|
|
Lines 144-156
static const double deg2rad = 0.01745329
WebCore/platform/graphics/win/GraphicsContextWin.cpp_sec4
|
| 144 |
|
176 |
|
| 145 |
void GraphicsContextPlatformPrivate::rotate(float degreesAngle) |
177 |
void GraphicsContextPlatformPrivate::rotate(float degreesAngle) |
| 146 |
{ |
178 |
{ |
| 147 |
float radiansAngle = degreesAngle * deg2rad; |
179 |
XFORM xform = TransformationMatrix().rotate(degreesAngle); |
| 148 |
float cosAngle = cosf(radiansAngle); |
|
|
| 149 |
float sinAngle = sinf(radiansAngle); |
| 150 |
|
| 151 |
TransformationMatrix rotate(cosAngle, -sinAngle, sinAngle, cosAngle, 0.0f, 0.0f); |
| 152 |
|
| 153 |
XFORM xform = rotate; |
| 154 |
ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); |
180 |
ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); |
| 155 |
} |
181 |
} |
| 156 |
|
182 |
|
|
Lines 159-167
void GraphicsContextPlatformPrivate::tra
WebCore/platform/graphics/win/GraphicsContextWin.cpp_sec5
|
| 159 |
if (!m_hdc) |
185 |
if (!m_hdc) |
| 160 |
return; |
186 |
return; |
| 161 |
|
187 |
|
| 162 |
TransformationMatrix translate(1.0f, 0.0f, 0.0f, 1.0f, x, y); |
188 |
XFORM xform = TransformationMatrix().translate(x, y); |
| 163 |
|
|
|
| 164 |
XFORM xform = translate; |
| 165 |
ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); |
189 |
ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); |
| 166 |
} |
190 |
} |
| 167 |
|
191 |
|
|
Lines 171-177
void GraphicsContextPlatformPrivate::con
WebCore/platform/graphics/win/GraphicsContextWin.cpp_sec6
|
| 171 |
return; |
195 |
return; |
| 172 |
|
196 |
|
| 173 |
XFORM xform = transform; |
197 |
XFORM xform = transform; |
| 174 |
|
|
|
| 175 |
ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); |
198 |
ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); |
| 176 |
} |
199 |
} |
| 177 |
|
200 |
|